C Basics - C programming (MCQ) questions

Here, you can read C Basics multiple choice questions and answers with explanation.

1)   Comment on the output of this C code?

#include <stdio.h>
#include "test.h"
#include "test.h"
int main()
{
      //some code
}

- Published on 26 Feb 17

a. TRUE
b. Compile time error
c. FALSE
d. Depends on the compiler
Answer  Explanation 

ANSWER: Depends on the compiler

Explanation:
No explanation is available for this question!


2)   How is search done in #include and #include "somelibrary.h" according to C standard?
- Published on 26 Feb 17

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  Explanation 

ANSWER: For both, search for ‘somelibrary’ is done in implementation-defined places

Explanation:
No explanation is available for this question!


3)   What would happen if you create a file stdio.h and use #include "stdio.h" ?
- Published on 26 Feb 17

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  Explanation 

ANSWER: The user-defined library file will be selected

Explanation:
No explanation is available for this question!


4)   Which directory the compiler first looks for the file when using #include?
- Published on 26 Feb 17

a. Current directory where program is saved
b. C:COMPILERINCLUDE
c. S:SOURCEHEADERS
d. Both (b) and (c) simultaneously
Answer  Explanation 

ANSWER: C:COMPILERINCLUDE

Explanation:
No explanation is available for this question!


5)   What is the sequence for preprocessor to look for the file within <> ?

- Published on 26 Feb 17

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  Explanation 

ANSWER: The predefined location then the current directory

Explanation:
No explanation is available for this question!


6)   What is stderr?
- Published on 26 Feb 17

a. standard error
b. standard error types
c. standard error streams
d. standard error definitions
Answer  Explanation 

ANSWER: standard error streams

Explanation:
No explanation is available for this question!


7)   Input/output function prototypes and macros are defined in which header file?
- Published on 26 Feb 17

a. conio.h
b. stdlib.h
c. stdio.h
d. dos.h
Answer  Explanation 

ANSWER: stdio.h

Explanation:
No explanation is available for this question!


8)   Specify the 2 library functions to dynamically allocate memory?
- Published on 26 Feb 17

a. malloc() and memalloc()
b. alloc() and memalloc()
c. malloc() and calloc()
d. memalloc() and faralloc()
Answer  Explanation 

ANSWER: malloc() and calloc()

Explanation:
No explanation is available for this question!


9)   What do the 'c' and 'v' in argv stands for?
- Published on 26 Feb 17

a. 'c' means argument control 'v' means argument vector
b. 'c' means argument count 'v' means argument vertex
c. 'c' means argument count 'v' means argument vector
d. 'c' means argument configuration 'v' means argument visibility
Answer  Explanation 

ANSWER: 'c' means argument count 'v' means argument vector

Explanation:
No explanation is available for this question!


10)   The maximum combined length of the command-line arguments including the spaces between adjacent arguments is
- Published on 26 Feb 17

a. 128 characters
b. 256 characters
c. 67 characters
d. It may vary from one operating system to another
Answer  Explanation 

ANSWER: It may vary from one operating system to another

Explanation:
No explanation is available for this question!


1 2