C Language
MCQ questions and answers
- 4.5/5.0
- 1k Enrolled
- All levels
- Last updated 11/2023
- English
C Language MCQ (59)
1. |
C language was developed by __________. |
A | Ken Thomson |
B | James Gosling |
C | Dennis Ritchie |
D | Richard Stallman |
Answer: C |
|
2. |
ANSI stands for |
A | American National Standard Institute |
B | Advance National Standard Institute |
C | Advance National Standard information |
D | American National Standard information |
Answer: A |
|
3. |
Which is a compulsory function in the C programming language? |
A | main() |
B | init() |
C | scanf() |
D | printf() |
Answer: A |
|
4. |
Which symbol is known as a compiler directives? |
A | & (Ampersand) |
B | :: (scope resolution) |
C | () parenthesis |
D | # (pound sign) |
Answer: D |
|
5. |
In a C program the smallest individual unit is known as __________. |
A | keyword |
B | identifier |
C | token |
D | operator |
Answer: C |
|
6. |
__________ has a fixed meaning in the compiler and it can not be change during an execution of the program. |
A | Keyword |
B | printf() |
C | Library function |
D | Token |
Answer: A |
|
7. |
__________ is reserved word for the compiler. |
A | keyword |
B | variable |
C | constant |
D | none |
Answer: A |
|
8. |
Which has a fixed value which cannot change at runtime? |
A | keyword |
B | operator |
C | identifier |
D | constant |
Answer: D |
|
9. |
A string constant is a sequence of characters enclosed in a __________. |
A | single quotes |
B | double quotes |
C | exclamation mark |
D | carriage return |
Answer: B |
|
10. |
a is a used for |
A | linefeed |
B | backspace |
C | audio bell |
D | tab |
Answer: C |
|
11. |
Which of the following variable name is correct? |
A | char |
B | price# |
C | stud name |
D | int_no |
Answer: D |
|
12. |
What is the size of an unsigned char datatype? |
A | 8 bit |
B | 16 bit |
C | 4 bit |
D | 32 bit |
Answer: A |
|
13. |
What is the size of a signed short int datatype? |
A | 16 bit |
B | 32 bit |
C | 64 bit |
D | 8 bit |
Answer: D |
|
14. |
What is the size of long double datatype? |
A | 6 Byte |
B | 10 Byte |
C | 20 Byte |
D | 32 Byte |
Answer: B |
|
15. |
Which of the following operator has a higher priority? |
A | + (Plus) |
B | – (Hypen) |
C | () Parenthesis |
D | && (Logical AND) |
Answer: C |
|
16. |
Which of the following format is used to read the floating point value? |
A | %e |
B | %f |
C | %g |
D | all of the above |
Answer: D |
|
17. |
____ data format code is used to read an unsigned decimal integer? |
A | %u |
B | %g |
C | %[ ] |
D | %i |
Answer: A |
|
18. |
%i format specifier is used to read the __________. |
A | octal |
B | decimal |
C | hexadecimal |
D | all of the above |
Answer: D |
|
19. |
Which symbol is called an address operator? |
A | * (Asterik) |
B | & (Ampersent) |
C | :: (Scope resolution) |
D | ; (semi coolen ) |
Answer: B |
|
20. |
_____ header file contains the character handling library functions? |
A | ctype.h |
B | stdio.h |
C | string.h |
D | iomanip.h |
Answer: A |
|
21. |
Which statement is known as the decision-making statement? |
A | goto |
B | switch |
C | if |
D | all of the above |
Answer: D |
|
22. |
____ is used to end the cases in the switch-case. |
A | ;(semicolon) |
B | :(colon) |
C | .(period) |
D | , (comma) |
Answer: B |
|
23. |
____ is also known as an entry controlled loop? |
A | for loop |
B | while loop |
C | do-while loop |
D | A and B |
Answer: D |
|
24. |
_____ statement causes the execution of the loop to be continue with the next iteration? |
A | break |
B | continue |
C | next |
D | exit() |
Answer: B |
|
25. |
Which statement will terminate the loop? |
A | continue |
B | break |
C | case |
D | jump |
Answer: B |
|
26. |
Which header file includes the exit() function? |
A | stdio.h |
B | conio.h |
C | stdlib.h |
D | iomanip.h |
Answer: C |
|
27. |
Array is a group of __________ datatype. |
A | similar |
B | dissimilar |
C | random |
D | object |
Answer: A |
|
28. |
The array elements can be access by __________. |
A | index or subscript |
B | base address |
C | pointer |
D | none |
Answer: A |
|
29. |
What is the subscript value of a base address of an array? |
A | zero |
B | two |
C | one |
D | ten |
Answer: A |
|
30. |
Array is created at runtime known as__________. |
A | static array |
B | associative |
C | dynamic array |
D | none |
Answer: C |
|
31. |
Which function is used to copy the one string over an another string? |
A | strcat |
B | strcmp |
C | strcpy |
D | strcopy |
Answer: C |
|
32. |
Which header file is usec to access the the general utility functions? |
A | stdlib.h |
B | stdio.h |
C | iomanip.h |
D | none |
Answer: A |
|
33. |
Which header file contains the string handling function? |
A | stdio.h |
B | string.h |
C | ctype.h |
D | stdlib.h |
Answer: B |
|
34. |
Which function is called as an user define function? |
A | printf() |
B | scanf() |
C | getch() |
D | main() |
Answer: D |
|
35. |
An organization of a large program into the small independent segment of the program such phenomena is called __________. |
A | module |
B | function |
C | A and B are same |
D | none |
Answer: C |
|
36. |
Which variable is defined inside the function and it is not accessible to the outside? |
A | local variable |
B | global variable |
C | pointer variable |
D | none |
Answer: A |
|
37. |
____ is a variable defined outside any function block. |
A | external |
B | auto |
C | static |
D | register |
Answer: A |
|
38. |
____ variables preserve their previous value in their previous scope and are not initialized again in the new scope. |
A | static |
B | auto |
C | register |
D | extern |
Answer: A |
|
39. |
Which variable is leads to the faster execution of program? |
A | auto |
B | static |
C | extern |
D | register |
Answer: D |
|
40. |
C language support to the constructed datatype __________, a mechanism for packing data of different type. |
A | structure |
B | union |
C | class |
D | array |
Answer: B |
|
41. |
Which operator is also known as the selection operator? |
A | * (Asterik) |
B | & (Ampersent) |
C | ?: (Conditional operator) |
D | -> (Arrow operator) |
Answer: D |
|
42. |
__ is used to support the dynamic memory management. |
A | union |
B | structure |
C | pointer |
D | array |
Answer: C |
|
43. |
Indirection operator (*) is also called as __________. |
A | reference operator |
B | address operator |
C | dereferencing operator |
D | none |
Answer: C |
|
44. |
Which is the correct syntax of a declaration of an integer pointer variable? |
A | int &ptr; |
B | int *ptr; |
C | int (*ptr->p)++; |
D | int ptr++->p*; |
Answer: B |
|
45. |
Which is the correct statement to increment the p variable? |
A | (*ptr->p)++ |
B | *ptr->p++ |
C | ptr++->p* |
D | *ptr++->p |
Answer: B |
|
46. |
Which is correct statement to initialize the pointer variable? |
A | ptr=&var; |
B | *ptr=&var; |
C | ptr=*(&var); |
D | (*ptr)=&(var); |
Answer: A |
|
47. |
_____ is a named collection of related information that is recorded on secondary storage such as magnetic disks, magnetic tapes and optical disks. |
A | Track |
B | Sector |
C | File |
D | Memory cell |
Answer: C |
|
48. |
Which function is used to create the new file? |
A | fcreate() |
B | fopen() |
C | fwrite() |
D | ftell() |
Answer: B |
|
49. |
Which function is used to move a position of file pointer to the desired location in the file? |
A | ftell() |
B | rewind() |
C | fseek() |
D | move() |
Answer: C |
|
50. |
Which function is used to write a set of data values to the file? |
A | fget() |
B | fput() |
C | fprintf() |
D | fscanf() |
Answer: C |
|
51. |
Which function is used to set a position of the file pointer to beginning of the file? |
A | ftell() |
B | fseek() |
C | fset() |
D | rewind() |
Answer: D |
|
52. |
Which of the following function is the integer data-oriented functions? |
A | getc() |
B | getw() |
C | putw() |
D | B and C |
Answer: D |
|
53. |
_____ is a marker in the file which is used to stop the reading operation of the file. |
A | zero |
B | BOF |
C | EOF |
D | one |
Answer: C |
|
54. |
__________ is a same as EOF. |
A | 0 (zero) |
B | 1 (one) |
C | x |
D | -1 (minus One) |
Answer: D |
|
55. |
Which function is used to test an end of file? |
A | feof(void) |
B | EOF |
C | ferror |
D | feof(filepointer) |
Answer: D |
|
56. |
What value is returned by fseek() function after the successful execution? |
A | 0 (zero) |
B | null |
C | 1 (one) |
D | -1 (minus One) |
Answer: A |
|
57. |
___ function is used to allocate a block of memory dynamically. |
A | malloc() |
B | calloc() |
C | free() |
D | realloc() |
Answer: A |
|
58. |
_____ allocates the requested memory and returns a pointer to it. |
A | free() |
B | realloc() |
C | calloc() |
D | malloc() |
Answer: C |
|
59. |
Size of dynamically allocated memory can be changed by using ______. |
A | calloc() |
B | malloc() |
C | realloc() |
D | none |
Answer: C |