Home
MCQS
C/C MCQ Quiz Hub
C Programming - MCQ Questions Set 3
Choose a topic to test your knowledge and improve your C/C skills
1.  A local variable declaration with no storage class specified is by default _________
auto
extern
static
register
2. Property which allows to produce different executable for different platforms in C is called?
File inclusion
Selective inclusion
Conditional compilation
Recursive macros
3. What is #include <stdio.h>?
Preprocessor directive
Inclusion directive
File inclusion directive
None of the mentioned
4. C preprocessors can have compiler specific features.
TRUE
FALSE
Depends on the standard
Depends on the platform
5. C preprocessor is conceptually the first step during compilation.
TRUE
FALSE
Depends on the compiler
Depends on the standard
6. Preprocessor feature that supply line numbers and filenames to compiler is called?
Selective inclusion
macro substitution
Concatenation
Line control
7. #include <somefile.h> are _______ files and #include “somefile.h” ________ files.
Library, Library
Library, user-created header
User-created header, library
They can include all types of file
8. What is a preprocessor?
That processes its input data to produce output that is used as input to another program
That is nothing but a loader
That links various source files
All of the mentioned
9. Which of the following are C preprocessors?
#ifdef
#define
#endif
all of the mentioned
10. #include statement must be written _____
Before main()
Before any scanf/printf
After main()
It can be written anywhere
11. #pragma exit is primarily used for?
Checking memory leaks after exiting the program
Informing Operating System that program has terminated
Running a function at exiting the program
No such preprocessor exist
12. The C-preprocessors are specified with _________symbol.
#
$
” ”
&amp;
13. What is #include directive?
Tells the preprocessor to grab the text of a file and place it directly into the current file
Statements are not typically placed at the top of a program
All of the mentioned
None of the mentioned
14. The preprocessor provides the ability for ____
The inclusion of header files
The inclusion of macro expansions
Conditional compilation and line control
All of the mentioned
15. If #include is used with file name in angular brackets.
The file is searched for in the standard compiler include paths
The search path is expanded to include the current source directory
The search path will expand
None of the mentioned
16. What is the sequence for preprocessor to look for the file within <>?
The predefined location then the current directory
The current directory then the predefined location
The predefined location only
The current directory location
17. Which directory the compiler first looks for the file when using #include?
Current directory where program is saved
C:COMPILERINCLUDE
S:SOURCEHEADERS
Both C:COMPILERINCLUDE and S:SOURCEHEADERS simultaneously
18. What would happen if you create a file stdio.h and use #include “stdio.h”?
The predefined library file will be selected
The user-defined library file will be selected
Both the files will be included
The compiler won’t accept the program
19. How is search done in #include and #include “somelibrary.h” according to C standard?
When former is used, current directory is searched and when latter is used, standard directory is searched
When former is used, standard directory is searched and when latter is used, current directory is searched
When former is used, search is done in implementation defined manner and when latter is used, current directory is searched
For both, search for ‘somelibrary’ is done in implementation-defined places
20. How is search done in #include and #include”somelibrary.h” normally or conventionally?
When former is used, current directory is searched and when latter is used, standard directory is searched
When former is used, predefined directory is searched and when latter is used, current directory is searched and then predefined directories are searched
When former is used, search is done in implementation defined manner and latter is used to search current directory
For both, search for somelibrary is done in implementation-defined manner
21. Can function definition be present in header files?
Yes
No
Depends on the compiler
Depends on the standard
22. If the file name is enclosed in double quotation marks, then _________
The preprocessor treats it as a user-defined file
The preprocessor treats it as a system-defined file
The preprocessor treats it as a user-defined file &amp; system-defined file
None of the mentioned
23. If the file name is enclosed in angle brackets, then ___
The preprocessor treats it as a user-defined file
The preprocessor treats it as a system-defined file
The preprocessor treats it as a user-defined file &amp; system-defined file
None of the mentioned
24. Which of the following file extensions are accepted with #include?
.h
.in
.com
All of the mentioned
25. Which of the following names for files not accepted?
header.h.h
header.h.h
_head_er.h
None of the mentioned
26. What is the advantage of #define over const?
Data type is flexible
Can have a pointer
Reduction in the size of the program
None of the mentioned
27. In a conditional inclusion, if the condition that comes after the if is true, then what will happen during compilation?
Then the code up to the following #else or #elif or #endif is compiled
Then the code up to the following #endif is compiled even if #else or #elif is present
Then the code up to the following #eliif is compiled
None of the mentioned
28. Conditional inclusion can be used for ______
Preventing multiple declarations of a variable
Check for existence of a variable and doing something if it exists
Preventing multiple declarations of same function
All of the mentioned
29. For each #if, #ifdef, and #ifndef directive.
There are zero or more #elif directives
Zero or one #else directive
One matching #endif directive
All of the mentioned
30. The #else directive is used for _________
Conditionally include source text if the previous #if, #ifdef, #ifndef, or #elif test fails
Conditionally include source text if a macro name is not defined
Conditionally include source text if a macro name is defined
Ending conditional text
31. Which of the following can never be sent by call-by-value?
Variable
Array
Structures
Both Array and Structures
32. Which type of variables can have the same name in a different function?
Global variables
Static variables
Function arguments
Both static variables and Function arguments
33. Arguments that take input by user before running a program are called?
Main function arguments
Main arguments
Command-Line arguments
Parameterized arguments
34. What is the maximum number of arguments that can be passed in a single function?
127
253
361
No limits in number of arguments
35. An array of similar data types which themselves are a collection of dissimilar data type are ___________
Linked Lists
Trees
Array of Structure
All of the mentioned
36. Comment on an array of the void data type.
It can store any data-type
It only stores element of similar data type to first element
It acquires the data type with the highest precision in it
You cannot have an array of void data type
37. Which of the following arithmetic operation can be applied to pointers a and b? (Assuming initialization as int *a = (int *)2; int *b = (int *)3;)
a + b
a – b
a * b
a / b
38. What is the size of *ptr in a 32-bit machine (Assuming initialization as int *ptr = 10;)?
1
2
4
8
39. Which of following logical operation can be applied to pointers? (Assuming initialization int *a = 2; int *b = 3;)
a | b
a ^ b
a &amp; b
None of the mentioned
40. Which of the following declaration will result in run-time error?
int **c = &amp;c;
int **c = &amp;*c;
int **c = **c;
none of the mentioned
41. Which of the following is not possible statically in C?
Jagged Array
Rectangular Array
Cuboidal Array
Multidimensional Array
42. What is the correct syntax to send a 3-dimensional array as a parameter? (Assuming declaration int a[5][4][3];)
func(a);
func(&amp;a);
func(*a);
func(**a);
43. What are the applications of a multidimensional array?
Matrix-Multiplication
Minimum Spanning Tree
Finding connectivity between nodes
All of the mentioned
44. Which of the following are themselves a collection of different data types?
string
structures
char
all of the mentioned
45. User-defined data type can be derived by________
struct
enum
typedef
all of the mentioned
46. Which operator connects the structure name to its member name?
–
&lt;-
.
Both &lt;- and .
47. Which of the following cannot be a structure member?
Another structure
Function
Array
None of the mentioned
48. Which of the following return-type cannot be used for a function in C?
char *
struct
void
none of the mentioned
49. Which of the following is not possible under any scenario?
s1 = &amp;s2;
s1 = s2;
(*s1).number = 10;
None of the mentioned
50. Which of the following operation is illegal in structures?
Typecasting of structure
Pointer to a variable of the same structure
Dynamic allocation of memory for structure
All of the mentioned
Submit