• 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/15

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;

15 Cards in this Set

  • Front
  • Back
What is the following statement?

double Process (double a, double &b);

a. This is not a valid C++ statement
b. It is the invocation of the function Process
c. It is the prototype of the function Process
d. It is a variable declaration
c. It is the prototype of the function Process
What will be displayed by the following statements?

int x = 6, y = 7;
x += y;
cout << x << “ , “ << y;
a. 6 , 7
b. 13 , 7
c. 6 , 13
d. 13 , 13
e. None of above
b. 13 , 7
What will be stored in n by the following statements?
int n;
n = 17 + 10 / 7;
a. 18
b. 3
c. 6
d. 3.857..
e. 18.428..
a. 18
Evaluate: 20 % 3

a. 0
b. 6
c. 3
d. 2
e. 6.666…
d. 2
Given:
void change(int &q)
{
q = q + 10;
}
What is the right invocation of above function from main( )? Assume that int n = 10; is declared in main() and the goal is to increment n by 10.
a. change( n );
b. change( &n );
c. change( &q );
d. n = change( q );
e. n = change();
a. change( n );
What will be displayed by the following code?

int k = 0;
while(k <= 10)
{
k++;
}
cout << k << endl;

a. Numbers 0 to 9 will be displayed.
b. Results in an infinite loop
c. 9
d. 10
e. 11
e. 11
Assume that N is declared as int, and a value is stored in it. How would you check whether N is between 0 and 10 (both inclusive)?

a. if (N >= 0 &&N <= 10) // N is in valid range
b. if (N >= 0 || N <= 10) // N is in valid range
c. if (N > 0 && N < 10) // N is in valid range
d. if (N < 0 && N > 10) // N is in valid range
e. if (N < 0 || N > 10) // N is in valid range
a. if (N >= 0 && N <= 10) // N is in valid range
What is the operator for equality in C++?
a. eq
b. =
c. !=
d. ==
e. ||
d. ==
What is the output of the following code?

int n = 10;
if (++n > 10 )
cout << “ I am not sure!”;
else
cout << “ I am sure!”;

a. I am not sure!
b. I am sure!
c. Results in syntax error!
d. None of above!
a. I am not sure!
What will be displayed by the following code?

int x = 5;
int y = 4;
x *= y + 2;
cout << x << endl;

a. 30
b. 22
c. 5
d. 11
e. None of above
a. 30
Given: int score; Assume that the valid score must be between 0 to 100 (including 0 and 100) and a value has been stored in score. Which statement checks for invalid range? [ e.g.: -1 or 107 would be invalid]
a) if (score < 0 || score > 100) // out of range
b) if (score < 0 || > 100) // out of range
c) if (score <= 0 || score >= 100) // out of range
d) All of above
e) if (score >= 0 && score <= 100) // out of range
a) if (score < 0 || score > 100) // out of range
Assume that the purpose of the program is to add up all the odd numbers between 0 and 100. Fill in the blanks:
int n;
int sum = 0;
for (...; ...; ...)
{
sum += n;
}

a) n = 1; n + 2; n <= 100
b) n = 1; n <= 100; n + 2
c) n = 1; n <= 100; n += 2
d) n = 1; n <= 100; n++ 2
e) b or c
c) n = 1; n <= 100; n += 2
Given: int a, b; Assume that some values are stored in a and b. Evaluate the following condition:

(a <= b) || (b <= a)
a) True
b) False
c) Unknown
d) Depends on the values stored in a and b
a) True
What will be displayed by the following segment of code?
int option = 7;
switch(option)
{
case 1: cout << “Purdue” << endl;
break;
case 2: cout << “Michigan” << endl;
break;
case 3: cout << “IU” << endl;
break;
default: cout << “IUPUI” << endl;
e. IUPUI
What will be displayed by this segment of code?
int score = 95;
if (score < 60)
cout << “ You got an F” << endl;
cout << “ Work harder!”;
a) You got an F
b) You got an F followed by: Work harder!
c) Work harder!
d) Nothing
c) Work harder!