C/C /C Programming - MCQ Questions Set 3 Sample Test,Sample questions

Question:
#include <somefile.h> are _______ files and #include “somefile.h” ________ files.

1.Library, Library

2.Library, user-created header

3.User-created header, library

4.They can include all types of file

Posted Date:-2021-02-20 21:41:37


Question:
#include statement must be written _____

1. Before main()

2.Before any scanf/printf

3.After main()

4.It can be written anywhere

Posted Date:-2021-02-20 21:41:37


Question:
An array of similar data types which themselves are a collection of dissimilar data type are ___________

1.Linked Lists

2.Trees

3.Array of Structure

4.All of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
Arguments that take input by user before running a program are called?

1.Main function arguments

2.Main arguments

3.Command-Line arguments

4. Parameterized arguments

Posted Date:-2021-02-20 21:41:37


Question:
 #pragma exit is primarily used for?

1.Checking memory leaks after exiting the program

2.Informing Operating System that program has terminated

3.Running a function at exiting the program

4.No such preprocessor exist

Posted Date:-2021-02-20 21:41:37


Question:
 If #include is used with file name in angular brackets.

1.The file is searched for in the standard compiler include paths

2.The search path is expanded to include the current source directory

3.The search path will expand

4.None of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
 If the file name is enclosed in angle brackets, then ___

1.The preprocessor treats it as a user-defined file

2.The preprocessor treats it as a system-defined file

3.The preprocessor treats it as a user-defined file & system-defined file

4. None of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
 Which of following logical operation can be applied to pointers?  (Assuming initialization int *a = 2; int *b = 3;)

1. a | b

2.a ^ b

3.a & b

4. None of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
C preprocessor is conceptually the first step during compilation.

1.TRUE

2.FALSE

3.Depends on the compiler

4.Depends on the standard

Posted Date:-2021-02-20 21:41:37


Question:
C preprocessors can have compiler specific features.

1.TRUE

2.FALSE

3.Depends on the standard

4.Depends on the platform

Posted Date:-2021-02-20 21:41:37


Question:
Can function definition be present in header files?

1.Yes

2.No

3. Depends on the compiler

4.Depends on the standard

Posted Date:-2021-02-20 21:41:37


Question:
Comment on an array of the void data type.

1.It can store any data-type

2. It only stores element of similar data type to first element

3.It acquires the data type with the highest precision in it

4. You cannot have an array of void data type

Posted Date:-2021-02-20 21:41:37


Question:
Conditional inclusion can be used for ______

1.Preventing multiple declarations of a variable

2.Check for existence of a variable and doing something if it exists

3.Preventing multiple declarations of same function

4.All of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
For each #if, #ifdef, and #ifndef directive.

1.There are zero or more #elif directives

2.Zero or one #else directive

3.One matching #endif directive

4.All of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
How is search done in #include and #include “somelibrary.h” according to C standard?

1.When former is used, current directory is searched and when latter is used, standard directory is searched

2.When former is used, standard directory is searched and when latter is used, current directory is searched

3. When former is used, search is done in implementation defined manner and when latter is used, current directory is searched

4.For both, search for ‘somelibrary’ is done in implementation-defined places

Posted Date:-2021-02-20 21:41:37


Question:
How is search done in #include and #include”somelibrary.h” normally or conventionally?

1.When former is used, current directory is searched and when latter is used, standard directory is searched

2.When former is used, predefined directory is searched and when latter is used, current directory is searched and then predefined directories are searched

3.When former is used, search is done in implementation defined manner and latter is used to search current directory

4.For both, search for somelibrary is done in implementation-defined manner

Posted Date:-2021-02-20 21:41:37


Question:
If the file name is enclosed in double quotation marks, then _________

1.The preprocessor treats it as a user-defined file

2. The preprocessor treats it as a system-defined file

3. The preprocessor treats it as a user-defined file & system-defined file

4.None of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
In a conditional inclusion, if the condition that comes after the if is true, then what will happen during compilation?

1.Then the code up to the following #else or #elif or #endif is compiled

2. Then the code up to the following #endif is compiled even if #else or #elif is present

3.Then the code up to the following #eliif is compiled

4.None of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
 A local variable declaration with no storage class specified is by default _________

1.auto

2. extern

3.static

4.register

Posted Date:-2021-02-20 21:41:37


Question:
Preprocessor feature that supply line numbers and filenames to compiler is called?

1.Selective inclusion

2. macro substitution

3.Concatenation

4.Line control

Posted Date:-2021-02-20 21:41:37


Question:
Property which allows to produce different executable for different platforms in C is called?

1.File inclusion

2.Selective inclusion

3.Conditional compilation

4. Recursive macros

Posted Date:-2021-02-20 21:41:37


Question:
The #else directive is used for _________

1.Conditionally include source text if the previous #if, #ifdef, #ifndef, or #elif test fails

2.Conditionally include source text if a macro name is not defined

3.Conditionally include source text if a macro name is defined

4. Ending conditional text

Posted Date:-2021-02-20 21:41:37


Question:
The C-preprocessors are specified with _________symbol.

1.#

2.$

3.” ”

4. &

Posted Date:-2021-02-20 21:41:37


Question:
The preprocessor provides the ability for ____

1. The inclusion of header files

2.The inclusion of macro expansions

3.Conditional compilation and line control

