Explore topic-wise MCQs in C Programming.

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

51.

In a file contains the line ''I am a boyrn'' then on reading this line into the array str using fgets(). What will str contain?

A. 'I am a boy\r\n\0''
B. 'I am a boy\r\0''
C. 'I am a boy\n\0''
D. 'I am a boy''
Answer» D. 'I am a boy''
52.

Which of the following operations can be performed on the file ''NOTES.TXT'' using the below code?FILE *fp;fp = fopen(''NOTES.TXT'', ''r+'');

A. Reading
B. Writing
C. Appending
D. Read and Write
Answer» E.
53.

What is the purpose of ''rb'' in fopen() function used below in the code?FILE *fp;fp = fopen(''source.txt'', ''rb'');

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
54.

Consider this statement: typedef enum good {a, b, c} hello; Which of the following statements is incorrect about hello?

A. hello is a typedef of enum good
B. hello is a structure
C. hello is a variable of type enum good
D. the statement shown above is erroneous
Answer» B. hello is a structure
55.

Presence of loop in a linked list can be tested by ________

A. Traveling the list, if NULL is encountered no loop exists
B. Comparing the address of nodes by address of every other node
C. Comparing the the value stored in a node by a value in every other node
D. None of the mentioned
Answer» C. Comparing the the value stored in a node by a value in every other node
56.

Bit fields can only be declared as part of a structure.

A. false
B. true
C. Nothing
D. Varies
Answer» C. Nothing
57.

One of the major difference between typedef and #define is that typedef interpretation is performed by the _________________ whereas #define interpretation is performed by the _____________

A. pre-processor, compiler
B. user, pre-processor
C. compiler, pre-processor
D. compiler, user
Answer» D. compiler, user
58.

Which of the following may create problem in the typedef program?

A. ;
B. printf/scanf
C. Arithmetic operators
D. All of the mentioned
Answer» E.
59.

Which of the following is not allowed?

A. Arrays of bit fields
B. Pointers to bit fields
C. Functions returning bit fields
D. None of the mentioned
Answer» E.
60.

Which function is responsible for recording the name 's' and the replacement text 't' in a table?

A. install(s, t);
B. fix(s, t);
C. setup(s, t);
D. settle(s, t);
Answer» B. fix(s, t);
61.

Pick the incorrect statement with respect to enums.

A. Two enum symbols cannot have the same value
B. Only integer constants are allowed in enums
C. It is not possible to change the value of enum symbols
D. Enum variables are automatically assigned values if no value is specified
Answer» B. Only integer constants are allowed in enums
62.

Arithmetic operations such as addition, subtraction, multiplication and division are allowed on enumerated constants.

A. True
B. False
Answer» B. False
63.

Which function is responsible for searching in the table? (For #define IN 1, the name IN and replacement text 1 are stored in a 'table')

A. findout(s);
B. lookup(s);
C. find(s);
D. lookfor(s);
Answer» C. find(s);
64.

A user defined data type, which is used to assign names to integral constants is called:

A. Union
B. Array
C. Structure
D. Enum
Answer» E.
65.

The keyword typedef cannot be used to give alias names to pointers.

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

typedef int (*PFI)(char *, char *)creates ___________

A. type PFI, for pointer to function (of two char * arguments) returning int
B. error
C. type PFI, function (of two char * arguments) returning int
D. type PFI, for pointer
Answer» B. error