stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Revision_Quiz2_C++ Flashcards | StudBud
Explore
/
Revision_Quiz2_C++
Revision_Quiz2_C++
14 terms
·
StudBud Administration
·
196 plays
Imported from external platform
Flashcards
14 cards
F
Practice quiz
P
Host live
L
Questions
14
Answers
1
What is the value of y in the given C++ code?
3
5
6
4
2
Which C++ header is used for mathematical functions such as
sqrt()
and
sin()
?
<cctype>
<cmath>
<iostream>
<cstdlib>
3
What is the
output
of the given C++ code ?
10
15
30
25
4
When is the loop body of a
do-while
statement
executed
?
It is executed at least once
It is executed only if the condition is false.
It is executed at least twice
It is executed only if the loop variable reaches a specific value
5
What is the value of
y
in the given C++ code?
3
5
2
4
6
If you have a function named
calculateSum()
that
returns
an
integer
, how do you
call
it and use its result?
calculateSum();
result = calculateSum;
void calculateSum();
int result = calculateSum();
7
To use the
rand()
function, which header must be included in the C++ program?
<cstring>
<cstdlib>
<iostream>
<cmath>
8
What is the primary purpose of the
rand()
function in C++?
Generating random integers
Mathematical calculations
String manipulation
Input and output operations
9
What is the output of the given C++ code?
5
2
4
3
10
What is the primary purpose of the
srand()
function in C++?
To specify a range for random numbers
String manipulation
Mathematical calculations
To initialize the random number generator
11
What is the output of the given C++ code ?
5
15
30
3
12
In the following C++ code , how many iterations will the loop execute?
5
0
1
It will run indefinitely
13
Which header must be included in a C++ program to use the
isupper()
and
islower()
functions?
<cctype>
<iostream>
<cstdlib>
<cstring>
14
Which keyword is used to define a function that does
not
return a value in C++?
float
return
void
int