Explore topic-wise MCQs in Engineering.

This section includes 564 Mcqs, each offering curated multiple-choice questions to sharpen your Engineering knowledge and support exam preparation. Choose a topic below to get started.

301.

Which of the following statements are correct about the below program?

#include<stdio.h>
int main()
{ int i = 10, j = 15; if(i % 2 = j % 3) printf("IndiaBIX n"); return 0;
}

A. Error: Expression syntax
B. Error: Lvalue required
C. Error: Rvalue required
D. The Code runs successfully
Answer» C. Error: Rvalue required
302.

Is standard library a part of C language?

A. Yes
B. No
Answer» C.
303.

The itoa function can convert an integer in decimal, octal or hexadecimal form to a string.

A. Yes
B. No
Answer» B. No
304.

The prototypes of all standard library string functions are declared in the file string.h.

A. Yes
B. No
Answer» B. No
305.

scanf() or atoi() function can be used to convert a string like "436" in to integer.

A. Yes
B. No
Answer» B. No
306.

It is necessary that for the string functions to work safely the strings must be terminated with ' 0'.

A. True
B. False
Answer» B. False
307.

FILE is a structure suitably typedef'd in "stdio.h".

A. True
B. False
Answer» B. False
308.

ftell() returns the current position of the pointer in a file stream.

A. True
B. False
Answer» B. False
309.

Data written into a file using fwrite() can be read back using fscanf()

A. True
B. False
Answer» C.
310.

If the two strings are found to be unequal then strcmp returns difference between the first non-matching pair of characters.

A. True
B. False
Answer» B. False
311.

What will be the output of the program?

#include<stdio.h> #include<math.h> int main() { float i = 2.5; printf("%f, %d", floor(i), ceil(i)); return 0; } 

A. 2, 3
B. 2.000000, 3
C. 2.000000, 0
D. 2, 0
Answer» D. 2, 0
312.

What will be the output of the program?

#include<stdio.h> #include<string.h> int main() { char dest[] = {97, 97, 0}; char src[] = "aaa"; int i; if((i = memcmp(dest, src, 2))==0) printf("Got it"); else printf("Missed"); return 0; } 

A. Missed
B. Got it
C. Error in memcmp statement
D. None of above
Answer» C. Error in memcmp statement
313.

What will function gcvt() do?

A. Convert vector to integer value
B. Convert floating-point number to a string
C. Convert 2D array in to 1D array.
D. Covert multi Dimensional array to 1D array
Answer» C. Convert 2D array in to 1D array.
314.

What will be the output of the program?

#include<stdio.h> int main()
{ char c=48; int i, mask=01; for(i=1; i<=5; i++) { printf("%c", c|mask); mask = mask<<1; } return 0;
}

A. 12400
B. 12480
C. 12500
D. 12556
Answer» C. 12500
315.

What will be the output of the program ?

#include<stdio.h> int main() { int i=32, j=0x20, k, l, m; k=i|j; l=i&j; m=k^l; printf("%d, %d, %d, %d, %d n", i, j, k, l, m); return 0; } 

A. 0, 0, 0, 0, 0
B. 0, 32, 32, 32, 32
C. 32, 32, 32, 32, 0
D. 32, 32, 32, 32, 32
Answer» D. 32, 32, 32, 32, 32
316.

What will be the output of the program?

#include<stdio.h>
int main()
{ char ch; if(ch = printf("")) printf("It matters n"); else printf("It doesn't matters n"); return 0;
}

A. It matters
B. It doesn't matters
C. matters
D. No output
Answer» C. matters
317.

What will be the output of the program ?

#include<stdio.h> int main() { int i=4, j=8; printf("%d, %d, %d n", i|j&j|i, i|j&&j|i, i^j); return 0; } 

A. 4, 8, 0
B. 1, 2, 1
C. 12, 1, 12
D. 0, 0, 0
Answer» D. 0, 0, 0
318.

What will be the output of the program?