4.All of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
User-defined data type can be derived by________

1. struct

2. enum

3. typedef

4.all of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
What are the applications of a multidimensional array?

1.Matrix-Multiplication

2.Minimum Spanning Tree

3.Finding connectivity between nodes

4.All of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
What is #include <stdio.h>?

1.Preprocessor directive

2.Inclusion directive

3.File inclusion directive

4.None of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
What is #include directive?

1.Tells the preprocessor to grab the text of a file and place it directly into the current file

2.Statements are not typically placed at the top of a program

3.All of the mentioned

4.None of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
What is a preprocessor?

1.That processes its input data to produce output that is used as input to another program

2.That is nothing but a loader

3.That links various source files

4.All of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
What is the advantage of #define over const?

1.Data type is flexible

2.Can have a pointer

3.Reduction in the size of the program

4.None of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
What is the correct syntax to send a 3-dimensional array as a parameter? (Assuming declaration int a[5][4][3];)

1.func(a);

2.func(&a);

3.func(*a);

4.func(**a);

Posted Date:-2021-02-20 21:41:37


Question:
What is the maximum number of arguments that can be passed in a single function?

1.127

2.253

3. 361

4.No limits in number of arguments

Posted Date:-2021-02-20 21:41:37


Question:
What is the sequence for preprocessor to look for the file within <>?

1.The predefined location then the current directory

2.The current directory then the predefined location

3.The predefined location only

4. The current directory location

Posted Date:-2021-02-20 21:41:37


Question:
What is the size of *ptr in a 32-bit machine (Assuming initialization as int *ptr = 10;)?

1.1

2.2

3.4

4.8

Posted Date:-2021-02-20 21:41:37


Question:
What would happen if you create a file stdio.h and use #include “stdio.h”?

1.The predefined library file will be selected

2. The user-defined library file will be selected

3.Both the files will be included

4.The compiler won’t accept the program

Posted Date:-2021-02-20 21:41:37


Question:
Which directory the compiler first looks for the file when using #include?

1.Current directory where program is saved

2.C:COMPILERINCLUDE

3.S:SOURCEHEADERS

4.Both C:COMPILERINCLUDE and S:SOURCEHEADERS simultaneously

Posted Date:-2021-02-20 21:41:37


Question:
Which of the following are C preprocessors?

1.#ifdef

2. #define

3. #endif

4.all of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
Which of the following are themselves a collection of different data types?

1. string

2.structures

3.char

4.all of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
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;)

1.a + b

2. a – b

3.a * b

4.a / b

Posted Date:-2021-02-20 21:41:37


Question:
Which of the following can never be sent by call-by-value?

1.Variable

2.Array

3.Structures

4.Both Array and Structures

Posted Date:-2021-02-20 21:41:37


Question:
Which of the following cannot be a structure member?

1. Another structure

2.Function

3.Array

4.None of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
Which of the following declaration will result in run-time error?

1.int **c = &c;

2. int **c = &*c;

3. int **c = **c;

4.none of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
Which of the following file extensions are accepted with #include?

1..h

2. .in

3..com

4.All of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
Which of the following is not possible statically in C?

1. Jagged Array

2. Rectangular Array

3.Cuboidal Array

4.Multidimensional Array

Posted Date:-2021-02-20 21:41:37


Question:
Which of the following is not possible under any scenario?

1. s1 = &s2;

2.s1 = s2;

3.(*s1).number = 10;

4.None of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
Which of the following names for files not accepted?

1.header.h.h

2.header.h.h

3. _head_er.h

4.None of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
Which of the following operation is illegal in structures?

1.Typecasting of structure

2.Pointer to a variable of the same structure

3.Dynamic allocation of memory for structure

4.All of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
Which of the following return-type cannot be used for a function in C?

1.char *

2. struct

3.void

4.none of the mentioned

Posted Date:-2021-02-20 21:41:37


Question:
Which operator connects the structure name to its member name?

1.–

2.<-

3. .

4.Both <- and .

Posted Date:-2021-02-20 21:41:37


Question:
Which type of variables can have the same name in a different function?

1.Global variables

2.Static variables

3.Function arguments

4.Both static variables and Function arguments

Posted Date:-2021-02-20 21:41:37


More MCQS

  1. C++ Programming MCQS Set-1
  2. C++ Multiple Choice Questions Set-1
  3. C++ Multiple Choice Questions Set-2
  4. C++ Programming MCQS Set-2
  5. C++ Programming MCQS Set-3
  6. C++ Programming MCQS Set-4
  7. C++ (CPP) MCQ Question with Answer
  8. Advanced c++ multiple choice question(MCQS)
  9. OOPS Quiz Questions and Answers(MCQS)
  10. C Programming - MCQ Questions Set 1
  11. C Programming - MCQ Questions Set 2
  12. C Programming - MCQ Questions Set 3
  13. C Programming - MCQ Questions Set 4
  14. C Programming - MCQ Questions Set 5
  15. C++ programming language MCQ Questions Set 1
  16. C++ programming language MCQ Questions Set 2
  17. C++ programming language MCQ Questions Set 3
  18. C++ programming language MCQ Questions Set 4
  19. C++ programming language MCQ Questions Set 5
  20. C++ Programming -Constructors and Destructors
  21. C++ Programming -OOPS Concepts
  22. C++ Programming - References
  23. C++ Programming - Functions
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!