CS201-Introduction to Programming Quiz No.1 Solutions and Discussions

Question # 1 of 10 Total Marks: 1
< and > both are _________ operators.
Arithmetic
Relational
LogicalPG 258
Mathematical

Question # 2 of 10 Total Marks: 1
Find out the logical error in following lines of code. If (x = 10) cout “x is 10”;
10 should be enclosed in quotations
There is no semicolon at the end of if condition
Assignment operator should not be used for Comparison
Variable x should not be inside parenthesis

Question # 3 of 10 Total Marks: 1
What will be the result of the expression j = i++; if initially j = 0 and i = 5?
0
5
6
4

Question # 4 of 10 Total Marks: 1
Default mechanism of calling a function by passing it array is call by ________ and in case of passing variable is call by ________.
Reference, Reference
Reference,valuePG154, 119
Value, Reference
Value, Value

Question # 5 of 10 Total Marks: 1
When the break statement is encountered in a loop’s body, it transfers the control ________from the current loop.
Inside

Outside
To break statement
To continue statement

Question # 6 of 10 Total Marks: 1
________statement is used to terminate the processing of a particular case and exit from switch structure.
If
Goto
Break
Continue


Question # 7 of 10 Total Marks: 1
When the if statement consists of more than one statement then enclosing these statement in braces is _________.
Compulsory
Optional
Not required
Relevant

Question # 8 of 10 Total Marks: 1
What will be the value of the variable output in the given piece of code? double output = 0; output = (2 + 2) * 4 + 2 / (4 – 2);
15
17
12
1

Question # 9 of 10 Total Marks: 1
If we assign 2.06721 to an integer variable x, what will be the output if we print x using cout statement?
2
2.1
2.06
2.07

Question # 10 of 10 Total Marks: 1
__________ will be used for clarity and to force the order of evaluation in an expression.
" "
()PG32
' '
[]

Sponsored Links

Right Options:

1-Logical

2-Assignment operator should not be used for Comparison

3-5

4-Reference,value

5-Outside

6-Break

7-Compulsory

8-17

9-2

10-()