MCQ@1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

E.G.

S PILLAY ENGINEERING COLLEGE-NAGAPATTINAM


DEPARTMENT OF CSE
ACTIVITY -1 @MCQ TYPE

1. The format specifier "%i" is used

A. int
B. char
C. float
D. double

2. What will be the output of the following C code

#include <stdio.h>
int main()
{
float x = 21.0;
x %= 3.0;
printf("%f",x);
return 0;
}

A. 7
B. 7.00
C. 7.000000
D. Error

3. What will be the output of the following C code

#include <stdio.h>
void main()
{
int x = 10;
int y = ++x + 20;
printf("%d,%d",x,y);
return 0;
}

A. 11,30
B. 11,31
C. 10,30
D. 10,31

4. What is the name of "&" operator in C?

A. Ampersand
B. And
C. Address of
D. None of the above
5. Which of the following are valid decision-making statements in C?

A. if
B. switch
C. nested if
D. All of these

6. Decision making in the C programming language is

A. Repeating the same statement multiple times


B. Executing a set of statements based on some condition
C. Providing a name of the block of code
D. All of these

7. Which statement is required to execute a block of code when the condition is false?

A. for
B. if
C. else
D. All of these

8. How many expressions can be checked using nested if... statement?

A. 1
B. 2
C. Infinite
D. None of these

9. Multiple values of the same variable can be tested using

A. switch
B. for
C. Array
D. All

10. Loops in C programming are used to ___.

A. Execute a statement based on a condition


B. Execute a block of code repeatedly
C. Create a variable
D. None of these
11. What will be the output of the following C code
#include <stdio.h>
int main()
{
int i=1;
for(; ;)
{
printf("%d",i);
}
}

A. For loop will not work


B. Infinite for loop
C. Error
D. None of these

12. When the condition of the do-while loop is false, how many times will it execute the code?

A. 0
B. 1
C. Infinite
D. Error

13. Directives are translated by the

A. Pre-processor
B. Compiler
C. Linker
D. Editor

14. C language is available for which of the following Operating Systems?

A. DOS
B. Windows
C. Unix
D. All of these

15. Which of the following symbol is used to denote a pre-processor statement?

A. !
B. #
C. ~
D. ;

16. Which of the following are tokens in C?

A. Keywords
B. Variables
C. Constants
D. All of the above
17. What is the valid range of numbers for int type of data?

A. 0 to 256
B. -32768 to +32767
C. -65536 to +65536
D. No specific range

18. What will be the output of the following C code

#include <stdio.h>
int main(){
char grade = 'D';
switch (grade)
{
case 'A':
printf("Excellent!\n");
case 'B':
case 'C':
printf("Well done\n");
case 'D':
printf("You passed\n");
case 'F':
printf("Better try again\n");
break;
default:
printf("Invalid grade\n");
}
}

A. Error
B. You passed
C. Better try again
D. Exit the program

19. The equality operator is represented by

A. :=
B. Equal
C. =
D. ==

20. Header files in C contain

A. Compiler commands
B. Library functions
C. Header information of C programs
D. Operators for files

You might also like