Adv. C MCQ
Adv. C MCQ
Adv. C MCQ
A. Bjarne Stroustrup
B. Dennis Ritchie
C. James A. Gosling
Answer : B
2. C Language developed at ?
Answer : A
A. -3.4e38 to 3.4e38
B. -32767 to 32768
C. -32768 to 32767
D. -32668 to 32667
Answer : C
4. C programs are converted into machine language with the help of
A. An Editor
B. A compiler
C. An operating system
Answer : B
A. An alphabet
B. A number
Answer : D
A. []
B. {}
C. ()
Answer : C
7. Which of the following shows the correct hierarchy of arithmetic operations in
C
A. / + * -
B. * - / +
C. + - / *
D. * / + -
Answer : D
8. What is an array?
C. An array is not a collection of variables that are of the same data type.
Answer : B
C. int n{6} = { 2, 4, 12 } ;
Answer : A
B. Random
Answer : A
11. What is the right way to access value of structure variable book{ price, page }?
Answer : A
Answer : B
Answer : D
D. A & B Both
Answer : D
A. Keywords have some predefine meanings and these meanings can be changed.
Answer : C
A. Constants have fixed values that do not change during the execution of
a
program
B. Constants have fixed values that change during the execution of a program
C. Constants have unknown values that may be change during the execution of a
program
Answer : A
D. B & C Both
Answer : D
A. ::, ?
B. ?, :
C. ?, ;;
Answer : B
_? A. Constant
B. Variable
C. Special Symbol
Answer : A
Answer : C
C. Function is a block of code that performs a specific task. It has a name and it is
reusable
Answer : D
Answer : B
A. 54
B. 27
C. 26
Answer : D
A. Array
B. Binary Tree
C. Queue
D. Stack
Answer : B
B. Load Balancing
C. Parallel Fashion
Answer : D
A. LIFO
B. LILO
C. FILO
D. FIFO
Answer : D
A. 10
B. 0
C. 12
D. 1
Answer : D
A. Priority
B. Tree
C. Dqueue
D. All of the above
Answer : B
A. Strings
B. Queue
C. Lists
Answer : D
A. prints 100
B. print garbage
Answer : C
A. calloc
B. free
C. malloc
D. realloc
Answer : D
A. 30
B. 36
C. 108
D. 42
Answer : D
C. Regular language
Answer : A
34. The worst case time complexity of AVL tree is better in comparison to
binary search tree for
Answer : D
35. In which tree, for every node the height of its left subtree and right subtree
differ almost by one?
B. AVL tree
Answer : B
36. C is Language?
A. Low Level
B. High Level
C. Assembly Level
D. Machine Level
A. Call by Value
B. Call by Reference
C. Call by Address
D. Call by Name
Answer : A
Answer : B
B. Circular list
Answer : C
D. A and C both
Answer : D
5+3*2%10-8*6
a) -37
b) -42
c) -32
d) -28
Ans: a
a) error
b) 10
c) 10 10
d) none of these
Ans: d
printf("%X%x%ci%x",11,10,'s',12);
a) error
b) basc
c) Bas94c
d) none of these
Ans: b
a) 0
b) error
c) 1
d) garbage value
Ans: a
void main()
{ printf("hello"); main(); }
a) 1
b) 2
d) none of these
Ans: c
6. What will be output if you will compile and execute the following c code?
struct marks{
int p:3;
int c:3;
int m:2;
};
void main(){
printf("%d %d %d",s.p,s.c,s.m);
(a) 2 -6 5
(b) 2 -6 1
(c) 2 2 1
Ans: c
a) 03%D
b) 000
c) 032
d) 321
Ans: c
8. What will be the output of the following statement ?
printf( 3 + "goodbye");
a) goodbye
b) odbye
c) bye
d) dbye
Ans: d
a) error
b) garbage value
c) 0
d) 2
Ans: b
#include
void main()
{ int a = 2;
switch(a)
{ case 1:
printf("goodbye"); break;
case 2:
continue;
case 3:
printf("bye");
a) error
b) goodbye
c) bye
d) byegoodbye
Ans: a
a) error
b) 2
c) 3
d) -3
Ans: c
12. What will be the output of following program ?
#include
main()
x = y * NULL;
printf("%d",x);
a) error
b) 0
c) 10
d) garbage value
Ans: b
a) 88
b) 18
c) 29
d) 19
Ans: d
14. What will be the output of the following statements ?
a) 1
b) 2
c) 6
d) Error
Ans: d
int i = 3; printf("%d
%d",i,i++); a) 34
b) 43
c) 44
d) 33
Ans: b
#include
void main()
int a = 36, b = 9;
printf("%d",a>>a/b-2);
a) 9
b) 7
c) 5
d) none of these
Ans: a
a) 11
b) 7
c) 5
d) 9
Ans: a
int a=10,b=20;
char x=1,y=0;
if(a,b,x,y)
{
printf("EXAM");
a) XAM is printed
b) exam is printed
c) Compiler Error
d) Nothing is printed
Ans: d
#include
void main()
int s=0;
while(s++<10)>
# define a 10
main()
{ printf("%d..",a
); foo();
printf("%d",a);
}
void foo()
#undef a
#define a 50
a) 10..10
b) 10..50
c) Error
d) 0
Ans: c
20. main()
struct
int i;
}xyz;
(*xyz)->i=10;
printf("%d",xyz.i);
b) 10
d) address of I
Ans: b
Ans: C
#include
main()
char str[]="S\065AB";
printf("\n%d", sizeof(str));
a) 7
b) 6
c) 5
d) error
Ans: b
23. What will be the value of `a` after the following code is executed
a = square(2+3)
a) 25
b) 13
c) 11
d) 10
Ans: c
24. #include
void func()
int x = 0;
static int y = 0;
x++; y++;
}
int main()
{ func();
func();
return 0;
a)
1 -- 1
1 -- 1
b)
1 -- 1
2 -- 1
c)
1 -- 1
2 -- 2
d)
1 -- 1
1 -- 2
Ans: d
????
With what do you replace the ???? to make the function shown above return the
correct answer?
a)
if (x == 0) return 0;
b)
return 1;
c)
if (x >= 2) return 2;
d)
if (x <= 1) return 1;
Ans: d
a) 6
b) 7
c) 8
d) 9
Ans: d
27. int i = 4;
switch (i)
default: ;
case 3:
i += 5;
if ( i == 8)
i++;
if (i == 9) break;
i *= 2;
i -= 4;
break;
case 8:
i += 5;
break;
}
printf("i = %d\n", i);
a) i = 5
b) i = 8
c) i = 9
d) i = 10
Ans: a
28. What will be output if you will compile and execute the following c code?
void main()
{ if(printf("cquestionbank"
else
(a) I know c
29.What will be output if you will compile and execute the following c code?
main(){
printf("%s",call(c/c++));
} (a)c
(b)c++
(c)#c/c++
(d)c/c++
(e)Compiler error
Answer: (d)
30. What will be output if you will compile and execute the following c code?
power of c"
void main()
{ clrscr();
printf("%s",message);
getch();
}
Answer: (b)
31. What will be output if you will compile and execute the following c code?
void main(){
int a=25;
clrscr();
printf("%o %x",a,a);
getch();
(a) 25 25
(c) 12 42
(d) 31 19
Answer: (d)
32. What will be output if you will compile and execute the following c code?
void main()
i=((5,(i=3)),i=1);
printf("%d",i);
} else
printf("equal");
(a) 5
(b) 3
(c) 1
(d) equal
Answer: (c)
33.What will be output if you will compile and execute the following c code?
int extern x;
void main()
printf("%d",x);
x=2;
getch();
int x=23;
(a) 0
(b) 2
(c) 23
Answer: (c)
34.What will be output if you will compile and execute the following c code?
void main(){
int a,b;
a=1,3,15;
b=(2,4,6);
clrscr();
printf("%d ",a+b);
getch();
(a) 3
(b) 21
(c) 17
(d) 7
Answer: (d)
35.What will be output if you will compile and execute the following c code?
void main(){
static main;
int x;
x=call(main);
clrscr();
printf("%d ",x);
getch();
address++;
return address;
(a) 0
(b) 1
Answer: (b)
36. What will be output if you will compile and execute the following c code?
#include "string.h"
void main(){
clrscr();
printf("%d %d",sizeof("string"),strlen("string"));
getch();
(a) 6 6
(b) 7 7
(c) 6 7
(d) 7 6
Answer: (d)
37. Write c program which display mouse pointer and position of pointer.(In
x coordinate, y coordinate)?
Answer:
#include”dos.h”
#include”stdio.h”
void main()
int x,y,k;
i.x.ax=1;
int86(0x33,&i,&o);
while(!kbhit()) //its value will false when we hit key in the key board
x=o.x.cx;
y=o.x.dx;
clrscr();
printf("(%d , %d)",x,y);
delay(250);
int86(0x33,&i,&o);
getch();
38.What will be output if you will compile and execute the following c code?
void main(){
int huge*p=(int huge*)0XC0563331;
*p=200;
printf("%d",*q);
(a)0
(b)Garbage value
(e)Compiler error
Answer: (d)
39.What will be output if you will compile and execute the following c code?
struct marks{
int p:3;
int c:3;
int m:2;
};
void main(){
printf("%d %d %d",s.p,s.c,s.m);
}
(a) 2 -6 5
(b) 2 -6 1
(c) 2 2 1
Answer: (c)
40.What will be output if you will compile and execute the following c code?
void main()
{ if(printf("cquestionbank"
else
(a) I know c
Answer: (c)
41.What will be output if you will compile and execute the following c
code?
#define call(x) #x void
main(){
printf("%s",call(c/c++));
} (a)c
(b)c++
(c)#c/c++
(d)c/c++
(e)Compiler error
Answer: (d)
42. What will be output if you will compile and execute the following c code?
power of c"
void main(){
clrscr();
printf("%s",message);
getch();
(c) union is
Power of c
Answer: (b)
43. What will be output if you will compile and execute the following c code?
void main(){
int a=25;
clrscr();
printf("%o %x",a,a);
getch();
(a) 25 25
(c) 12 42
(d) 31 19
Answer: (d)
44. What will be output if you will compile and execute the following c code?
void main(){
int i=0;
if(i==0){ i=((5,
(i=3)),i=1);
printf("%d",i);
} else
printf("equal");
(a) 5
(b) 3
(c) 1
(d) equal
Answer: (c)
45.What will be output if you will compile and execute the following c code?
int extern x;
void main()
printf("%d",x);
x=2;
getch();
int x=23;
(a) 0
(b) 2
(c) 23
Answer: (c)
46.What will be output if you will compile and execute the following c code?
void main(){
int a,b;
a=1,3,15;
b=(2,4,6);
clrscr();
printf("%d ",a+b);
getch();
(a) 3
(b) 21
(c) 17
(d) 7
Answer: (d)
47.What will be output if you will compile and execute the following c code?
void main(){
static main;
int x;
x=call(main);
clrscr();
printf("%d ",x);
getch();
address++;
return address;
(a) 0
(b) 1
Answer: (b)
48.What will be output if you will compile and execute the following c code?
#include "string.h"
void main(){
clrscr();
printf("%d %d",sizeof("string"),strlen("string"));
getch();
(a) 6 6
(b) 7 7
(c) 6 7
(d) 7 6
Answer: (d)
49.What will be output if you will compile and execute the following c code?
void main(){
*p=200;
printf("%d",*q);
(a)0
(b)Garbage value
(c)null (d) 200
(e)Compiler error
Answer: (d)
50.What will be output if you will compile and execute the following c code?
struct marks{
int p:3;
int c:3;
int m:2;
};
void main(){
printf("%d %d %d",s.p,s.c,s.m);
(a) 2 -6 5
(b) 2 -6 1
(c) 2 2 1
Answer: (c)
51.What will be output if you will compile and execute the following c code?
void main()
{ if(printf("cquestionbank"
else
(a) I know c
Answer: (c)
52.What will be output if you will compile and execute the following c code?
main(){
printf("%s",call(c/c++));
} (a)c
(b)c++
(c)#c/c++
(d)c/c++
(e)Compiler error
Answer: (d)
53. What will be output if you will compile and execute the following c code?
power of c"
void main(){
clrscr();
printf("%s",message);
getch();
(c) union is
Power of c
Answer: (b)
54. What will be output if you will compile and execute the following c code?
void main(){
int a=25;
clrscr();
printf("%o %x",a,a);
getch();
(a) 25 25
(c) 12 42
(d) 31 19
Answer: (d)
55.What will be output if you will compile and execute the following c code?
void main(){
int i=0;
if(i==0){
i=((5,(i=3)),i=1);
printf("%d",i);
} else
printf("equal");
}
(a) 5
(b) 3
(c) 1
(d) equal
Answer: (c)
56.What will be output if you will compile and execute the following c code?
int extern x;
void main()
printf("%d",x);
x=2;
getch();
int x=23;
(a) 0
(b) 2
(c) 23
Answer: (c)
57.What will be output if you will compile and execute the following c code?
void main(){
int a,b;
a=1,3,15;
b=(2,4,6);
clrscr();
printf("%d ",a+b);
getch();
(a) 3
(b) 21
(c) 17
(d) 7
Answer: (d)
58.What will be output if you will compile and execute the following c code?
void main(){
static main;
int x;
x=call(main);
clrscr();
printf("%d ",x);
getch();
address++;
return address;
(a) 0
(b) 1
Answer: (b)
59.What will be output if you will compile and execute the following c code?
#include "string.h"
void main(){
clrscr();
printf("%d %d",sizeof("string"),strlen("string"));
getch();
(a) 6 6
(b) 7 7
(c) 6 7
(d) 7 6
Answer: (d)
60.What will be output if you will compile and execute the following c code?
void main(){
*p=200;
printf("%d",*q);
(a)0
(b)Garbage value
(e)Compiler error
Answer: (d)