Total Pageviews

Friday, August 28, 2026

Chapter 6: Conditional Statements in BlueJ St Jude's High School class -8

Created by Bijan Krishna Paul

Chapter 6: Conditional Statements in BlueJ

Section A: Multiple Choice Questions (30 Marks)

1. Selection statements in programming are often referred to as:

A) Sequential statements
B) Decision-making or conditional statements
C) Iterative statements
D) Assignment statements

2. In a sequential construct, how are statements executed?

A) Randomly
B) In a sequential manner where one statement is followed by another
C) In reverse order
D) By skipping odd lines

3. What happens if the condition in an `if` statement evaluates to false?

A) Executes the statement block
B) Skips the statement block
C) Repeats the block indefinitely
D) Stops the computer

4. Which control structure is used when either of two different actions is to be performed depending on the conditional expression?

A) if...else
B) while
C) for
D) sequential block

5. Which structure provides a compact way to check multiple conditions sequentially where each condition has a block of statements?

A) Simple if
B) if...else if...else ladder
C) do-while loop
D) Nested class

6. The test condition in an `if` statement must return which data type value?

A) int
B) Boolean
C) float
D) String

7. Which operator is used to check equality between two values in conditional expressions?

A) =
B) ==
C) !=
D) :=

8. Which operator represents logical AND in Java/BlueJ?

A) &
B) &&
C) ||
D) AND

9. What is the symbol for logical OR operator in Java?

A) &&
B) ||
C) !
D) ==

10. Which statement executes when the condition in an `if...else` construct evaluates to false?

A) Statements inside `if` block
B) Statements inside `else` block
C) Both blocks execute
D) Neither block executes

11. What is the value of `a % 2` when `a = 15`?

A) 0
B) 1
C) 7
D) 15

12. How do you check if a number `num` is divisible by 5?

A) num / 5 == 0
B) num % 5 == 0
C) num * 5 == 0
D) num + 5 == 0

13. A Buzz number is defined as a number that ends with 7 or is divisible by:

A) 5
B) 7
C) 10
D) 2

14. Which expression checks if `num` ends with 7?

A) num / 10 == 7
B) num % 10 == 7
C) num * 10 == 7
D) num - 7 == 0

15. What condition determines if a voting candidate is eligible (age >= 18)?

A) age > 18
B) age >= 18
C) age == 18
D) age <= 18

16. In an `if...else if...else` ladder, how many `else` blocks can exist at the end?

A) Unlimited
B) Maximum 1
C) Exactly 2
D) Minimum 3

17. Which operator evaluates to true if both conditions are true?

A) ||
B) &&
C) !
D) !=

18. Which statement is used to execute a block of statements if a given condition is true, otherwise skip it?

A) Simple if
B) switch
C) break
D) return

19. What result is obtained for conditional check `10 != 5`?

A) true
B) false
C) 10
D) 5

20. To check if a character `ch` is uppercase, which range check is correct?

A) ch >= 'a' && ch <= 'z'
B) ch >= 'A' && ch <= 'Z'
C) ch >= '0' && ch <= '9'
D) ch == 'U'

21. If `length == breadth`, what geometric shape is formed?

A) Rectangle
B) Square
C) Circle
D) Oval

22. Which expression checks if `a` is greater than both `b` and `c`?

A) a > b || a > c
B) a > b && a > c
C) a > b > c
D) a == b && a == c

23. What will `if (score >= 80)` output when `score = 85`?

A) Executes true block
B) Executes false block
C) Causes error
D) Does nothing

24. Which condition checks if number `n` is fully divisible by number `d`?

A) n % d == 0
B) n / d == 0
C) n * d == 0
D) n + d == 0

25. What is the logical NOT operator in Java?

A) !
B) NOT
C) ~
D) !=

26. In an `if (a > b)` construct, what surrounds the condition `a > b`?

A) Parentheses `()`
B) Curly brackets `{}`
C) Square brackets `[]`
D) Angle brackets `<>`

27. What is the output of condition `!(5 > 2)`?

A) true
B) false
C) 5
D) 2

28. In Java, curly braces `{}` are used to enclose:

