MCQ Mojo
access_time
menu
Quiz
Web Stories
CBSE
arrow_drop_down
MCQ Questions for CBSE Class 12 with Answers
MCQ Questions for CBSE Class 11 with Answers
MCQ Questions for CBSE Class 10 with Answers
MCQ Questions for CBSE Class 9 with Answers
MCQ Questions for CBSE Class 8 with Answers
MCQ Questions for CBSE Class 7 with Answers
MCQ Questions for CBSE Class 6 with Answers
MCQ Questions for CBSE Class 5 with Answers
MCQ Questions for CBSE Class 4 with Answers
MCQ Questions for CBSE Class 3 with Answers
MCQ Questions for CBSE Class 2 with Answers
MCQ Questions for CBSE Class 1 with Answers
CBSE
arrow_drop_down
MCQ Questions for CBSE Class 12 with Answers
MCQ Questions for CBSE Class 11 with Answers
MCQ Questions for CBSE Class 10 with Answers
MCQ Questions for CBSE Class 9 with Answers
MCQ Questions for CBSE Class 8 with Answers
MCQ Questions for CBSE Class 7 with Answers
MCQ Questions for CBSE Class 6 with Answers
MCQ Questions for CBSE Class 5 with Answers
MCQ Questions for CBSE Class 4 with Answers
MCQ Questions for CBSE Class 3 with Answers
MCQ Questions for CBSE Class 2 with Answers
MCQ Questions for CBSE Class 1 with Answers
Quiz
Quiz
/
C Programming MCQ Questions and Answers
1.
C programs are converted into machine language with the help of
An Editor
A compiler
An operating system
None of the above
2.
What will be the output of the following arithmetic expression ? 5+3*2%10-8*6
-37
-42
-32
-28
3.
What will be the output of the following statement ? int a=10; printf(“%d &i”,a,10);
error
10
10 10
none of these
4.
What will be the output of the following statement ? printf(“%X%x%ci%x”,11,10,’s’,12);
error
basc
Bas94c
none of these
5.
What will be the output of the following statements ? int a = 4, b = 7,c; c = a = = b; printf(“%i”,C.;
0
error
1
garbage value
6.
What will be the output of the following statements ? int a = 5, b = 2, c = 10, i = a>b void main() { printf(“hello”); main(); }
1
2
infinite number of times
none of these
7.
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(){ struct marks s={2,-6,5}; printf(“%d %d %d”,s.p,s.c,s.m); }
2 -6 5
2 -6 1
2 2 1
Compiler error
None of these
8.
What will be the output of the following statements ? int x[4] = {1,2,3}; printf(“%d %d %D”,x[3],x[2],x[1]);
03%D
000
032
321
9.
What will be the output of the following statement ? printf( 3 + “goodbye”);
goodbye
odbye
bye
dbye
10.
What will be the output of the following statements ? long int a = scanf(“%ld%ld”,&a,&A.; printf(“%ld”,A.;
error
garbage value
0
2
11.
What will be the output of the following program ? #include void main() { int a = 2; switchA. { case 1: printf(“goodbye”); break; case 2: continue; case 3: printf(“bye”); } }
error
goodbye
bye
byegoodbye
12.
What will be the output of the following statements ? int i = 1,j; j=i— -2; printf(“%d”,j);
error
2
3
-3
13.
What will be the output of following program ? #include main() { int x,y = 10; x = y * NULL; printf(“%d”,x); }
error
0
10
garbage value
14.
What will be the output of following statements ? char x[ ] = “hello hi”; printf(“%d%d”,sizeof(*x),sizeof(x));
88
18
29
19
15.
What will be the output of the following statements ? int a=5,b=6,c=9,d; d=(ac?1:2):(c>b?6:8)); printf(“%d”,D.;
1
2
6
Error
16.
What will be the output of the following statements ? int i = 3; printf(“%d%d”,i,i++);
34
43
44
33
17.
What will be the output of the following program ? #include void main() { int a = 36, b = 9; printf(“%d”,a>>a/b-2); }
9
7
5
none of these
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?
11
7
5
9
19.
void main() { int a=10,b=20; char x=1,y=0; if(a,b,x,y) { printf(“EXAM”); } } What is the output?
XAM is printed
exam is printed
Compiler Error
Nothing is printed
20.
What is the output of the following code? #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 }
10..10
10..50
Error
0
21.
main() { struct { int i; }xyz; (*xyz)->i=10; printf(“%d”,xyz.i); } What is the output of this program?
program will not compile
10
god only knows
address of I
22.
What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?
The element will be set to 0.
The compiler would report an error.
The program may crash if some important data gets overwritten.
The array size would appropriately grow.
23.
What would be the output of the following program? include ain() har str[]=”S\065AB”; rintf(“n%d”, sizeof(str));
7
6
5
error
24.
What will be the value of `a` after the following code is executed define square(x) x*x = square(2+3)
25
13
11
10
25.
long factorial (long x) ??? eturn x * factorial(x – 1); ith what do you replace the ???? to make the function shown above return the correct answer?
if (x == 0) return 0;
return 1;
if (x >= 2) return 2;
if (x <= 1) return 1;
26.
int y[4] = {6, 7, 8, 9}; nt *ptr = y + 2; printf(“%dn”, ptr[ 1 ] ); hat is printed when the sample code above is executed?
6
7
8
9
27.
e 8: += 5; reak; rintf(“i = %dn”, i); hat will the output of the sample code above be?
i = 5
i = 8
i = 9
i = 10
28.
What will be output if you will compile and execute the following c code? oid main() f(printf(“cquestionbank”)) rintf(“I know c”); lse rintf(“I know c++”);
I know c
I know c++
cquestionbankI know c
cquestionbankI know c++
Compiler error
29.
What will be output if you will compile and execute the following c code? define call(x) #x oid main(){ rintf(“%s”,call(c/c++));
++
c/c++
/c++
Compiler error
30.
What will be output if you will compile and execute the following c code? define message “union is ower of c” oid main() lrscr(); rintf(“%s”,message); etch();
union is power of c
union is power of c
union is Power of c
Compiler error
None of these
31.
What will be output if you will compile and execute the following c code? oid main(){ nt a=25; lrscr(); rintf(“%o %x”,a,A.; etch();
25 25
025 0x25
12 42
31 19
None of these
32.
What will be output if you will compile and execute the following c code? oid main() nt i=0; f(i==0){ =((5,(i=3)),i=1); rintf(“%d”,i); lse rintf(“equal”);
5
3
1
equal
None of above
33.
What will be output if you will compile and execute the following c code? nt extern x; oid main() rintf(“%d”,x); =2; etch(); nt x=23;
0
2
23
Compiler error
None of these
34.
What will be output if you will compile and execute the following c code? oid main(){ nt a,b; =1,3,15; =(2,4,6); lrscr(); rintf(“%d “,a+B.; etch();
3
21
17
7
Compiler error
35.
What will be output if you will compile and execute the following c code? oid main(){ tatic main; nt x; =call(main); lrscr(); rintf(“%d “,x); etch(); nt call(int address){ ddress++; eturn address;
0
1
Garbage value
Compiler error
None of these
36.
What will be output if you will compile and execute the following c code? define message “union is ower of c” oid main(){ lrscr(); rintf(“%s”,message); etch(); Power of c
union is power of c
union ispower of c
union is
Compiler error
None of these
37.
What will be output if you will compile and execute the following c code? oid main(){ nt i=0; f(i==0){ =((5,(i=3)),i=1); rintf(“%d”,i); lse rintf(“equal”);
5
3
1
equal
None of above
38.
What will be output if you will compile and execute the following c code? include “string.h” oid main(){ lrscr(); rintf(“%d %d”,sizeof(“string”),strlen(“string”)); etch();
6 6
7 7
6 7
7 6
None of these
39.
What will be output if you will compile and execute the following c code? oid main(){ nt huge*p=(int huge*)0XC0563331; nt huge*q=(int huge*)0xC2551341; p=200; rintf(“%d”,*q);
arbage value
ull
200
Compiler error
40.
What will be output if you will compile and execute the following c code? truct marks{ nt p:3; nt c:3; nt m:2; ; oid main(){ truct marks s={2,-6,5}; rintf(“%d %d %d”,s.p,s.c,s.m);
2 -6 5
2 -6 1
2 2 1
Compiler error
None of these
41.
What will be output if you will compile and execute the following c code? oid main(){ f(printf(“cquestionbank”)) rintf(“I know c”); lse rintf(“I know c++”);
I know c
I know c++
cquestionbankI know c
cquestionbankI know c++
Compiler error
42.
What will be output if you will compile and execute the following c code? oid main(){ nt i=0; f(i==0){ =((5,(i=3)),i=1); rintf(“%d”,i); lse rintf(“equal”); . 5
3
1
equal
None of above
43.
Who is father of C Language?
Bjarne Stroustrup
Dennis Ritchie
James A. Gosling
Dr. E.F. Codd
44.
C Language developed at _____?
AT & T’s Bell Laboratories of USA in 1972
AT & T’s Bell Laboratories of USA in 1970
Sun Microsystems in 1973
Cambridge University in 1972
45.
For 16-bit compiler allowable range for integer constants is ______ ?
-3.4e38 to 3.4e38
-32767 to 32768
-32768 to 32767
-32668 to 32667
46.
A C variable cannot start with
An alphabet
A number
A special symbol other than underscore
both B. and C.
47.
Which of the following is allowed in a C Arithmetic instruction
[]
{}
()
None of the above
48.
Which of the following shows the correct hierarchy of arithmetic operations in C
/ + * –
* – / +
+ – / *
* / + –
49.
What is an array?
An array is a collection of variables that are of the dissimilar data type.
An array is a collection of variables that are of the same data type.
An array is not a collection of variables that are of the same data type.
None of the above.
50.
What is right way to Initialization array?
int num[6] = { 2, 4, 12, 5, 45, 5 } ;
int n{} = { 2, 4, 12, 5, 45, 5 } ;
int n{6} = { 2, 4, 12 } ;
int n(6) = { 2, 4, 12, 5, 45, 5 } ;
51.
An array elements are always stored in _________ memory locations.
Sequential
Random
Sequential and Random
None of the above
52.
What is the right way to access value of structure variable book{ price, page }?
printf(“%d%d”, book.price, book.page);
printf(“%d%d”, price.book, page.book);
printf(“%d%d”, price::book, page::book);
printf(“%d%d”, price->book, page->book);
53.
perror( ) function used to ?
Work same as printf()
prints the error message specified by the compiler
prints the garbage value assigned by the compiler
None of the above
54.
Bitwise operators can operate upon?
double and chars
floats and doubles
ints and floats
ints and chars
55.
What is C Tokens?
The smallest individual units of c program
The basic element recognized by the compiler
The largest individual units of program
A & B Both
56.
What is Keywords?
Keywords have some predefine meanings and these meanings can be changed.
Keywords have some unknown meanings and these meanings cannot be changed.
Keywords have some predefine meanings and these meanings cannot be changed.
None of the above
57.
What is constant?
Constants have fixed values that do not change during the execution of a program
Constants have fixed values that change during the execution of a program
Constants have unknown values that may be change during the execution of a program
None of the above
58.
Which is the right way to declare constant in C?
int constant var =10;
int const var = 10;
const int var = 10;
B & C Both
59.
Which operators are known as Ternary Operator?
::, ?
?, :
?, ;;
None of the avobe
60.
In switch statement, each case instance value must be _______?
Constant
Variable
Special Symbol
None of the avobe
61.
What is the work of break keyword?
Halt execution of program
Restart execution of program
Exit from loop or switch statement
None of the avobe
62.
What is function?
Function is a block of statements that perform some specific task.
Function is the fundamental modular unit. A function is usually designed to perform a specific task.
Function is a block of code that performs a specific task. It has a name and it is reusable
All the above
63.
Which one of the following sentences is true ?
The body of a while loop is executed at least once.
The body of a do … while loop is executed at least once.
The body of a do … while loop is executed zero or more times.
A for loop can never be used in place of a while loop.
64.
A binary tree with 27 nodes has _______ null branches.
54
27
26
None of the above
65.
Which one of the following is not a linear data structure?
Array
Binary Tree
Queue
Stack
66.
Recursive functions are executed in a?
First In First Out Order
Load Balancing
Parallel Fashion
Last In First Out Order
67.
Queue is a _____________ list.
LIFO
LILO
FILO
FIFO
68.
The statement print f (“%d”, 10 ? 0 ? 5 : 1 : 12); will print?
10
0
12
1
69.
To represent hierarchical relationship between elements, which data structure is suitable?
Priority
Tree
Dqueue
All of the above
70.
Which of the following data structure is linear type?
Strings
Queue
Lists
All of the above
71.
The statement printf(“%c”, 100); will print?
prints 100
print garbage
prints ASCII equivalent of 100
None of the above
72.
The _______ memory allocation function modifies the previous allocated space.
calloc
free
malloc
realloc
73.
Number of binary trees formed with 5 nodes are
30
36
108
42
74.
The “C” language is
Context free language
Context sensitive language
Regular language
None of the above
75.
The worst case time complexity of AVL tree is better in comparison to binary search tree for
Search and Insert Operations
Search and Delete Operations
Insert and Delete Operations
Search, Insert and Delete Operations
76.
In which tree, for every node the height of its left subtree and right subtree differ almost by one?
Binary search tree
AVL tree
Threaded Binary Tree
Complete Binary Tree
77.
The Default Parameter Passing Mechanism is called as
Call by Value
Call by Reference
Call by Address
Call by Name
78.
What is Dequeue?
Elements can be added from front
Elements can be added to or removed from either the front or rear
Elements can be added from rear
None of the above
79.
In which linked list last node address is null?
Doubly linked list
Circular list
Singly linked list
None of the above
80.
. Which is the correct syntax to declare constant pointer?
int *const constPtr;
*int constant constPtr;
const int *constPtr;
A and C both
Report Question
Previous
Next
warning
Submit
access_time
Time
Report Question
A bunch of text
Support mcqmojo.com by disabling your adblocker.
×
Please disable the adBlock and continue.
Thank you.
Reload page