MCQ on Control Structure Statements in C. This is the
1st post for ICS
Part-II | 2nd
Year Computer Science Chapter No.11 (Decision Constructs). The given
multiple choice questions (MCQs) with answers are important for the final exams
and entry tests.
We have tried our best to make the important multiple choice questions on selection structures in C. This post covers the MCQs on topics i.e. control structures (sequence, selection, and loop), simple if statement, if-else statement, if-else if statement, comparison of nested if & sequence of ifs statements, switch statement, and conditional operator.
An if statement inside another if statement is referred as?
simple if
nested if
sequence of if
if-else if
Decreasing nesting level leads to?
decrease in complexity
easy debugging
easy modification
all of these
Following symbols are not used with case label except?
dot (.)
colon (:)
semicolon (;)
comma (,)
How many types of loop statements loop?
2
3
4
5
For what value of a the given expression will evaluate to true: (age!=8)
age=9
age>8
age<8
all of these
In C, “ELSE” is an example of ?
keyword
standard identifier
keyword + standard identifier
none of these
In if-else if statement only ______ number of block of statements execute?
1
2
3
4
In switch statement, the case statement must end with?
end switch
end case
break
end
In which control structure, the instructions are executed as they are typed?
repetition
selection
sequence
none of these
The conditional operator is represented by?
(:)
(: ?)
(?)
(? :)
The process of checking validity of an algorithm by using sample data is called?
checking
debugging
desk checking
testing
Output of following code? main(){ int score=85; if(score>=90) printf(“1”); if(score>=80) printf(“2”); if(score>=70) printf(“3”); if(score>=60) printf(“4”);}
2
1
123
234
Output of given code below? main(){ int counter=1; switch(counter){ case 1: printf(“computer”); break; case 2: printf(“physics”); break; default: printf(“chemistry”);}
computer
physics
chemistry
none of these
Output of following code? main(){ int a=-3; (a>4)?printf(“%d”,++a) : printf(“%d”,a--);}
-3
-2
4
error
Output of following code? main(){ int x=6; (x!=0)? printf(“NUST”): printf(“UET”);}
NUST
UET
syntax error
none of these
What will be the valid expression for statement given below? speed is not greater than 60
speed<=60
!(speed>60)
(speed<60 || speed==60)
all of these
When control flow reaches the logical decisions in nested if, the rest of statements are?
checked
executed
skipped
none of these
Which of the following is a disadvantage of sequence of if statement?
all conditions are tested
CPU time improves
fast execution of program
all of these
Which of the following operators combine two or more relational expressions to construct compound expression?
arithmetic
relational
logical
all of these
Which control structure choose statement or block of statements to execute?
Post a Comment
Your feedback is highly appreciated and will help us to improve. So, please give your good suggestions.