A) Single variable names
B) A block of statements
C) Comments
D) Import statements

29. If `temp = 0`, what does `if (temp < 0)` evaluate to?

A) true
B) false
C) 0
D) Null

30. Which control structure helps a program choose between two or more paths based on a condition?

A) Selection structure
B) Sequential structure
C) Loop structure
D) Function call

Section B: Assertion & Reason Questions (30 Marks)

Directions: Choose the correct option:

  • A: Both Assertion (A) and Reason (R) are true, and Reason (R) is the correct explanation.
  • B: Both Assertion (A) and Reason (R) are true, but Reason (R) is NOT the correct explanation.
  • C: Assertion (A) is true, but Reason (R) is false.
  • D: Assertion (A) is false, but Reason (R) is true.

31. Assertion (A): Selection statements are also known as decision-making statements.
Reason (R): They transfer program control to a specific statement depending on the boolean result of a conditional expression.

32. Assertion (A): In sequential execution, statements can skip directly to the end based on user input.
Reason (R): Sequential constructs execute statements strictly one after the other with no branching.

33. Assertion (A): The condition in an `if` statement must evaluate to a boolean value.
Reason (R): Java requires boolean conditions (`true` or `false`) to determine execution flow.

34. Assertion (A): All conditions in an `if...else if...else` ladder are evaluated even if the first condition is true.
Reason (R): The ladder skips remaining checks once a true condition is encountered and its block executed.

35. Assertion (A): Modulus operator `%` returns the remainder of integer division.
Reason (R): `num % 2 == 0` evaluates to true for all even numbers.

36. Assertion (A): The relational operator `==` assigns a value to a variable.
Reason (R): `==` checks equality, whereas `=` is the assignment operator in Java.

37. Assertion (A): An `if` statement can exist without an accompanying `else` block.
Reason (R): The `else` block is optional in simple `if` selection structures.

38. Assertion (A): Logical AND (`&&`) returns true if at least one operand is true.
Reason (R): `&&` requires both expressions to be true simultaneously.

39. Assertion (A): Logical OR (`||`) returns true if either condition is true.
Reason (R): A Buzz number condition uses `||` because ending in 7 OR being divisible by 7 makes it valid.

40. Assertion (A): A number ending in 7 gives `num % 10 == 7`.
Reason (R): Modulo 10 extracts the last digit (units place) of an integer.

41. Assertion (A): `age >= 18` checks if a person is eligible to vote.
Reason (R): In India, citizens aged 18 and above possess voting rights.

42. Assertion (A): `length == breadth` tests if a rectangle is a square.
Reason (R): A square is a special rectangle with all four equal sides.

43. Assertion (A): The condition `if (a > b && a > c)` finds if `a` is the smallest of three numbers.
Reason (R): Greater-than operator (`>`) combined with `&&` ensures `a` is strictly larger than both `b` and `c`.

44. Assertion (A): Multiple `if` statements check conditions independently.
Reason (R): Independent `if` statements do not bypass subsequent checks like `if...else if` does.

45. Assertion (A): Nested `if` means placing an `if` statement inside another `if` block.
Reason (R): Inner `if` statements execute only when the outer `if` condition evaluates to true.

46. Assertion (A): `ch >= 'A' && ch <= 'Z'` verifies an uppercase alphabet.
Reason (R): Uppercase letters in Java/ASCII lie sequentially between 'A' and 'Z'.

47. Assertion (A): The expression `a % b == 0` checks if `a` is fully divisible by `b`.
Reason (R): Zero remainder indicates exact divisibility.

48. Assertion (A): Logical NOT `!` flips `true` to `false`.
Reason (R): Unary NOT operator reverses the logical state of its operand.

49. Assertion (A): BlueJ allows writing and executing Java programs.
Reason (R): BlueJ is an Integrated Development Environment (IDE) designed for learning Java.

50. Assertion (A): Indentation inside `if` blocks is strictly mandatory for BlueJ to compile.
Reason (R): Java uses curly braces `{}` to define blocks; indentation improves human readability.