#include<stdio.h> int main()
{ printf("%d >> %d %d >> %d n", 4 >> 1, 8 >> 1); return 0;
}

A. 4 1 8 1
B. 4 >> 1 8 >> 1
C. 2 >> 4 Garbage value >> Garbage value
D. 2 4
Answer» D. 2 4
319.

What will be the output of the program?

#include<stdio.h> int main() { int a=0, b=1, c=3; *((a) ? &b : &a) = a ? b : c; printf("%d, %d, %d n", a, b, c); return 0; } 

A. 0, 1, 3
B. 1, 2, 3
C. 3, 1, 3
D. 1, 3, 1
Answer» D. 1, 3, 1
320.

What will be the output of the program?

#include<stdio.h>
int main()
{ int k, num = 30; k = (num < 10) ? 100 : 200; printf("%d n", num); return 0;
}

A. 200
B. 30
C. 100
D. 500
Answer» C. 100
321.

What will be the output of the program?

#include<stdio.h> int main() { int a = 300, b, c; if(a >= 400) b = 300; c = 200; printf("%d, %d, %d n", a, b, c); return 0; } 

A. 300, 300, 200
B. Garbage, 300, 200
C. 300, Garbage, 200
D. 300, 300, Garbage
Answer» D. 300, 300, Garbage
322.

What will be the output of the program?

#include<stdio.h>
int main()
{ int x = 10, y = 20; if(!(!x) && x) printf("x = %d n", x); else printf("y = %d n", y); return 0;
}

A. y =20
B. x = 0
C. x = 10
D. x = 1
Answer» D. x = 1
323.

What will be the output of the program?

#include<stdio.h>
int main()
{ unsigned int i = 65536; /* Assume 2 byte integer*/ while(i != 0) printf("%d",++i); printf(" n"); return 0;
}

A. Infinite loop
B. 0 1 2 ... 65535
C. 0 1 2 ... 32767 - 32766 -32765 -1 0
D. No output
Answer» E.
324.

Bitwise can be used to perform addition and subtraction.

A. Yes
B. No
Answer» C.
325.

Bitwise | can be used to set a bit in number.

A. Yes
B. No
Answer» B. No
326.

What will be the output of the program?

#include<stdio.h> int main() { char j=1; while(j < 5) { printf("%d, ", j); j = j+1; } printf(" n"); return 0; } 

A. 1 2 3 ... 127
B. 1 2 3 ... 255
C. 1 2 3 ... 127 128 0 1 2 3 ... infinite times
D. 1, 2, 3, 4
Answer» E.
327.

What will be the output of the program?

#include<stdio.h> int main() { int i=3; switch(i) { case 1: printf("Hello n"); case 2: printf("Hi n"); case 3: continue; default: printf("Bye n"); } return 0; } 

A. Error: Misplaced continue
B. Bye
C. No output
D. Hello Hi
Answer» B. Bye
328.

What will be the output of the program?

#include<stdio.h>
int main()
{ int x, y, z; x=y=z=1; z = ++x || ++y && ++z; printf("x=%d, y=%d, z=%d n", x, y, z); return 0;
}

A. x=2, y=1, z=1
B. x=2, y=2, z=1
C. x=2, y=2, z=2
D. x=1, y=2, z=1
Answer» B. x=2, y=2, z=1
329.

What will be the output of the program?

#include<stdio.h> #include<stdlib.h> int main() { char *i = "55.555"; int result1 = 10; float result2 = 11.111; result1 = result1+atoi(i); result2 = result2+atof(i); printf("%d, %f", result1, result2); return 0; } 

A. 55, 55.555
B. 66, 66.666600
C. 65, 66.666000
D. 55, 55
Answer» D. 55, 55
330.

Left shifting a number by 1 is always equivalent to multiplying it by 2.

A. True
B. False
Answer» B. False
331.

In the statement expression1 >> expression2. if expression1 is a signed integer with its leftmost bit set to 1 then on right shifting it the result of the statement will vary from computer to computer

A. True
B. False
Answer» B. False
332.

