Select the correct function definition (NOT prototype) from the list below.
A -
void intro();
B -
double sin(double rad);
C -
int foo(int bar; double baz)
D -
double pow(double num, int pow);
2-
Cout can print multiple values or variables in a single command using the following syntax:
A -
cout << "Hi" + bob + "\n";
B -
cout << "Hi" << bob << "\n";
C -
cout << "Hi", bob, "\n";
D -
cout << ("Hi" & bob & "\n");
3-
Write a for loop that counts from 0 to 5.
A -
for (c = 0; c <= 5; c++)
B -
for (int c = 0; c <= 6; c++)
C -
for (c = 0; c < 5; c++)
D -
for (c = 0; c < 5; c++);
4-
What does the statement #include do ?
A -
It defines the function iostream.h
B -
It tells the compiler where the program begins
C -
It defines the words TRUE and FALSE
D -
It allows the programmer to use cout << It defines the statement return
5-
Which of the following converts an integer "value" to its ASCII equivalent ?
A -
atoi(value)
B -
cout << value
C -
(char) value
D -
char (value)
6-
Indicate which data type is not part of standard C++.
A -
bool
B -
int
C -
real
D -
double
7-
Which one of the choices would produce the following output ?
A -
cout << "Hello" << "World";
B -
cout << "Hello \n World";
C -
cout << "Hello World\n";
D -
cin >> "Hello World";
8-
What is the output of the following code?
for (int i=0; i<10; i++); cout << i%2 << " "; }
A -
0 1 2 3 4 5 6 7 8 9
B -
0 2 4 6 8 10 12 14 16 18
C -
1 0 1 0 1 0 1 0 1 0
D -
0 1 0 1 0 1 0 1 0 1
9-
What is the output of the following code?
for (int a = 1; a <= 1; a++) cout << a++; cout << a;
A -
22
B -
12
C -
error
D -
23
10-
For which values of the integer _value will the following code become an infinite loop?
int number=1;
while (true) {
cout << number;
if (number == 3) break;
number += _value; }