51. Assertion (A): `1 = 1` is valid syntax inside an `if` condition.
Reason (R): `1 == 1` is required because `=` assigns values rather than comparing them.

52. Assertion (A): Non-zero numbers are automatically treated as true in Java conditional checks.
Reason (R): Java strict typing enforces explicit boolean expressions inside `if(...)` statements.

53. Assertion (A): `if (score >= 40) result = "Pass"; else result = "Fail";` is valid.
Reason (R): Single-statement `if-else` blocks do not strictly require curly braces `{}`.

54. Assertion (A): Checking 3 ages to find the oldest requires comparing pairs using relational operators.
Reason (R): Logical operators combine pair comparisons into single conditional expressions.

55. Assertion (A): An `else` block can exist independently without an `if` statement.
Reason (R): `else` defines alternative execution strictly paired with a preceding `if` condition.

56. Assertion (A): `a == b` and `a != b` produce opposite boolean results for any values.
Reason (R): `!=` represents logical NOT equal to operator.

57. Assertion (A): `if...else if` ladders are useful for grading systems.
Reason (R): Marks fall into continuous ranges requiring sequential condition testing.

58. Assertion (A): Executing a program with static inputs tests all conditional branches.
Reason (R): Testing different branches requires providing varied sample inputs that trigger each path.

59. Assertion (A): Real-life situations like traffic light signals utilize conditional decision logic.
Reason (R): Action rules depend on traffic light color: If red stop, else go.

60. Assertion (A): Logical operators simplify complex decision conditions.
Reason (R): They allow combining multiple sub-conditions without writing deep nested `if` statements.

Section C: Visual & Scenario Based Questions (10 Marks)

61. Identify the logic rule visual:
If today is Sunday ➔ sleep till 9 am
Else ➔ wake up at 6:30 am
What time will you wake up on Wednesday?

A) 9:00 am
B) 6:30 am
C) 8:00 am
D) 7:00 am

62. Observe the real-life decision visual:
If homework complete ➔ go out to play
Else ➔ finish homework first
If your homework is incomplete, what action should you take?

A) Go out to play
B) Finish your homework first
C) Watch TV
D) Sleep immediately

63. Look at the traffic light rule visual:
If traffic light is red ➔ stop
Else ➔ go
What do you do when the traffic light turns green?

A) Stop
B) Go
C) Wait for red
D) Turn off engine

64. Scenario Visual: Rashmi writes code to check temperature:
if (temp < 0) { System.out.println("Freezing point"); }
What is printed if `temp` equals `-5`?

A) Freezing point
B) Normal temperature
C) Hot
D) Nothing

65. Scenario Visual: Mohit designs game bonus logic:
if (score > 50) { bonus = 10; }
What bonus is awarded if `score` equals `65`?

A) 0
B) 10
C) 50
D) 65

66. Identify the reward points lookup table visual:
Points Range 81-100 ➔ Certificate + Trophy
Points Range 61-80 ➔ Certificate Only
If a student earns 85 points, what reward is granted?

A) Certificate + Trophy
B) Certificate Only
C) Total Gift
D) Needs Improvement

67. Observe the weather decision rule:
If raining ➔ take umbrella
Else ➔ wear sunglasses
If the sky is clear and sunny today, what action is selected?

A) Take umbrella
B) Wear sunglasses
C) Stay indoors
D) Wear raincoat

68. Identify the grading rule visual:
If score > 80 ➔ get chocolate
Else ➔ get smiley sticker
What reward do you get if you score 85?

A) Chocolate
B) Smiley sticker
C) Trophy
D) Nothing

69. Look at the code snippet layout:
if (a % 2 == 0) System.out.println("Even");
else System.out.println("Odd");
If `a = 14`, what is displayed?

A) Even
B) Odd
C) 14
D) 0

70. Identify the mapping chart visual:
Input: 1 ➔ Monday
Input: 7 ➔ Sunday
Which conditional structure converts numbers 1 to 7 into weekday names?

A) if...else if...else ladder
B) Sequential print statements
C) Simple addition
D) Multiplication table
Created by Bijan Krishna Paul

No comments:

Post a Comment