

MCQOPTIONS
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.
1. |
Which bitwise operator is suitable for turning on a particular bit in a number? |
A. | && operator |
B. | & operator |
C. | || operator |
D. | | operator |
Answer» E. | |
2. |
In which numbering system can the binary number 1011011111000101 be easily converted to? |
A. | Decimal system |
B. | Hexadecimal system |
C. | Octal system |
D. | No need to convert |
Answer» C. Octal system | |
3. |
Which bitwise operator is suitable for turning off a particular bit in a number? |
A. | && operator |
B. | & operator |
C. | || operator |
D. | ! operator |
Answer» C. || operator | |
4. |
Which bitwise operator is suitable for checking whether a particular bit is on or off? |
A. | && operator |
B. | & operator |
C. | || operator |
D. | ! operator |
Answer» C. || operator | |
5. |
What is the purpose of "rb" in fopen() function used below in the code?
|
A. | open "source.txt" in binary mode for reading |
B. | open "source.txt" in binary mode for reading and writing |
C. | Create a new file "source.txt" for reading and writing |
D. | None of above |
Answer» B. open "source.txt" in binary mode for reading and writing | |
6. |
Out of fgets() and gets() which function is safe to use? |
A. | gets() |
B. | fgets() |
Answer» C. | |
7. |
Consider the following program and what will be content of t?
|
A. | size of "DUMMY.C" file |
B. | The handle associated with "DUMMY.C" file |
C. | Garbage value |
D. | Error in fileno() |
Answer» C. Garbage value | |
8. |
Which of the following function is more appropriate for reading in a multi-word string? |
A. | printf(); |
B. | scanf(); |
C. | gets(); |
D. | puts(); |
Answer» D. puts(); | |
9. |
The operator used to get value at address stored in a pointer variable is |
A. | * |
B. | & |
C. | && |
D. | || |
Answer» B. & | |
10. |
What would be the equivalent pointer expression for referring the array element a[i][j][k][l] |
A. | ((((a+i)+j)+k)+l) |
B. | *(*(*(*(a+i)+j)+k)+l) |
C. | (((a+i)+j)+k+l) |
D. | ((a+i)+j+k+l) |
Answer» C. (((a+i)+j)+k+l) | |
11. |
Which of the following function is correct that finds the length of a string? |
A. | <pre><code class="cpp">int xstrlen(char *s) { int length=0; while(*s!=' 0') { length++; s++; } return (length); } </code></pre> |
B. | <pre><code class="cpp">int xstrlen(char s) { int length=0; while(*s!=' 0') length++; s++; return (length); } </code></pre> |
C. | <pre><code class="cpp">int xstrlen(char *s) { int length=0; while(*s!=' 0') length++; return (length); } </code></pre> |
D. | <pre><code class="cpp">int xstrlen(char *s) { int length=0; while(*s!=' 0') s++; return (length); } </code></pre> |
Answer» B. <pre><code class="cpp">int xstrlen(char s) { int length=0; while(*s!=' 0') length++; s++; return (length); } </code></pre> | |
12. |
If the two strings are identical, then strcmp() function returns |
A. | -1 |
B. | 1 |
C. | 0 |
D. | Yes |
Answer» D. Yes | |
13. |
What will be the output of the program?
|
A. | Error |
B. | H |
C. | Hello |
D. | Hel |
Answer» D. Hel | |
14. |
Which of the following operations can be performed on the file "NOTES.TXT" using the below code?
|
A. | Reading |
B. | Writing |
C. | Appending |
D. | Read and Write |
Answer» E. | |
15. |
To print out a and b given below, which of the following printf() statement will you use?
|
A. | printf("%f %lf", a, b); |
B. | printf("%Lf %f", a, b); |
C. | printf("%Lf %Lf", a, b); |
D. | printf("%f %Lf", a, b); |
Answer» B. printf("%Lf %f", a, b); | |
16. |
How will you print n on the screen? |
A. | printf(" n"); |
B. | echo " n"; |
C. | printf(' n'); |
D. | printf(" n"); |
Answer» E. | |
17. |
Which of the following function is used to find the first occurrence of a given string in another string? |
A. | strchr() |
B. | strrchr() |
C. | strstr() |
D. | strnset() |
Answer» D. strnset() | |
18. |
What is (void*)0? |
A. | Representation of NULL pointer |
B. | Representation of void pointer |
C. | Error |
D. | None of above |
Answer» B. Representation of void pointer | |
19. |
Can you combine the following two statements into one?
|
A. | char p = *malloc(100); |
B. | char *p = (char) malloc(100); |
C. | char *p = (char*)malloc(100); |
D. | char *p = (char *)(malloc*)(100); |
Answer» D. char *p = (char *)(malloc*)(100); | |
20. |
In which header file is the NULL macro defined? |
A. | stdio.h |
B. | stddef.h |
C. | stdio.h and stddef.h |
D. | math.h |
Answer» D. math.h | |
21. |
If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable? |
A. | . |
B. | & |
C. | * |
D. | -> |
Answer» E. | |
22. |
What will be the output of the program?
|
A. | 128 |
B. | Garbage value |
C. | Error |
D. | 0 |
Answer» B. Garbage value | |
23. |
Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1 ? |
A. | rem = 3.14 % 2.1; |
B. | rem = modf(3.14, 2.1); |
C. | rem = fmod(3.14, 2.1); |
D. | Remainder cannot be obtain in floating point division. |
Answer» D. Remainder cannot be obtain in floating point division. | |
24. |
What are the types of linkages? |
A. | Internal and External |
B. | External, Internal and None |
C. | External and None |
D. | Internal |
Answer» C. External and None | |
25. |
What will be the output of the program in TurboC?
|
A. | i= FFE2 ptr=12 j=FFE4 ptr=24 |
B. | i= FFE4 ptr=10 j=FFE2 ptr=20 |
C. | i= FFE0 ptr=20 j=FFE1 ptr=30 |
D. | Garbage value |
Answer» C. i= FFE0 ptr=20 j=FFE1 ptr=30 | |
26. |
Which of the following is the correct order if calling functions in the below code? |
A. | f1, f2, f3 |
B. | f3, f2, f1 |
C. | Order may vary from compiler to compiler |
D. | None of above |
Answer» D. None of above | |
27. |
Which of the following are unary operators in C?
|
||||||||
A. | 1, 2 | ||||||||
B. | 1, 3 | ||||||||
C. | 2, 4 | ||||||||
D. | 1, 2, 3 | ||||||||
Answer» E. | |||||||||
28. |
When we mention the prototype of a function? |
A. | Defining |
B. | Declaring |
C. | Prototyping |
D. | Calling |
Answer» C. Prototyping | |
29. |
By default a real number is treated as a |
A. | float |
B. | double |
C. | long double |
D. | far double |
Answer» C. long double | |
30. |
Which of the following is not user defined data type?
|
||||||
A. | 1 | ||||||
B. | 2 | ||||||
C. | 3 | ||||||
D. | Both 1 and 2 | ||||||
Answer» C. 3 | |||||||
31. |
Is the following statement a declaration or definition? |
A. | Declaration |
B. | Definition |
C. | Function |
D. | Error |
Answer» B. Definition | |
32. |
Identify which of the following are declarations
|
||||||
A. | 1 | ||||||
B. | 2 | ||||||
C. | 1 and 3 | ||||||
D. | 3 | ||||||
Answer» D. 3 | |||||||
33. |
Which of the following special symbol allowed in a variable name? |
A. | * (asterisk) |
B. | | (pipeline) |
C. | - (hyphen) |
D. | _ (underscore) |
Answer» E. | |
34. |
How would you round off a value from 1.66 to 2.0? |
A. | ceil(1.66) |
B. | floor(1.66) |
C. | roundup(1.66) |
D. | roundto(1.66) |
Answer» B. floor(1.66) | |
35. |
Which of the following statement obtains the remainder on dividing 5.5 by 1.3 ? |
A. | rem = (5.5 % 1.3) |
B. | rem = modf(5.5, 1.3) |
C. | rem = fmod(5.5, 1.3) |
D. | Error: we can't divide |
Answer» D. Error: we can't divide | |
36. |
What will you do to treat the constant 3.14 as a float? |
A. | use float(3.14f) |
B. | use 3.14f |
C. | use f(3.14) |
D. | use (f)(3.14) |
Answer» C. use f(3.14) | |
37. |
We want to round off x, a float, to an int value, The correct way to do is |
A. | y = (int)(x + 0.5) |
B. | y = int(x + 0.5) |
C. | y = (int)x + 0.5 |
D. | y = (int)((int)x + 0.5) |
Answer» B. y = int(x + 0.5) | |
38. |
The binary equivalent of 5.375 is |
A. | 101.101110111 |
B. | 101.011 |
C. | 101011 |
D. | None of above |
Answer» C. 101011 | |
39. |
Can you use the fprintf() to display the output on the screen? |
A. | Yes |
B. | No |
Answer» B. No | |
40. |
What will the function randomize() do in Turbo C under DOS? |
A. | returns a random number. |
B. | returns a random number generator in the specified range. |
C. | returns a random number generator with a random value based on time. |
D. | return a random number with a given seed value. |
Answer» D. return a random number with a given seed value. | |
41. |
What will the SWAP macro in the following program be expanded to on preprocessing? will the code compile?
|
A. | It compiles |
B. | Compiles with an warning |
C. | Not compile |
D. | Compiles and print nothing |
Answer» D. Compiles and print nothing | |
42. |
What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array? |
A. | The element will be set to 0. |
B. | The compiler would report an error. |
C. | The program may crash if some important data gets overwritten. |
D. | The array size would appropriately grow. |
Answer» D. The array size would appropriately grow. | |
43. |
What are the different types of real data type in C ? |
A. | float, double |
B. | short int, double, long int |
C. | float, double, long double |
D. | double, long int, float |
Answer» D. double, long int, float | |
44. |
What is the similarity between a structure, union and enumeration? |
A. | All of them let you define new values |
B. | All of them let you define new data types |
C. | All of them let you define new pointers |
D. | All of them let you define new structures |
Answer» C. All of them let you define new pointers | |
45. |
In which stage the following code |
A. | During editing |
B. | During linking |
C. | During execution |
D. | During preprocessing |
Answer» E. | |
46. |
In C, if you pass an array as an argument to a function, what actually gets passed? |
A. | Value of elements in array |
B. | First element of the array |
C. | Base address of the array |
D. | Address of the last element of array |
Answer» D. Address of the last element of array | |
47. |
What will be the output of the program?
|
A. | IndiaBIX 1 7 11 0 |
B. | 1 |
C. | 4 |
D. | 7 |
Answer» D. 7 | |
48. |
Which of the following is not logical operator? |
A. | & |
B. | && |
C. | || |
D. | ! |
Answer» B. && | |
49. |
In mathematics and computer programming, which is the correct order of mathematical operators ? |
A. | Addition, Subtraction, Multiplication, Division |
B. | Division, Multiplication, Addition, Subtraction |
C. | Multiplication, Addition, Division, Subtraction |
D. | Addition, Division, Modulus, Subtraction |
Answer» C. Multiplication, Addition, Division, Subtraction | |
50. |
What will the function rewind() do? |
A. | Reposition the file pointer to a character reverse. |
B. | Reposition the file pointer stream to end of file. |
C. | Reposition the file pointer to begining of that line. |
D. | Reposition the file pointer to begining of file. |
Answer» E. | |