stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Quiz #1 Flashcards | StudBud
Explore
/
Quiz #1
Quiz #1
10 terms
·
StudBud Administration
·
17 plays
Imported from external platform
Flashcards
10 cards
F
Practice quiz
P
Host live
L
Questions
10
Answers
1
How do you declare an array in C++ with 10 elements of type int?
c) int array{10};
d) int array = 10;
a) int array[10];
b) int array(10);
2
What does the 'cout' object do in C++?
c) Performs mathematical operations
b) Prints output to the console
d) Reads from a file
a) Accepts user input
3
What happens if the condition of a "while" loop in C++ is initially false?
a) The loop runs indefinitely.
c) The loop body is skipped, and the program proceeds
d) An error occurs, and the program crashes.
b) The loop runs once and then terminates.
4
Which of the following is the correct syntax for the main function in C++?
void Main()
int main()
mainFunction()
int Main()
5
What is the output of the following code snippet?
b) 2.5
d) 0
a) 2
c) 1
6
Which loop is used to execute a block of code as long as the condition is true in C++?
a) for loop
c) do-while loop
d) switch loop
b) while loop
7
What is the symbol used for single-line comments in C++?
c) #
a) //
d) --
b) /*
8
What does the 'sizeof' operator in C++ return?
a) Size of the variable
c) Memory address of the variable
b) Size of the data type
d) Number of elements in an array
9
Which header file is needed to use input/output operations in C++?
c) math.h
d) string
b) stdlib
a) iostream
10
Which keyword is used to indicate the end of a function in C++?
d) return
b) stop
c) finish
a) end