Which operators are used for building compound conditions?
- Relational
- Logical
- Arithmetic
- Assignment
Show answer and explanation
Answer: B. Logical
Logical operators (&&, ||, !) combine two or more relational conditions into one compound condition.
Practise 16 real Federal Board questions on Conditional Logic from 2023 to 2025. See the answer and explanation as soon as you answer.
Conditional Logic is one of the 9 main chapters in our Federal Board Matric Computer Science question bank (10th class), and about 5% of its real questions come from it. Tayyari Karo has 16 real questions on this chapter from 2023 to 2025; 5 are multiple choice and marked instantly, and the rest are short and long questions with a model answer. By difficulty: 14 easy, 2 medium.
Work through the questions below, then open the explanation for each one. Redo the ones you missed a few days later.
These are real past-paper questions. Think of your answer first, then open the explanation.
Which operators are used for building compound conditions?
Answer: B. Logical
Logical operators (&&, ||, !) combine two or more relational conditions into one compound condition.
________ statement is used to exit from the body of SWITCH statement.
Answer: B. BREAK
The break statement terminates execution of the switch block and transfers control out of it.
Which statement can be used in place of Conditional Operator?
Answer: A. IF-ELSE
The ternary conditional operator (?:) is shorthand for a simple if-else statement.
Rewrite the following statement using if-else: k=(a+b>20)?a+3*b:a-b;
if (a + b > 20)
k = a + 3 * b;
else
k = a - b;
Write a C program that determines whether a number is even or odd using an if-else statement.
#include<stdio.h>
void main()
{
int num;
printf("Enter a number: ");
scanf("%d", &num);
if (num % 2 == 0)
printf("Even");
else
printf("Odd");
}
Write down the use of default keyword in switch statement.
The default case in a switch statement holds the statements that execute when the switch expression's value does not match any of the listed case labels — it works like the “else” of a switch and is optional.
What will be the output of the following code?
void main()
{
int a=2;
switch(a)
{
case 2: printf("Case 2"); break;
case 3: printf("Case 3"); break;
default: printf("Default\n");
}}
a is 2, so it matches case 2: it prints “Case 2” and the break exits the switch. Output: Case 2
What is the use of the following in SWITCH statement? (a) CASE (b) BREAK (c) DEFAULT.
(a) case — labels each possible matching value of the switch expression, and marks the start of the statements to run for that value.
(b) break — ends execution of the switch block and prevents control from “falling through” into the next case.
(c) default — an optional case that runs when none of the listed case values match the switch expression.
| Session | Questions |
|---|---|
| 2025 2nd Annual | 5 |
| 2024 Annual | 5 |
| 2023 Annual | 6 |
16 real Federal Board (FBISE) Computer Science questions on Conditional Logic from 2023 to 2025, for 10th class. Each one shows the session it came from.
No. We could not find an official FBISE marking scheme for these papers, so the answers and explanations are written by Tayyari Karo for practice. Check anything important with your teacher or textbook.
You can start free with no signup. A small set of papers per subject is free, and Premium unlocks the full question bank.