Bitwise & and | are unary operators

A. True
B. False
Answer» C.
333.

Bitwise & can be used to check if more than one bit in a number is on.

A. True
B. False
Answer» B. False
334.

Assunming, integer is 2 byte, What will be the output of the program?

#include<stdio.h> int main()
{ printf("%x n", -1>>1); return 0;
}

A. ffff
B. 0fff
C. 0000
D. fff0
Answer» B. 0fff
335.

If an unsigned int is 2 bytes wide then, What will be the output of the program ?

#include<stdio.h> int main() { unsigned int m = 32; printf("%x n", ~m); return 0; } 

A. ffff
B. 0000
C. ffdf
D. ddfd
Answer» D. ddfd
336.

Assuming a integer 2-bytes, What will be the output of the program?

#include<stdio.h> int main()
{ printf("%x n", -1<<3); return 0;
}

A. ffff
B. fff8
C. 0
D. -1
Answer» C. 0
337.

If an unsigned int is 2 bytes wide then, What will be the output of the program ?

#include<stdio.h> int main()
{ unsigned int a=0xffff; ~a; printf("%x n", a); return 0;
}

A. ffff
B. 0000
C. 00ff
D. ddfd
Answer» B. 0000
338.

What will be the output of the program?

#include<stdio.h> int main()
{ unsigned char i = 0x80; printf("%d n", i<<1); return 0;
}

A. 0
B. 256
C. 100
D. 80
Answer» C. 100
339.

Bitwise can be used to generate a random number.

A. Yes
B. No
Answer» C.
340.

Bitwise | can be used to set multiple bits in number.

A. Yes
B. No
Answer» B. No
341.

Bitwise can be used to reverse a sign of a number.

A. Yes
B. No
Answer» C.
342.

Bitwise & can be used in conjunction with ~ operator to turn off 1 or more bits in a number.

A. Yes
B. No
Answer» B. No
343.

On left shifting, the bits from the left are rotated and brought to the right and accommodated where there is empty space on the right?

A. True
B. False
Answer» C.
344.

Left shifting an unsigned int or char by 1 is always equivalent to multiplying it by 2.

A. True
B. False
Answer» B. False
345.

What will be the output of the program?

#include<stdio.h>
int main()
{ char str[]="C-program"; int a = 5; printf(a >10?"Ps n":"%s n", str); return 0;
}

A. C-program
B. Ps
C. Error
D. None of above
Answer» B. Ps
346.

Bitwise & can be used to divide a number by powers of 2

A. True
B. False
Answer» C.
347.

What will be the output of the program?

#include<stdio.h>
int main()
{ int i=0; for(; i<=5; i++); printf("%d", i); return 0;
}

A. 0, 1, 2, 3, 4, 5
B. 5
C. 1, 2, 3, 4
D. 6
Answer» E.
348.

What will be the output of the program ?

#include<stdio.h>
#include<string.h> int main()
{ static char str1[] = "dills"; static char str2[20]; static char str3[] = "Daffo"; int i; i = strcmp(strcat(str3, strcpy(str2, str1)), "Daffodills"); printf("%d n", i); return 0;
}

A. 0
B. 1
C. 2
D. 4
Answer» B. 1
349.

What will be the output of the program?

#include<stdio.h>
int main()
{ int a = 500, b = 100, c; if(!a >= 400) b = 300; c = 200; printf("b = %d c = %d n", b, c); return 0;
}

A. b = 300 c = 200
B. b = 100 c = garbage
C. b = 300 c = garbage
D. b = 100 c = 200
Answer» E.
350.

What will be the output of the program?

#include<stdio.h>
int main()
{ unsigned int i = 65535; /* Assume 2 byte integer*/ while(i++ != 0) printf("%d",++i); printf(" n"); return 0;
}

A. Infinite loop
B. 0 1 2 ... 65535
C. 0 1 2 ... 32767 - 32766 -32765 -1 0
D. No output
Answer» B. 0 1 2 ... 65535