Podcast
Questions and Answers
What is the purpose of the 'if' statement in decision making?
What is the purpose of the 'if' statement in decision making?
- Always execute the statement block after 'if'
- Repeat a group of statements
- Execute a statement block when a test expression is true (correct)
- Execute a statement block when a test expression is false
In decision making, what type of statement is the 'if-else' statement?
In decision making, what type of statement is the 'if-else' statement?
- One-way decision statement
- Two-way decision statement (correct)
- Three-way decision statement
- Unconditional statement
How does the 'if-else' statement differ from the 'if' statement in decision making?
How does the 'if-else' statement differ from the 'if' statement in decision making?
- If-else has more than two condition checks
- 'If' statement is used for nested conditions
- If-else has an 'else' block for false conditions (correct)
- If-else always executes both blocks
What is necessary for an 'if-else' statement to execute the 'else' block?
What is necessary for an 'if-else' statement to execute the 'else' block?
What kind of decision-making scenario can be handled by nested if-else statements?
What kind of decision-making scenario can be handled by nested if-else statements?
In nested if-else statements, what happens if the condition in 'if (test expression1)' is false?
In nested if-else statements, what happens if the condition in 'if (test expression1)' is false?
'If' statements are primarily used for:
'If' statements are primarily used for:
What will be the output of the first code snippet if the user inputs var1 as 10 and var2 as 10?
What will be the output of the first code snippet if the user inputs var1 as 10 and var2 as 10?
In the second code snippet, what is the value of 'grade' if a user enters 45 for 'marks'?
In the second code snippet, what is the value of 'grade' if a user enters 45 for 'marks'?
What does the ternary operator in the third code snippet do?
What does the ternary operator in the third code snippet do?
In the fourth code snippet, what happens when the user enters a negative number for 'num'?
In the fourth code snippet, what happens when the user enters a negative number for 'num'?
How many operands does the ternary operator take?
How many operands does the ternary operator take?
Which statement best describes the usage of a 'goto' statement in C programming?
Which statement best describes the usage of a 'goto' statement in C programming?
If a user enters 73 for 'marks' in the second code snippet, what will be the output for 'grade'?
If a user enters 73 for 'marks' in the second code snippet, what will be the output for 'grade'?
What happens if a user doesn't input any value for 'marks' in the second code snippet?
What happens if a user doesn't input any value for 'marks' in the second code snippet?
What does the statement 'case 10: case 9: case 8: case 7: case 6: grade="first";' mean in the second code snippet?
What does the statement 'case 10: case 9: case 8: case 7: case 6: grade="first";' mean in the second code snippet?
'case value-1 block-1 break;' represents which control structure in C programming?
'case value-1 block-1 break;' represents which control structure in C programming?