17. Which if statement would be true if you needed to see if x (an int) is betwe
ID: 3558351 • Letter: 1
Question
17. Which if statement would be true if you needed to see if x (an int)
is between 0 and 50 inclusive?
A. if( x >= 0 && x < 50 )
B. if( x >= 0 && x<= 50 )
C. if( x >= 0 || x <= 50 )
D. if( x > 0 && x < 50 )
18. Which if statement would be true if you needed to see if x (an int)
was either 1 or 2?
A. if ( x == 1 || 2 )
B. if ( x =1 || 2 )
C. if ( x == 1 && x == 2 )
D. if( x == 1 || x == 2)
19. Which if statement would be true if you needed to see if x (an int)
was less than 5 and y (an int) was greater than 7?
A. if ( x < 5 || y > 7 )
B. if ( x < 5 && y > 7 )
C. if ( x <= 5 || y >7 )
D. if( x < 5 && y < 7)
20. What is the output of this program?
int x = 10, y = 12;
if(x > y)
{
cout<<
Explanation / Answer
1) B
2)D
3)B
4)D
5)A
6)B
7)A
8)C
9)C
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.