TRUE /FALSE 1. The symbol = is the C equality operator. 2. The following decisio
ID: 3626621 • Letter: T
Question
TRUE /FALSE1. The symbol = is the C equality operator.
2. The following decision structure is invalid:
if ( x <= y)
printf("%lf", x);
else
printf("%lf", y);
3. Conditions are said to be mutually exclusive if at most one condition can be true at a time.
4. A compound statement is a sequence of statements enclosed in {} braces.
5. The following program segment gives x and y the same value if the condition is true:
if (x > y) {
y = x;
x = y;
}
OBJECTIVE QUESTION
1. For what exact range of values of variable x does the following code segment display the letter 'C'?
if (x <= 200)
if (x < 100)
if (x <= 0)
printf("A ");
else
printf("B ");
else
printf("C ");
else
printf("D ");
a. 0 < x < 100
b. x <= 0
c. 100 <= x <= 200
d. x > 200
e. 100 < x <= 200
2. The effect of the following program segment can best be described as __________.
if (x > y)
z = x;
if (x == y)
z = 0;
if (x < y)
z = y;
a. The smaller of x and y is stored in z.
b. The larger of x and y is stored in z.
c. The larger of x and y is stored in z unless x and y are equal, in which case z is assigned zero.
d. The larger of x and y is stored in z unless x and y are not equal, in which case z is assigned zero.
e. none of the above
3. If the input to the program segment at the right is 85, what is its output?
scanf("%d", &d);
if (s >= 90)
printf("A ");
else if (s >= 70)
printf("C ");
else if (s >= 80)
printf("B ");
else
printf("D ");
a. A
b. B
c. C
d. D
e. A & B
Explanation / Answer
TRUE /FALSE
1. The symbol = is the C equality operator. TRUE
2. The following decision structure is invalid:
if ( x <= y)
printf("%lf", x);
else
printf("%lf", y); FALSE
3. Conditions are said to be mutually exclusive if at most one condition can be true at a time. TRUE
4. A compound statement is a sequence of statements enclosed in {} braces. TRUE
5. The following program segment gives x and y the same value if the condition is true:
if (x > y) {
y = x;
x = y;
} TRUE
OBJECTIVE QUESTION
1. For what exact range of values of variable x does the following code segment display the letter 'C'?
if (x <= 200)
if (x < 100)
if (x <= 0)
printf("A ");
else
printf("B ");
else
printf("C ");
else
printf("D ");
a. 0 < x < 100
b. x <= 0
c. 100 <= x <= 200 this ans.
d. x > 200
e. 100 < x <= 200
2. The effect of the following program segment can best be described as __________.
if (x > y)
z = x;
if (x == y)
z = 0;
if (x < y)
z = y;
a. The smaller of x and y is stored in z.
b. The larger of x and y is stored in z.
c. The larger of x and y is stored in z unless x and y are equal, in which case z is assigned zero. this is ans.
d. The larger of x and y is stored in z unless x and y are not equal, in which case z is assigned zero.
e. none of the above
3. If the input to the program segment at the right is 85, what is its output?
scanf("%d", &d);
if (s >= 90)
printf("A ");
else if (s >= 70)
printf("C ");
else if (s >= 80)
printf("B ");
else
printf("D ");
a. A
b. B
c. C this is ans.
d. D
e. A & B
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.