• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/20

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

20 Cards in this Set

  • Front
  • Back
Declare a variable to store the letter grade of a student.

int grade;
short grade;
char grade;
All of above
bool grade;
char grade;
What will be stored in x by the following?
float x;
x = (1 / 2)* 13;

0
7.5
6
6.5
0
What is the standard output object in C++?
cin
cout
output
print
cout
What is the outcome of 45 % 2 ?
0
1
22
23
22.5
1
3. What is pre-processor?

It prepares the program for compilation.
It is the same as the compiler.
It is the main function
It is the name space needed to do standard I/O.
It prepares the program for compilation.
What will be stored in sum?

int m, n, sum = 0;
m = 12;
n = 10;
m > n ? sum = m + n : sum = m – n;

22
120
2
0
none of above.
22
What will be displayed by:
int n = 10;
int m = 12;
if(n >= 10)
cout << “good!”;
else if (m >= n)
cout << “bad!”;
else
cout << “OK”;

good!
bad!
OK
good! And bad!
good!
What will be stored in c by:
Assume that:
int a, b, c = 0;
a = 5;
b = 8;
c = b * a++;

40
45
48
0
40
What will be displayed by:
int grade = 72;
if (grade >= 90)
cout << “Congratulations! \n”;
cout << “You got an A!! \n”;

Nothing
Congratulations! , You got an A!!
You got an A!!
Congratulations!
Results in error.
You got an A!!
Which statement will read a value into integer variable data?

a) cout << data;
b) cin << data;
c) cin >> data;
d) cin >> data >> endl;
e) read >> data;
c) cin >> data;
What will be displayed?

int n, sum = 0;
for (n = 0; n <= 10; n++)
sum = sum + n;

cout << n << endl;

Sum of numbers 0 to 10
0
10
1
None of above
None of above
Fill in the blank. The goal is to keep prompting the user, until the user enters a positive number > 0.
int num;
do {
cout <<“Enter a positive number:”;
cin >> num;
} while (----------);

num <= 0
num < 0
num > 0
num >= 0
num != 0
num <= 0
What will be displayed by: (careful!!)
int n = 100;
int sum = 0;
do {
n = n + 10;
sum = sum + n;
} while (n <= 100);
cout << sum << endl;

Nothing
100
110
0
110
What is the outcome of this code?
int n, sum;
n = 1;
sum = 0;
while (n >= 10)
{
sum = sum + n;
n++;
}
a) Will add up all the numbers from 1 to 10 in sum.
b) This is an infinite loop!
c) The loop will not execute at all!
d) None of above
c) The loop will not execute at all!
What will be displayed by:
int n, sum = 0;
for (n = 0; n <= 10; n += 3)
{
cout << n << endl;
}


0, 1, 2, 3, … 10
0, 3, 6, 9
0, 3, 6, 9, 12
0, 3, 6, 9, 10
1, 4, 7, 10
0, 3, 6, 9
Consider the Employee class explained in Lab09. Declare an employee object Jim of this class.

Employee Jim;
Employee emp;
class Employee Jim;
String Jim;
Employee Jim;
In inheritance
The child class inherits all the private members of the parent.
The child class inherits all the public members of the parent.
The child class may have its own data members.
The child class may have its own methods.
all of above!
all of above!
3) Assume that class B is derived from class A. What can you say about these classes?

A is the parent class
B is the child class
B is an A
A is a B
a, b, and c
a, b, and c
4. Given the class Animal, and the following declarations:
Animal lion;
Animal * ptr;
Which statement makes ptr, point to lion?
ptr = &lion;
ptr = *lion;
ptr = lion;
Ptr -> lion;
ptr = &lion;
Consider the Animal class. Declare an array zoo to store 50 animal objects.

string zoo[50];
int zoo[5];
Animal [] zoo;
Animal zoo[50];
None of above.
Animal zoo[50];