Paper Tayyari

Lecture 5: Decisions

MCQs, short and long questions from lecture 5.Lecture 5 ki MCQs, short aur long sawal.

3 MCQs · 3 MCQs from past papers3 MCQs · 3 MCQs past papers se

Start mock testMock test shuru karein
DoneHal kiye 0/3
– correctsahi
1.
★ Final term solved MCQs (Moaaz & Asad)

In if structure the block of statements is executed only,

  1. AWhen the condition is false
  2. BWhen it contain arithmetic operators
  3. CWhen it contain logical operators
  4. DWhen the condition is true

The if block runs only when its condition evaluates to true.

2.
★ Past paper collection

What will be the value of variable "input" if the initial value of input is 67? if(input >= 50) input = input + 1; if(input <= 75) input = input + 2; else input = input - 1;

  1. A68
  2. B69
  3. C70
  4. D66

67 >= 50 gives 68; 68 <= 75 adds 2, giving 70.

3.
★ Past paper collection

When the if statement consists more than one statement then enclosing these statement in curly braces is,

  1. ANot required
  2. BGood programming
  3. CRelevant
  4. DMust

Without braces only the first statement belongs to the if.