...
OOPS
August 29, 2024
OOPS
August 29, 2024
OOPS
August 29, 2024
OOPS
August 29, 2024

OOPS

Question 189
Consider the following two C++ programs P​ 1​ and P​ 2​ and two statements S​ 1​ andS​ 2​ about the programs :

S​ 1​ : P​ 1​ prints out 3
S​ 2​ : P​ 2​ prints out 4:2
What can you say about the statement S​ 1​ and S​ 2​ ?
A
Neither S​ 1​ nor S​ 2​ is true
B
Only S​ 1​ is true
C
Only S​ 2​ is true
D
Both S​ 1​ and S​ 2​ are true
Question 189 Explanation: 
The program p1 code consists of function with three parameters integer , pointer and reference variable.
The definition of the function first modifies “i” value by 2 and later by “3” and that modification of the value is automatically reflects in the main program as “c” is reference variable. The program code p2 will gives the output of 4:5 as the function will take reference variable as parameter and return type also reference object.
Correct Answer: B
Question 189 Explanation: 
The program p1 code consists of function with three parameters integer , pointer and reference variable.
The definition of the function first modifies “i” value by 2 and later by “3” and that modification of the value is automatically reflects in the main program as “c” is reference variable. The program code p2 will gives the output of 4:5 as the function will take reference variable as parameter and return type also reference object.

Leave a Reply

Your email address will not be published. Required fields are marked *