C Program find Output code snippet SET - 6
1.
|
The modulus operator cannot be used with a long double.
|
|||||||
Workspace
|
2.
|
What will be the output of the program?
#include<stdio.h>
int main()
{
int i=-3,
j=2, k=0, m;
m = ++i
&& ++j && ++k;
printf("%d,
%d, %d, %d\n", i, j, k, m);
return 0;
}
|
|||||||||||||||
Workspace
|
3.
|
In a function two return statements should never
occur.
|
|||||||
Workspace
|
4.
|
It is necessary that a header files should have a .h extension?
|
|||||||
Workspace
|
5.
|
How many bytes are occupied by near, far and huge pointers
(DOS)?
|
|||||||||||||||
Workspace
|
6.
|
What will be the output of the program ?
#include<stdio.h>
int main()
{
int x=30,
*y, *z;
y=&x; /*
Assume address of x is 500 and integer is 4 byte size */
z=y;
*y++=*z++;
x++;
printf("x=%d,
y=%d, z=%d\n", x, y, z);
return 0;
}
|
|||||||||||||||
Workspace
|
7.
|
What will be the output of the program ?
#include<stdio.h>
int main()
{
void *vp;
char ch=74,
*cp="JACK";
int j=65;
vp=&ch;
printf("%c",
*(char*)vp);
vp=&j;
printf("%c",
*(int*)vp);
vp=cp;
printf("%s",
(char*)vp+2);
return 0;
}
|
|||||||||||||||
Workspace
|
8.
|
Which of the statements is correct about the program?
#include<stdio.h>
int main()
{
int arr[3][3]
= {1, 2, 3, 4};
printf("%d\n",
*(*(*(arr))));
return 0;
}
|
|||||||||||||||
Workspace
|
9.
|
What will be the output of the program ?
#include<stdio.h>
#include<string.h>
int main()
{
char str[] = "India\0\BIX\0";
printf("%s\n",
str);
return 0;
}
|
|||||||||||||||
Workspace
|
10.
|
What will be the output of the program in Turbo C (under DOS)?
#include<stdio.h>
int main()
{
struct emp
{
char *n;
int age;
};
struct emp e1
= {"Dravid", 23};
struct emp e2
= e1;
strupr(e2.n);
printf("%s\n",
e1.n);
return 0;
}
|
|||||||||||||||
Workspace
|
11.
|
Point out the error in the program?
#include<stdio.h>
int main()
{
struct a
{
float category:5;
char scheme:4;
};
printf("size=%d", sizeof(struct a));
return 0;
}
|
|||||||||||||||
Workspace
|
12.
|
Point out the error in the program?
#include<stdio.h>
#include<string.h>
void modify(struct emp*);
struct emp
{
char name[20];
int age;
};
int main()
{
struct emp e =
{"Sanjay", 35};
modify(&e);
printf("%s
%d", e.name, e.age);
return 0;
}
void modify(struct emp *p)
{
p
->age=p->age+2;
}
|
|||||||||||||||
Workspace
|
13.
|
The '.' operator can be used access structure elements using a
structure variable.
|
|||||||
Workspace
|
14.
|
Can we specify a variable filed width in a scanf() format
string?
|
|||||||
Workspace
|
15.
|
Which header file should be included to use functions like malloc() and calloc()?
|
|||||||||||||||
Workspace
|
16.
|
If malloc() successfully allocates memory it returns
the number of bytes it has allocated.
|
|||||||
Workspace
|
17.
|
In a function that receives variable number of arguments the fixed
arguments passed to the function can be at the end of argument list.
|
|||||||
Workspace
|
18.
|
We can allocate a 2-Dimensional array dynamically.
|
|||||||
Workspace
|
19.
|
Are the following declarations same?
char far
*far *scr;
char far
far** scr;
|
|||||||
Workspace
|
20.
|
What is the purpose of fflush() function.
|
|||||||||||||||
|
Comments
Post a Comment