I need help with my assignment.... this is way to difficult and don't understand.

I dont understand the following questions, I put a "-" next to the answers that I beleive are correct, I would just like some assistance on them, and maybe a summary or explaination. Would be helpful, thanks!


1.What is the output of the following C++ code?

num = 20;
while (num > 20)
num = num - 1;
cout << num << endl;

A: 18
B:0
C:20 -
D:16
-------------------------------------------------------------
2.Suppose that ch1 and ch2 are char variables and the input is:

ABCD

What is the value of ch2 after the following statements execute?

cin.get(ch1);
cin.putback(ch1);
cin >> ch2;

1: A
2:B -
3:D
4:C
-------------------------------------------------------------
3.What is the return type of the function operator ==?

A:void

B:int

C:char

D:bool
-------------------------------------------------------------
4.What is the output of the following code?

stackType stack;
int x, y;

x = 9;
y = 3;
stack.push(8);
stack.push(x);
stack.push(x + 1);
y = stack.top();
stack.pop();
stack.push(x + y);
x = stack.top();
stack.pop();

cout << ""x = "" << x << endl;

A:x = 12

B:x = 15

C:x = 19

D:x = 22 -
------------------------------------------------------------
5.To sort a list of length 500, bubble sort makes about how many item assignments?

A:"500,000" -

B:"11,000"

C:"124,000"

D:"62,000"
-------------------------------------------------------------
6.What is a variable or expression listed in a call to a function?

A:data type

B:type of the function

C:formal parameter

D:actual parameter -
-------------------------------------------------------------
7.Which of the following monitors the overall activity of the computer and provides services?

A:operating system -

B:central processing unit

C:arithmetic logic unit

D:computer application
-------------------------------------------------------------
8.If the derived class classA overrides a public member function functionName of the base class classD, then to specify a call to that public member function of the base class you use the statement ____.

A:classD.functionName();

B:classA::functionName();

C:classD::functionName(); -

D:classA.functionName();
-------------------------------------------------------------
9.What is the value of z after the following statements execute?

int z = 10;
int *p;
p = &z;
*p = 12;

A:null

B:10

C:12 -

D:0
---------------------------------------------------------------
10.The following expression (a + b) * (c - d) is equivalent to which of the following postfix expressions?

A:a b c d - + *

B:c d + a b - *

C:a b + c d - *

D:a b - + c d *

If anyone could help me that would be awesome. I got some more but I believe I understand them, if not, I will create another thread. Thanks!
another assignment that makes no sense...

1. Suppose that inventory is an array of 50 components of type int. Which of the following correctly initializes the array inventory?

A:for (int j == 1; j <= 49; j++)
inventory[j] = 0.0;

B:for (int j = 0; j <= 49; j++)
inventory[j] = 0;

C:for (int j = 1; j <= 50; j++)
inventory[j] = 0.0;

D:for (int j == 0; j <= 50; j++)
inventory[j] = 0;
----------------------------------------------------------------------
2.If the search item is the 500th item in the list, how many key comparisons does the sequential search make to find the search item?

A:125

B:500

C:50

D:250
-----------------------------------------------------------------------
3. What is the output of the following code?

enum courses {CALCULUS, FORTRAN, COBOL, RELIGION, HISTORY};
courses registered;
registered = FORTRAN;
cout << registered+1 << endl;

A:COBOL

B:1

C:FORTRAN

D:2
----------------------------------------------------------
4.Suppose that z is an int variable. Which of the following expressions always evaluates to true?

A:(z > 0) && ( z == 0)

B:(z >= 0) || ( z <= 0)

C:(z > 0) || (z == 0)

D:(z > 0) && (z >= 0)
-------------------------------------------------------------------
5. Consider the accompanying class definition, and the declaration:

ovalType smallOval;

Which of the following statements is correct?

A:smallOval.print();

B:ovalType:print();

C:ovalType.print();

D:smallOval:print();
------------------------------------------------------------------------
6. Which of the following is a valid C++ statement?

A:assert(divisor = 0);

B:assert(divisor is 0);

C:assert(0 += divisor);

D:assert(divisor == 0);
------------------------------------------------------------------------
7. What does every node (except of the last node) in a singly linked list contain?

A:the address of the next node

B:no address information

C:the next node

D:the address of the previous node
------------------------------------------------------------------------
8.Which of the following statements correctly initializes the component length of mySquare?

A:mySquare = {5};

B:mySquare(length)= 5;

C:mySquare.length = 5;

D:mySquare[0]= 5;
------------------------------------------------------------------------
9. Which of the following is an example of a floating point data type?

A:char

B:double

D:int

C:short
---------------------------------------------------------------------------
10. In what type of recursive function is the last statement executed the recursive call?

A:direct recursive

B:tail recursive

C:indefinite recursive

D:indirect recursive
Topic archived. No new replies allowed.