MCQ

100 Multiple Choice Questions In C Programming – Part 2

This collection of 100 Multiple Choice Questions and Answers (MCQs) In C Programming : Quizzes & Practice Tests with Answer focuses on “C Programming”.
 

1. What is a “console mode” program?

A A program that runs only on a game console

B A program that runs in a Dos window

C A program in a graphic environment with windows

D None of the above

B
A “console mode” program is a program without a graphical interface, designed to be used only with keyboard commands. It is possible to run a console application without a graphical interface or to run an operating system in console mode for diagnostic and other purposes. It is important to know that console applications tend to be more error tolerant and users should be careful when in a console to avoid crashes. Example of a “console mode” program:
 

 

 

2. When we declare a variable, which memory is used?

A RAM

B ROM

C Hard disk

D Microprocessor

A
Variables are usually stored in RAM. This is on the heap (for example, all global variables are used to go there) or on the stack (all variables declared inside a method/function are used to go there). The stack and the heap are both RAM, just different places.
 

 

 
[st_adsense]  

3. Which of the following is not a valid variable name statement?

A int __a7;

B int __7a;

C int __A7;

D None of the above

D
It is not recommended to start the variable name with underscore “_”.

 

 

4. Which of the following is not a valid variable name statement?

A int _a7;

B int a_7;

C int 7_a;

D int _7a

C
The variable name should not start with a number.

 

 

5. Variable names beginning with underscore “_” are not encouraged. So why not?

A It is not normalized

B To avoid conflicts since assemblers and compilers can use variables containing underscore

C To avoid conflicts since library routines can use variables containing underscore

D To avoid conflicts with the operating system’s environment variables

C
Variable names beginning with underscore “_” are not encouraged, to avoid conflicts since library routines can use variables containing underscore.

 

 

6. All keywords in C are in ______?

A lowercase letters

B uppercase letters

C CamelCase letters

D None of the above

A
All keywords in C are in lowercase.

 

 
[st_adsense]  

7. Resolution of variable names depends on _______?

A The implementation of the compiler and linker

B The implementation of the assembler and the loader

C C language

D None of the above

A
It depends on the standard to which the compiler and links are complied.

 

 

8. Which of the following is not a valid variable name statement?

A int nbr;

B float price;

C int variable_count;

D int $main;

D
Only underscore “_” and no other special character is allowed in a variable name, it results in an error.

 

 

9. Which of the following statements is true about variable names in C?

A They can contain alphanumeric characters as well as special characters

B It is not a problem to declare a variable as one of the keywords (like goto, static)

C Variable names cannot start with a number

D Variable can be of any length.

C
According to the syntax, variable names should not start with a number.

 

 
[st_adsense]  

10. The variable X contains 9.5 , What does the following line print?
printf("X = %d ",X);

A X = %d

B X = 9.5

C X = 9

D X = d , X

C
%d to print integer and %f to print float value.



 

mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More [st_adsense]

Leave a Reply

Your email address will not be published. Required fields are marked *