

MCQOPTIONS
Saved Bookmarks
This section includes 204 Mcqs, each offering curated multiple-choice questions to sharpen your C Programming knowledge and support exam preparation. Choose a topic below to get started.
101. |
A function in PHP which starts with __ (double underscore) is known as __________ |
A. | Magic Function |
B. | Inbuilt Function |
C. | Default Function |
D. | User Defined Function |
E. | is known as __________a) Magic Functionb) Inbuilt Functionc) Default Functiond) User Defined Function |
Answer» B. Inbuilt Function | |
102. |
Which of the following are valid function names? |
A. | Only i) |
B. | Only ii) |
C. | i) and ii) |
D. | iii) and iv)View Answer |
Answer» C. i) and ii) | |
103. |
Which type of function call is used in line 8 in the following PHP code? |
A. | Call By Value |
B. | Call By Reference |
C. | Default Argument Value |
D. | Type HintingView Answer |
Answer» B. Call By Reference | |
104. |
How to define a function in PHP? |
A. | function {function body} |
B. | data type functionName(parameters) {function body} |
C. | functionName(parameters) {function body} |
D. | function functionName(parameters) {function body} |
Answer» E. | |
105. |
If a function declared as abstract in base class doesn’t have to be defined in derived class then ______ |
A. | Derived class must define the function anyhow |
B. | Derived class should be made abstract class |
C. | Derived class should not derive from that base class |
D. | Derived class should not use that function |
Answer» C. Derived class should not derive from that base class | |
106. |
Which among function will be overridden from the function defined in derived class below: |
A. | show() |
B. | print() |
C. | show() and print() |
D. | Compile time error |
Answer» B. print() | |
107. |
How much memory will be allocated for an object of class given below? |
A. | 22 Bytes |
B. | 24 Bytes |
C. | 20 Bytes |
D. | 18 Bytes |
Answer» B. 24 Bytes | |
108. |
Which among the following is true? |
A. | Abstract methods can be static |
B. | Abstract methods can be defined in derived class |
C. | Abstract methods must not be static |
D. | Abstract methods can be made static in derived class |
Answer» D. Abstract methods can be made static in derived class | |
109. |
Which operator among the following can be overloaded using both friend function and member function? |
A. | Assignment operator |
B. | Subscript |
C. | Member selection (arrow operator) |
D. | Modulus operator |
Answer» E. | |
110. |
Which among the following is true? |
A. | The private members can’t be accessed by public members of the class |
B. | The private members can be accessed by public members of the class |
C. | The private members can be accessed only by the private members of the class |
D. | The private members can’t be accessed by the protected members of the class |
Answer» C. The private members can be accessed only by the private members of the class | |
111. |
Which among the following is true ? |
A. | The abstract functions must be only declared in derived classes |
B. | The abstract functions must not be defined in derived classes |
C. | The abstract functions must be defined in base and derived class |
D. | The abstract functions must be defined either in base or derived class |
Answer» B. The abstract functions must not be defined in derived classes | |
112. |
What is the sequence for preprocessor to look for the file within <>? |
A. | The predefined location then the current directory |
B. | The current directory then the predefined location |
C. | The predefined location only |
D. | The current directory location |
Answer» B. The current directory then the predefined location | |
113. |
Can we use a function as a parameter of another function? [ Eg: void wow(int func()) ]. |
A. | Yes, and we can use the function value conveniently |
B. | Yes, but we call the function again to get the value, not as convenient as in using variable |
C. | No, C does not support it |
D. | This case is compiler dependent |
Answer» D. This case is compiler dependent | |
114. |
Which of the following is a storage specifier? |
A. | enum |
B. | union |
C. | auto |
D. | volatile |
Answer» D. volatile | |
115. |
Functions can return structure in C? |
A. | True |
B. | False |
C. | Depends on the compiler |
D. | Depends on the standard |
Answer» B. False | |
116. |
How is search done in #include and #include 'somelibrary.h' according to C standard? |
A. | When former is used, current directory is searched and when latter is used, standard directory is searched |
B. | When former is used, standard directory is searched and when latter is used, current directory is searched |
C. | When former is used, search is done in implementation defined manner and when latter is used, current directory is searched |
D. | For both, search for 'somelibrary' is done in implementation-defined places |
Answer» E. | |
117. |
What is #include
|
A. | Preprocessor directive |
B. | Inclusion directive |
C. | File inclusion directive |
D. | None of the mentioned |
Answer» B. Inclusion directive | |
118. |
The 'else if' in conditional inclusion is written by? |
A. | #else if |
B. | #elseif |
C. | #elsif |
D. | #elif |
Answer» E. | |
119. |
C preprocessors can have compiler specific features. |
A. | True |
B. | False |
C. | Depends on the standard |
D. | Depends on the platform |
Answer» B. False | |
120. |
Functions can return enumeration constants in C? |
A. | true |
B. | false |
C. | depends on the compiler |
D. | depends on the standard |
Answer» B. false | |
121. |
What is the format identifier for 'static a = 20.5;'? |
A. | %s |
B. | %d |
C. | %f |
D. | Illegal declaration due to absence of data type |
Answer» C. %f | |
122. |
Which of the following storage class supports char data type? |
A. | register |
B. | static |
C. | auto |
D. | all of the mentioned |
Answer» E. | |
123. |
A local variable declaration with no storage class specified is by default _________ |
A. | auto |
B. | extern |
C. | static |
D. | register |
Answer» B. extern | |
124. |
Preprocessor feature that supply line numbers and filenames to compiler is called? |
A. | Selective inclusion |
B. | macro substitution |
C. | Concatenation |
D. | Line control |
Answer» E. | |
125. |
What linkage does automatic variables have? |
A. | Internal linkage |
B. | External linkage |
C. | No linkage |
D. | None of the mentioned |
Answer» D. None of the mentioned | |
126. |
C preprocessor is conceptually the first step during compilation. |
A. | True |
B. | False |
C. | Depends on the compiler |
D. | Depends on the standard |
Answer» B. False | |
127. |
What would happen if you create a file stdio.h and use #include 'stdio.h'? |
A. | The predefined library file will be selected |
B. | The user-defined library file will be selected |
C. | Both the files will be included |
D. | The compiler won't accept the program |
Answer» C. Both the files will be included | |
128. |
Register storage class can be specified to global variables. |
A. | True |
B. | False |
C. | Depends on the compiler |
D. | Depends on the standard |
Answer» C. Depends on the compiler | |
129. |
#pragma exit is primarily used for? |
A. | Checking memory leaks after exiting the program |
B. | Informing Operating System that program has terminated |
C. | Running a function at exiting the program |
D. | No such preprocessor exist |
Answer» D. No such preprocessor exist | |
130. |
When compiler accepts the request to use the variable as a register? |
A. | It is stored in CPU |
B. | It is stored in cache memory |
C. | It is stored in main memory |
D. | It is stored in secondary memory |
Answer» B. It is stored in cache memory | |
131. |
How is search done in #include and #include'somelibrary.h' normally or conventionally? |
A. | When former is used, current directory is searched and when latter is used, standard directory is searched |
B. | When former is used, predefined directory is searched and when latter is used, current directory is searched and then predefined directories are searched |
C. | When former is used, search is done in implementation defined manner and latter is used to search current directory |
D. | For both, search for somelibrary is done in implementation-defined manner |
Answer» C. When former is used, search is done in implementation defined manner and latter is used to search current directory | |
132. |
Automatic variables are _________ |
A. | Declared within the scope of a block, usually a function |
B. | Declared outside all functions |
C. | Declared with auto keyword |
D. | Declared within the keyword extern |
Answer» B. Declared outside all functions | |
133. |
Automatic variables are allocated space in the form of a __________ |
A. | stack |
B. | queue |
C. | priority queue |
D. | random |
Answer» B. queue | |
134. |
Conditional inclusion can be used for ___________ |
A. | Preventing multiple declarations of a variable |
B. | Check for existence of a variable and doing something if it exists |
C. | Preventing multiple declarations of same function |
D. | All of the mentioned |
Answer» E. | |
135. |
What is the return-type of the function sqrt()? |
A. | int |
B. | float |
C. | double |
D. | depends on the data type of the parameter |
Answer» D. depends on the data type of the parameter | |
136. |
Which of following is not accepted in C? |
A. | static a = 10; //static as |
B. | static int func (int); //parameter as static |
C. | static static int a; //a static variable prefixed with static |
D. | all of the mentioned |
Answer» D. all of the mentioned | |
137. |
Which among the following is wrong for 'register int a;'? |
A. | Compiler generally ignores the request |
B. | You cannot take the address of this variable |
C. | Access time to a is critical |
D. | None of the mentioned |
Answer» E. | |
138. |
#include
|
A. | Library, Library |
B. | Library, user-created header |
C. | User-created header, library |
D. | They can include all types of file |
Answer» E. | |
139. |
Which of the following cannot be static in C? |
A. | Variables |
B. | Functions |
C. | Structures |
D. | None of the mentioned |
Answer» E. | |
140. |
What is the default return type if it is not specified in function definition? |
A. | void |
B. | int |
C. | double |
D. | short int |
Answer» C. double | |
141. |
Automatic variables are allocated memory in ___________ |
A. | heap |
B. | Data segment |
C. | Code segment |
D. | stack |
Answer» E. | |
142. |
Which of the following properties of #define is not true? |
A. | You can use a pointer to #define |
B. | #define can be made externally available |
C. | They obey scope rules |
D. | All of the mentioned |
Answer» E. | |
143. |
Automatic variables are initialized to ___________ |
A. | Zero |
B. | Junk value |
C. | Nothing |
D. | Both Zero & Junk value |
Answer» C. Nothing | |
144. |
Property which allows to produce different executable for different platforms in C is called? |
A. | File inclusion |
B. | Selective inclusion |
C. | Conditional compilation |
D. | Recursive macros |
Answer» D. Recursive macros | |
145. |
Which of the following are C preprocessors? |
A. | #ifdef |
B. | #define |
C. | #endif |
D. | all of the mentioned |
Answer» E. | |
146. |
What is the scope of an automatic variable? |
A. | Within the block it appears |
B. | Within the blocks of the block it appears |
C. | Until the end of program |
D. | Within the block it appears & Within the blocks of the block it appears |
Answer» E. | |
147. |
What is the advantage of #define over const? |
A. | Data type is flexible |
B. | Can have a pointer |
C. | Reduction in the size of the program |
D. | None of the mentioned |
Answer» B. Can have a pointer | |
148. |
What is the scope of automatic variable? |
A. | Exist only within that scope in which it is declared |
B. | Cease to exist after the block is exited |
C. | Exist only within that scope in which it is declared & exist after the block is exited |
D. | All of the mentioned |
Answer» D. All of the mentioned | |
149. |
Which of the following names for files not accepted? |
A. | header.h.h |
B. | 123header.h |
C. | _head_er.h |
D. | None of the mentioned |
Answer» E. | |
150. |
Automatic variables are stored in ________ |
A. | stack |
B. | data segment |
C. | register |
D. | heap |
Answer» B. data segment | |