Professional Documents
Culture Documents
100 TOP C Language Multiple Choice Anszers
100 TOP C Language Multiple Choice Anszers
P a g e 1 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
9. What is right way to Initialization array? 13. Bitwise operators can operate upon?
10. An array elements are always stored in _________ memory locations. 14. What is C Tokens?
11. What is the right way to access value of structure variable book{ price, page }? 15. What is Keywords?
A. printf("%d%d", book.price, book.page); A. Keywords have some predefine meanings and these meanings can be changed.
B. printf("%d%d", price.book, page.book); B. Keywords have some unknown meanings and these meanings cannot be
changed.
C. printf("%d%d", price::book, page::book);
C. Keywords have some predefine meanings and these meanings cannot be
D. printf("%d%d", price‐>book, page‐>book);
changed.
12. perror( ) function used to ?
D. None of the above
A. Work same as printf()
16. What is constant?
B. prints the error message specified by the compiler
A. Constants have fixed values that do not change during the execution of a
C. prints the garbage value assigned by the compiler program
D. None of the above 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
A. int constant var =10; A. Function is a block of statements that perform some specific task.
B. int const var = 10; B. Function is the fundamental modular unit. A function is usually designed to
perform a
C. const int var = 10;
specific task.
D. B & C Both
C. Function is a block of code that performs a specific task. It has a name and it is
18. Which operators are known as Ternary Operator?
reusable
A. ::, ?
D. All the above
B. ?, :
22. Which one of the following sentences is true ?
C. ?, ;;
A. The body of a while loop is executed at least once.
D. None of the above
B. The body of a do ... while loop is executed at least once.
19. In switch statement, each case instance value must be _______?
C. The body of a do ... while loop is executed zero or more times.
A. Constant
D. A for loop can never be used in place of a while loop.
B. Variable
23. A binary tree with 27 nodes has _______ null branches.
C. Special Symbol
A. 54
D. None of the above
B. 27
20. What is the work of break keyword?
C. 26
A. Halt execution of program
D. None of the above
B. Restart execution of program
24. Which one of the following is not a linear data structure?
C. Exit from loop or switch statement
A. Array
D. None of the above
B. Binary Tree
C. Queue
D. Stack
P a g e 3 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
25. Recursive functions are executed in a? 29. Which of the following data structure is linear type?
26. Queue is a _____________ list. 30. The statement printf("%c", 100); will print?
27. The statement print f ("%d", 10 ? 0 ? 5 : 1 : 12); will print? 31. The _______ memory allocation function modifies the previous allocated space.
A. 10 A. calloc
B. 0 B. free
C. 12 C. malloc
D. 1 D. realloc
28. To represent hierarchical relationship between elements, which data structure is 32. Number of binary trees formed with 5 nodes are
suitable? A. 30
A. Priority B. 36
B. Tree C. 108
C. Dqueue D. 42
P a g e 4 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
33. The "C" language is 37. The Default Parameter Passing Mechanism is called as
34. The worst case time complexity of AVL tree is better in comparison to binary 38. What is Dequeue?
A. Search and Insert Operations B. Elements can be added to or removed from either the front or rear
D. Search, Insert and Delete Operations 39. In which linked list last node address is null?
35. In which tree, for every node the height of its left subtree and right subtree A. Doubly linked list
C. Threaded Binary Tree 40. Which is the correct syntax to declare constant pointer?
C. Assembly Level
D. Machine Level
P a g e 5 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
More TOP C Language Multiple Choice b) error
b) 10 d) none of these
c) 10 10 6. What will be output if you will compile and execute the following c code?
b) basc };
a) 0
P a g e 6 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
(a) 2 ‐6 5 d) 2
(c) 2 2 1 #include
b) 000 case 2:
c) 032 continue;
d) 321 case 3:
printf( 3 + "goodbye"); }
a) goodbye }
b) odbye a) error
c) bye b) goodbye
d) dbye c) bye
long int a = scanf("%ld%ld",&a,&a); printf("%ld",a); 11. What will be the output of the following statements ?
c) 0 b) 2
P a g e 7 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
c) 3 a) 1
d) ‐3 b) 2
#include d) Error
{ int i = 3;
x = y * NULL; a) 34
printf("%d",x); b) 43
} c) 44
a) error d) 33
c) 10 #include
a) 88 printf("%d",a>>a/b‐2);
b) 18 }
c) 29 a) 9
d) 19 b) 7
P a g e 8 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
17. int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; void main()
a) 11 int s=0;
b) 7 while(s++<10)>
c) 5 # define a 10
d) 9 main()
{ printf("%d..",a);
if(a,b,x,y) }
{ void foo()
printf("EXAM"); {
} #undef a
} #define a 50
d) Nothing is printed d) 0
#include
P a g e 9 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
20. main() {
{ char str[]="S\065AB";
{ }
int i; a) 7
}xyz; b) 6
(*xyz)‐>i=10; c) 5
printf("%d",xyz.i); d) error
} 23. What will be the value of `a` after the following code is executed
b) 10 a) 25
d) address of I c) 11
21.What will happen if in a C program you assign a value to an array element whose d) 10
22. What would be the output of the following program? static int y = 0;
P a g e 10 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
} 25. long factorial (long x)
int main() {
{ ????
func(); }
return 0; With what do you replace the ???? to make the function shown above return the
} correct answer?
a) if (x == 0) return 0;
1 ‐‐ 1 b)
1 ‐‐ 1 return 1;
b) c)
1 ‐‐ 1 if (x >= 2) return 2;
2 ‐‐ 1 d)
c) if (x <= 1) return 1;
1 ‐‐ 1 a) 6
1 ‐‐ 2 b) 7
c) 8
d) 9
P a g e 11 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
27. int i = 4; c) i = 9
switch (i) d) i = 10
{ 28. What will be output if you will compile and execute the following c code?
case 3: {
i += 5; if(printf("cquestionbank"))
{ else
if (i == 9) break; }
i *= 2; (a) I know c
i += 5; 29.What will be output if you will compile and execute the following c code?
} void main(){
a) i = 5 (a)c
b) i = 8 (b)c++
P a g e 12 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
(c)#c/c++ getch();
(d)c/c++ }
30. What will be output if you will compile and execute the following c code? (b) 025 0x25
{ 32. What will be output if you will compile and execute the following c code?
printf("%s",message); {
} if(i==0){
31. What will be output if you will compile and execute the following c code? }
clrscr(); (c) 1
P a g e 13 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
(e) None of above }
33.What will be output if you will compile and execute the following c code? (a) 3
printf("%d",x); (d) 7
getch(); 35.What will be output if you will compile and execute the following c code?
} void main(){
(a) 0 int x;
(b) 2 x=call(main);
(c) 23 clrscr();
34.What will be output if you will compile and execute the following c code? }
b=(2,4,6); }
clrscr(); (a) 0
P a g e 14 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
(d) Compiler error //show mouse pointer
36. What will be output if you will compile and execute the following c code? int86(0x33,&i,&o);
#include "string.h" while(!kbhit()) //its value will false when we hit key in the key board
void main(){ {
getch(); y=o.x.dx;
} clrscr();
(b) 7 7 delay(250);
(c) 6 7 int86(0x33,&i,&o);
(d) 7 6 }
37. Write c program which display mouse pointer and position of pointer.(In x }
coordinate, y coordinate)? 38.What will be output if you will compile and execute the following c code?
{ *p=200;
int x,y,k; }
P a g e 15 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
(a)0 40.What will be output if you will compile and execute the following c code?
(c)null if(printf("cquestionbank"))
39.What will be output if you will compile and execute the following c code? printf("I know c++");
struct marks{ }
struct marks s={2,‐6,5}; 41.What will be output if you will compile and execute the following c code?
} void main(){
(a) 2 ‐6 5 printf("%s",call(c/c++));
(b) 2 ‐6 1 }
(c) 2 2 1 (a)c
(d)c/c++
(e)Compiler error
P a g e 16 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
42. What will be output if you will compile and execute the following c code? (b) 025 0x25
clrscr(); 44. What will be output if you will compile and execute the following c code?
} if(i==0){
(c) union is }
Power of c else
43. What will be output if you will compile and execute the following c code? (a) 5
getch(); 45.What will be output if you will compile and execute the following c code?
} int extern x;
P a g e 17 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
printf("%d",x); (d) 7
getch(); 47.What will be output if you will compile and execute the following c code?
} void main(){
(a) 0 int x;
(b) 2 x=call(main);
(c) 23 clrscr();
46.What will be output if you will compile and execute the following c code? }
b=(2,4,6); }
clrscr(); (a) 0
(b) 21
(c) 17
P a g e 18 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
48.What will be output if you will compile and execute the following c code? (d) 200
void main(){ 50.What will be output if you will compile and execute the following c code?
} int m:2;
(a) 6 6 };
49.What will be output if you will compile and execute the following c code? (a) 2 ‐6 5
printf("%d",*q); 51.What will be output if you will compile and execute the following c code?
} void main(){
(a)0 if(printf("cquestionbank"))
(c)null else
P a g e 19 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
printf("I know c++"); printf("%s",message);
} getch();
(a) I know c }
52.What will be output if you will compile and execute the following c code? (d) Compiler error
void main(){ 54. What will be output if you will compile and execute the following c code?
} int a=25;
(a)c clrscr();
(c)#c/c++ getch();
(d)c/c++ }
53. What will be output if you will compile and execute the following c code? (b) 025 0x25
clrscr();
P a g e 20 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
55.What will be output if you will compile and execute the following c code? int x=23;
if(i==0){ (c) 23
} 57.What will be output if you will compile and execute the following c code?
} a=1,3,15;
(a) 5 b=(2,4,6);
(b) 3 clrscr();
56.What will be output if you will compile and execute the following c code? (a) 3
printf("%d",x); (d) 7
getch();
P a g e 21 | 22
Worksheet/programming/IUSTY/HND/NGAKAM
58.What will be output if you will compile and execute the following c code? printf("%d %d",sizeof("string"),strlen("string"));
static main; }
int x; (a) 6 6
x=call(main); (b) 7 7
clrscr(); (c) 6 7
} 60.What will be output if you will compile and execute the following c code?
} *p=200;
(a) 0 printf("%d",*q);
(b) 1 }
59.What will be output if you will compile and execute the following c code? (d) 200
void main(){
clrscr();
P a g e 22 | 22