1-what is the output of following?
void main(){ printf("%d",1||2); }
a. error b .1 c. 3 d. None of these
2-What is the output of following ?
void main(){
int i=100, j=200 , k=300;
printf("%d ,%d" ) ; }
a. 200,300 b. 300,200 c. 100,200 d .error
3-What is the output of following ?
abc(int i){
printf("%d",i); }
void main(){
abc((200,100)); }
- a. 200 b . 100 c . compile time error d. run time error
4-What is the output of following ?
void main() {
abc() ; }
abc(){
printf("Hello");}
a. error of no prototype b. warning c . Hello d. Both b & c
5-What is the output of following code ?
void main(){
printf("ab\b"); printf("ab\r"); printf("a"); }
a. aaa b. abb c. aba d.None
6-What is the output of following code ?
void main(){
int far *p,*q;
int c;
c=sizeof(p)*sizeof(q)*sizeof(4); printf("%d",c);}
a. 4 b. 32 c. 8 d. 16
7-What is output ?
void main(){
int i=5;
printf("%d",(i++ + ++i) || (++i + ++i));
printf(" %d",i);}
a. 1 9 b. 1 6 c. 1 7 d. None of these
8-What is the output?
#define fun(x,y) (x##y)
void main(){int i
;i=fun(200+5,5+200);
printf("%d",i); }
a. run time error b. 1 c. 455 d. 205205
9-What is output ?
void main (){int x ; printf("%d",x=10);}
a. Error b. 10 c. 1 d. garbage value
10-What is the output ?
void main()
{ int a,b=0;
if( a=b=0 )
printf (" Hello ");
else
printf ("World"); }
a. Hello b. World c. compile error d. Runtime error
11-Waht is the output ?
void main(){
int i,j,k;
printf("%d",printf("%d",scanf("%d", &j)*scanf("%d",&i))); }// input is i=10 j=10
a. 100 b. 11 c. 1 d. 0
12-which of the following declarations is valid ?
a. void fun(int ) b. void fun(int i,...) c. void fun(int i,j) d. None
13-What is output of following ?
void main(){
static int i;
for( ; i++ ; printf("%d ", i) );
printf("%d",i); }
a. infinite loop b. error c. 0 d. 1
14-What is the value of EOF ?
a. -1 b. 0 c. any garbage value d. may be a or b
15-When all the data r read from file ,feof(filepointer) will return
a. 0 b. -1 c. any non zero value d. depends on compiler
16-what does tho following function do ?
str=strlwr(str) where str=string
a. convert all lowercase letters to uppercase b. convert all uppercase letters to lowercase c. convert 1st letter to upper & rest to lower d. none
17-What is a difference between a declaration and a definition of a variable?
a. Both can occur multiple times, but a declaration must occur first.
b. A definition occurs once, but a declaration may occur many times.
c. A declaration occurs once, but a definition may occur many times.
d. Both can occur multiple times, but a definition must occur first.
18-int testarray [3] [2] [2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
What value does testarray [2][1][0] in the sample code above contain?
a. 3 b. 5 c. 7 d. 11
19-void myFunc (int x) {
if (x > 0)
myFunc(--x);
printf("%d, ", x); }
int main() { myFunc(5); return 0; }
What will the above sample code produce when executed?
a. 1, 2, 3, 4, 5, 5, b. 4, 3, 2, 1, 0, 0 c. 5, 4, 3, 2, 1, 0, d. 0, 0, 1, 2, 3, 4,
20-11 ^ 5
What does the operation shown above produce?
a. 1 b. error c. 5th power of 11 d. 14
21-time_t t;
Which one of the following statements will properly initialize the variable t with the current time from the sample above?
a. t = clock() b. time( &t ); c. t = ctime(); d. t = localtime();
22-What is the output of following
#define man(x,y) x>y?x:y;
void main(){
int i=10 , j ,k;j=5;k=0;
k=man ( i++ , ++j );
printf("%d %d %d",i,j,k);}
a. 12 6 11 b. 11 6 10 c. 11 6 11 d. 12 6 10
23-What is the output of following ?
#define mess junk
void main(){ printf("mess"); }
a. mess b. junk c. meshjunk d. error that mess cant be used in printf
24-void main(){
int y=128;
const int x=y; printf("%d",x); }
a. 128 b. compile error c. warning d. 0
25-Wha is the output of following ?
void main() { int g=300*300/300; printf("%d",g); }
a. 300 b. 81 c. error d. 1
26-What is the output of following ?
void main(){ int x; x=3*4%5; printf("%d",x); }
a. 12 b. 0 c. 2 d. 1
-à27-#define square(x) x*x
void main(){ int i=10, j=5 ,k=0; k=square(i-j); printf("%d",k); }
a. 25 b. 45 c. 75 d. 0
28-What is the output ?
void main() { char *s="\12345s\n"; printf("%d",sizeof(s)) }// \n check
a. 7 b. 6 c. 8 d. 5
29-Find number of errors in following ?
int f();
void main() {
f(1); f(1,2); f(1,2,3); }
f(int i,int j,int k) {
printf("%d %d %d",i,j,k); }
a. 1 b. 2 c. None d. 0
30-Which one of the following will declare a pointer to an integer at address 0x200 in memory?
a. int *x; *x = 0x200; b. int *x( &0x200 ); c. int *x = *0x200; d. int *x = 0x200;
31-What will x contain in below code ?
int x=011 | 0x10;
a. 3 b. 13 c. 25 d. None
32-What is the output of following?
void main(){ int i=024; printf("%d",i); }
a. 24 b. 024 c. 20 d. None
33-What is the output of following ?
void main(){
char *p; p="He"LL"o"; printf("%s",p); }
a. he"LL"o b. HeLLo c. error d. He
34-What is output ?
abc(){
int a;
if(1>0)
return 1;
a=100;
a++;
return ++a;}
void main(){
int i ; i=abc(); printf("%d",i);}
a. 1 & 1 warning b. 1 & 2 warning c. 1 & 3 warning d. 111
35- What is the output ?
abc(int i){ return i; }
void main(){
int i; i=abc(printf("Hello World")); printf("%d",i); }
a. 11 b. error c. 12 d. None
//36-What is the output ?
void main(){
char far* near* str; printf("%d",sizeof(str)); }
a. 2 b. 4 c. error d. 1
37-What is the output ?
void main(){
const int i; int k=10; i=100; k=++k + i; printf("%d",k); }
a. 111 b. error c. 112 d. None
38-What is the output ?
#define printifless(x,y) if(x
void main(){
int i=2,k=1;
if(i>0 && k>0)
printifless(i,k);
else
printf("A"); }
a. A b. nothing c. error d. 2
39-What is the output ?
void main(){
int a=10,b=20,c=30,d=40;
if(a,b,c,d)
printf("Hello"); }
a. Hello b. error c. warning d. Hello10203040
40-What is the output?
main(){
int i=100,j=10,k;
int *p=&j; k=i/*p;
printf("%d",k);}
a. 10 b. error c. warning d. 1
41-What is the output?
main(){
extern int i ; i=20; printf("%d",i);}
a. compile error b. runtime error c. linker error d. 20
42-What is the output ?
main(){
int i=-1 ,j=-1,k=0,l=2,m;
m=i++ && j++ && k++ || l++;
printf("%d %d %d %d %d",i,j,k,l,m);}
a. error b. 0 0 1 3 1 c. 0 0 1 3 2 d. warning
43- main(){
static int i;
switch(i) {
default:printf("garbage");
case 0: printf("Zero"); break;
case 1:printf("one"); break;
case 2: printf("two"); break; } }
a. error b. zero c. garbage zero d. zero grabage
44-What is output ?
main(){
printf("%x",-1
a. ff00 b. ffff c. 240 d. None
//45-What is output ?
main(){int i=5; printf("%d%d%d%d%d",i++,i--,++i,--i,i); }
a. 54554 b. 45545 c. 54454 d. 45445
46-.What is the output ?
#define square(x) x*x
main(){
int i;
i = 64/square(4);
printf("%d",i);}
a. 16 b. 64 c. 4 d. error
47-Size of structure can be determined by
1-sizeof(variablename) 2-sizeof(struct tag)
a. only 1 b. only 2 c. both 1 & 2 d. none
48-What is the output ?
main(){
printf("%p",main);}
a. some address b. undefined symbol error c. 0xfa d. None
49-#define int char
main(){
int i=65;
printf("%d",sizeof(i));}
a. error b. 1 c. 2 d. 0
50-What is the output ?
main(){
char string[]="Hello World";
display(string);}
void display(char *string){
printf("%s",string);}
a. "Hello World" b. Hellow World c. error d. warning & Hello World
No comments:
Post a Comment