Programming In C Sample Quiz Questions On DataTypes,Operators and ControlStatements
Sno
|
Question
|
Option 1
|
Option 2
|
Option 3
|
Option 4
|
Answer
|
1.
|
Which of the following operator has lowest precedence?
|
++ (post increment)
|
&&(LOGICAL AND)
|
&(bit-wise AND)
|
,(COMMA)
|
4
|
2.
|
ASCII stands for
|
American Standard Code for Information Interchange
|
Asian Standard Code for Information Interchange
|
American Standard Code for Interchange Information
|
Asian Standard Code for Interchange Information
|
1
|
3.
|
what is the function used for reading input to the program from
standard input?
|
print()
|
printf()
|
scanf()
|
scan()
|
3
|
4.
|
what is the function used for printing(displaying) output of the
program on standard output?
|
print()
|
printf()
|
scan()
|
scanf()
|
2
|
5.
|
Identify the keyword(s) for floating-point datatypes.
|
float
|
double
|
int
|
float or double
|
4
|
6.
|
___________ is the sytem software used to translate High level
language program to low level program(machine understandable language).
|
preprocessor
|
loader
|
compiler
|
operating system
|
3
|
7.
|
What is the binary equivalent for the decimal number 10 ?
|
1010
|
1100
|
1001
|
1101
|
1
|
8.
|
What is the output of the following statements ? char a='A';
printf("%d",a);
|
A
|
65
|
a
|
97
|
2
|
9.
|
What is the output of the following statements? int a=3,b=5;
printf("%d %d",a/b,a%b);
|
3 0
|
0 3
|
3 3
|
3 5
|
2
|
10.
|
What is the output of the following statements? int a=2;
printf("%d ",a<<2);
|
2
|
4
|
8
|
16
|
3
|
11.
|
What is the output of the following statements? int a=1024;
printf("%d ",a>>10);
|
1024
|
512
|
1
|
0
|
3
|
12.
|
what is the output of the following statement? Int a; print("%d
%d",a+2,a=2);
|
2 2
|
4 2
|
4 4
|
2 4
|
2
|
13.
|
Which of the following is not a valid indentifier?
|
sum
|
Sum1
|
1marks
|
marks_avg
|
3
|
14.
|
What is the output of the following statements? int a; printf("%d
",a=2);
|
2
|
0
|
1
|
-1
|
1
|
15.
|
Which keyword can be used for coming out of loops?
|
break
|
return
|
exit
|
Both (1) and (2)
|
1
|
16.
|
The keyword ‘break’ cannot be simply used within:
|
do-while
|
if-else
|
for
|
while
|
2
|
17.
|
Which keyword is used to come out of a loop only for that iteration?
|
break
|
continue
|
return
|
None of the mentioned
|
2
|
18.
|
What is the size of an int data type?
|
4 Bytes
|
8 Bytes
|
Depends on the system/compiler
|
Cannot be determined
|
3
|
19.
|
Which is correct with respect to size of the datatypes?
|
char > int > float
|
int > char > float
|
char < int < double
|
double > char > int
|
3
|
20.
|
The precedence of arithmetic operators is (from highest to lowest)?
|
%, *, /, +, -
|
%, +, /, *, -
|
+, -, %, *, /
|
%, +, -, *, /
|
1
|
21.
|
What is the output of this C code? int main() { int a = 0, i = 0, b;
for (i = 0;i < 5; i++) { a++; if (i == 3) break; } Printf(“%d”,a); }
|
1
|
2
|
3
|
4
|
4
|
22.
|
Which of the following is not an arithmetic operation?
|
a *= 20;
|
a /= 30;
|
a %= 40;
|
a != 50;
|
4
|
23.
|
What must the change be so that the following fragment prints out the
even integers 0 2 4 6 8 10? for ( int j = 0; j <= 10; _______ )
printf(“%d”,j);
|
j=j+1
|
j=j-2
|
j=j+2
|
j=j+3
|
3
|
24.
|
C language is a
|
procedure oriented language
|
object oriented programming language
|
design oriented programming language
|
all the above
|
1
|
25.
|
What is the output of the following for loop? for(x=1;x<=10;x++) {
if(x%2==1) continue; printf(“%d\t”,x); }
|
1 2 3 4 5
|
1 3 5 7 9
|
1 2 5 7 9
|
2 4 6 8 10
|
4
|
26.
|
what is the output of the following code? void main() { int a=6;
printf("%d,%d",a++,++a); }
|
7,7
|
6,7
|
7,6
|
8,8
|
1
|
27.
|
what is the output of the following code? void main() {
printf("%d,%d,%d,%d",6%5,5%6,-6%5,-5%6); }
|
1,5,-6,-5
|
1,5,-1,-5
|
1,0,-1,0
|
1,5,1,5
|
2
|
28.
|
which of the following statement should be used to obtain a remainder
after dividing 3.14 by 2.1?
|
3.14%2.1
|
3.14/2.1
|
illegal use of % operator for floating point data
|
3.14%%2.1
|
3
|
29.
|
which of the following operator is not logical operator?
|
&
|
&&
|
||
|
!
|
1
|
30.
|
which of the following can't be checked in switch case statement?
|
character
|
integer
|
float
|
long
|
3
|
Comments
Post a Comment