Question 22 (1 point) What is the result of the following expression: floor(765.
ID: 3912704 • Letter: Q
Question
Question 22 (1 point)
What is the result of the following expression:
floor(765.4321 * 10 + .5) / 10
Question 22 options:
Save
Question 23 (1 point)
What is the result of the following expression?
fabs(7.5)
Question 23 options:
Save
Question 24 (1 point)
What is the result of the following expression?
fabs(-7.5)
Question 24 options:
Save
Question 25 (1 point)
What is the result of the following expression?
floor(7.5)
Question 25 options:
Save
Question 26 (1 point)
What is the result of the following expression?
floor(-7.5)
Question 26 options:
Save
Question 27 (1 point)
What is the result of the following expression?
ceil(7.5)
Question 27 options:
Save
Question 28 (1 point)
What is the result of the following expression?
ceil(-7.5)
Question 28 options:
Save
Question 29 (1 point)
What is the result of the following expression?
n = rand() % p
Question 29 options:
0 <= n <= p
0 <= n < p
0 < n <= p
0 < n < p
Save
Question 30 (1 point)
The function _________________ is used to set the random number seed to randomize the program. (Put just the function name, no parenthesis or spaces)
Question 30 options:
Save
Question 31 (1 point)
int x = 0;
while (x < 10) {
cout << x;
x++;
}
What is the first thing printed by the above code?
Question 31 options:
-1
0
1
2
Nothing is printed
Save
Question 32 (1 point)
int x = 0;
while (x < 10) {
cout << x;
++x;
}
What is the first thing printed by the above code?
Question 32 options:
-1
0
1
2
Nothing is printed
Save
Explanation / Answer
Floor function: Floor(x) determines largest integer less than or equal to x.
Ceil(x): Ceil(x) is smallest integer greater than or equal to x.
Fabs(x): Fabs(x) gives absolute value of x.
Answer 22. floor(765.4321 * 10 + .5) / 10
= floor( 76.54321 + 0.5)/10
= floor(77.04321)/10
= 77/10 = 7.7
Answer 23. fabs(7.5)
= 7.5
Answer 24. fabs(-7.5)
= 7.5
Answer 27. floor(-7.5)
= -8
Answer 28. ceil(-7.5)
= -8
Answer 29. n= rand()%p
rand() function is used to give random values.
The result of expression will be random value modulus the value of p.
It will be 0<=n<=p. Since, modulus can be 0 and equal to p.
Answer 30. The function rand is used to set the random number seed to randomize the program.
Answer 31.
int x = 0;
while (x < 10) {
cout << x;
x++;
}
First thing printed by above code is 0. Since, while condition is true and print statement is immediately below while statement.
Answer 32.
int x = 0;
while (x < 10) {
cout << x;
++x;
}
First thing printed by above code is 0. Since, while condition is true and print statement is immediately below while statement.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.