17. Which if statement would be true if you needed to see if x (an int) is betwe
ID: 3558350 • 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
17-
B. if( x >= 0 && x<= 50 )
18-
D. if( x == 1 || x == 2)
19-
B. if ( x < 5 && y > 7 )
20-
D. Nothing. The statement inside the braces will not execute.
21-
A. x is 5
22-
B. x is not 7
23-
B. Number is 1 or 2
24-
C. x is not 2
25-
B. It
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.