Chapter-11(Decision Constructs)
1
|
If
x = 10 and y = 5, what will the output of the following expression? x > y
? x * y : x + y;
|
|||
|
5
|
10
|
15
|
50
|
2
|
Conditional
operator is an alternative of:
|
|||
|
If
|
If-else
|
Nested if
|
None
|
3
|
Which
of the following is used for making two way decision:
|
|||
|
If-else
|
If
|
Nested if
|
Switch
|
4
|
Conditional
operator takes:
|
|||
|
Three operands
|
Two operands
|
One operands
|
None
|
5
|
The
case block ends with:
|
|||
|
End Select
|
End Case
|
break;
|
else
|
6
|
In
if statement, true is represented by:
|
|||
|
0
|
1
|
2
|
3
|
7
|
Which
of the following statements is the simplest form of a decision structure?
|
|||
|
Select….case
|
If statement
|
Try… catch…finally
|
Nested if
|
8
|
When
a relational expression is false,it has the value ……… .
|
|||
|
Zero
|
One
|
Less than 0
|
None
|
9
|
Which
programming structure executes program statements in order?
|
|||
|
Relation
|
Decision
|
Sequence
|
Repetition
|
10
|
Another
term for a computer making a decision is:
|
|||
|
Sequential
|
Selection
|
Repetition
|
Iteration
|
11
|
Relational
operators allow you to …… numbers.
|
|||
|
Compare
|
Add
|
Multiply
|
Divide
|
12
|
Which
of the following is equalent to (p > = q)?
|
|||
|
p<q
|
!(p<q)
|
p>q
|
!p<q
|
13
|
Which
of the following are valid case statements in a switch?
|
|||
|
case 1:
|
case x<4:
|
case ‘ab’;
|
case 1.5:
|
14
|
In
statement, false is represented by:
|
|||
|
0
|
1
|
2
|
3
|
Q-2: Write short answers any TEN, each question carry
2 marks. 2x10=20
i.
Define control structure.
ii.
Write the names of control structure.
iii.
Describe types of selection strure.
iv.
Draw the flow char of if statement.
v.
Which is the basic control structures for writing a program?
vi.
What
is output of the following code?
if (5/2==1)
printf (“My Program is running\n”);
else
printf(“My Program is running????\n”);
vii.
Write three selection and three repetition statements.
viii.
Describe sequence structure.
ix.
Write the syntax of “if-else” statement.
x.
Write the alternative of if-else statement.
xi.
Why break statement is used in a switch () structure?
xii.
Write three advantages of switch statements.
xiii.
Explain “if” statement.
Q-3: Write detail answers any 2 from the
following questions. 2x8=16
·
Write
a program the inputs radius. It calculates area of a circle. Is user enters 1
as choice. It calculates circumference if the user enters 2 as choice.
·
Write
a detail note on types of control structure in C language.
·
What
is nested “if” statements? Explain its working with example.