Q: 1 Which of the following is unconditional control jumping statement?
break statement
continue statement
switch case statement
goto statement
[ Option D ]
An unconditional control jumping statement transfers the flow of execution directly from one part of the program to another without checking any condition.
The goto statement transfers program control from one part to another without testing any condition. The goto transfers control unconditionally.
Q: 2 What will be the output of the following code?
int a=5;
int b=10;
if(a<3 || b>15)
printf("True");
else
printf("False");
True
False
0
1
[ Option B ]
The condition inside the if statement is (a<3 || b>15), which uses the logical OR (||) operator. First, a<3 is evaluated, since 5<3 is false, this part returns 0. Next, b>15 is evaluated, since 10>15 is also false, this part also returns 0.
The logical OR operation 0 || 0 results in 0, meaning the condition is false. Therefore, the else block is executed, and the output printed on the screen is "False".
Q: 3 No two-case statement have _________ in the same switch.
Identical value
Different value
Variable
Either (a) or (b)
[ Option A ]
In a switch statement, no two case labels can have identical values, each case value must be unique.
If two case labels have the same value, the compiler cannot decide which block to execute, so it is not allowed.
Q: 4 The switch case statement can only test
Equality
Non-equality
Functionality
Modularity
[ Option A ]
The switch statement checks whether the value of the expression is equal to one of the case constants. If a match is found, the corresponding case block is executed. So, switch-case performs only equality checking.
Q: 5 To transfer program control from one part to another part without testing any condition using?
if else if ladder statement
nested if statement
switch case statement
None of these
[ Option D ]
In C language, program control usually changes based on conditions. Statements like if, if-else, and switch all check a condition or expression before transferring control.
The goto statement transfers program control from one part to another without testing any condition. The goto transfers control unconditionally.
Q: 6 By default, scope of selection statement is?
Two line
One line
Three line
Zero line
[ Option B ]
The scope of a selection statement means how many statements are controlled by it. If curly braces { } are not used, then only one statement immediately following the condition is considered part of the selection statement.
Q: 7 The switch statement is used to?
Switch between function is a program
Switch from one variable to another variable
Choose from multiple possibilities which may arises due to different value of a single variable
Choose multiple statements from given set of statements
[ Option C ]
The switch statement is a selection (decision-making) statement. It allows a program to choose one block of code from many possible blocks.
Q: 8 Which of the following is not selection statement?
if
switch case
for
if else if ladder
[ Option C ]
The selection statements are used to choose one block of code for execution based on a condition. These statements help the program make decisions. Common selection statements in C are:
The for is a loop control statement, used to repeat a block of code.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.