What would the values of z and w be after the call which of


Assignment

1. The result of 5 % 2 is:

1

0

2

3

2.The result of (5 * 5) / (5 * 6) is

0

0.803

25/30

1

3. The result of (2 + 5) / (3 - 1) is:

0

1

3

3.5

4. The result of (2.0 + 5) / (3 - 1) is:

2

3.5

0

1

5. In Excess 4, 101 would be:

-1

1

5

0

6. An AND gate is true if:

Both inputs are ture

Only one input is true

Neither input is true

There is no such thing as an AND gate

7. An OR gate is true if

Only one input is true

Both inputs are true

There is no such thing as an OR gate

Either input is true

8.A NOT gate is false

If the input is false

If the input is true

If there is no input

A NOT gate does not exist

9. The difference between ++i and i++ is:

Assuming i is an integer or character, ++i increments before the data in i is accessed. i++ increments after the data in i is accessed

Assuming i is an integer, ++i increments before the data in i is accessed. i++ increments after the data in i is accessed

There is no differnece

Assuming i is a character, ++i increments before the data in i is accessed. i++ increments after the data in i is accessed

10. Which of the following is not a C++ looping structure

For

While

DO-UNTIL

DO-WHILE

11. In a for statement, there are two semi-colons. In which area of a for loop does the testing occur?

Between the first semicolon and the second semicolon

The for loop does not do any tests

After the second semicolon

Before the first semicolon

12. if(x == 2 && y == 3)
{
//Do Something
}
The && stands for

OR

XOR

AND

NOT

13. What will the following print out:
int x = 1;
while(x = 1)
cout<

1

Nothing

There is syntax error in this.

A continuous sequence of numbers

14. If y = 5 and x = 2, what would the value of z be in
z = ++x - y--;

There is a syntax error

3

-2

2

15. Which of the following statements will cause a switch statement or a loop to terminate immediately?

break

stop

halt

continue

16. The continue statement causes a loop to

immediately go to the next iteration after completing the remaining steps in the loop

immediately go to the next iteration without completing the remaining steps in the loop

immediately terminate

This is not a C++ statement!

17. In order to stop one case in a switch to fall through to the next case, you would use the ________________ statement

default

continue

next case

break

18. switch statements can work on strings.

No, only the first character

Only integers can be used in a switch statement

There is no such statement in C++!

Yes, a complete string can be used

19. Given that a bit pattern stored in the variable x is 00000101, what will x = x>>1 do to this bit pattern?

It would make it 00000010

Nothing. This does not exist in C++!!

It would make it 00000001

It would make it 00001010

20. Which of the following escape characters will do the same thing as endl does?

\t

\b

\r

\n

21. Boolean expressions are evaluated similarily to the way arithmetic expressions are evaluated

True

False

22. A switch statement is not a good way to implement a menu for the user of your program

True

False

23. Indentation of code is required by the compiler in C++, and servers no useful purpose for the programmer.

True

False

24. Variables contained within a block, ie, starting with a { and ending with a } are global variables.

True

False

25. If an identifier is declared as a variable in each of two blocks, one within the other, then these are two different variables with the same name. One variable exists only within the inner block and cannot be accessed outside of the inner block. The other variable exists only in the outer block and cannot be accessed in the inner block. The two variables are distinct, so changes made to one of these variables will have no effect on the other of these two variables.

True

False

26. A block is some C++ code enclosed in braces. The variables declared in a block are local to the block and so the variable names can be used outside of the block for something else.

True

False

27. Which of the following has the highest precedence?

* (Multiply)

Unary minus

&&

==

28. The // is used for _______________

making a single line comment, or commenting at the end of a line

This is not part of C++!!!

marking the start of a multi-line comment

dividing doubles

29. Which of the follow will always execute the body of the loop at least once, regardless of the condition.

a switch statement

a for loop

a do-while loop

a while loop

30. Which of the following performs specific tasks for users:

File Manager

System Software

Application Software

The Kernal

31. Which of these is not normally associated with the functions of a kernel?

File Manager

Device Drivers

Memory Manager

GUI

32. May create the illusion that the machine has
more memory than it actually does by playing a "shell game" in which blocks of data are shifted back and
forth between main memory and mass storage describes which of the following?

Memory Management Device

Memory Manager

The Kernel

Virtual Memory

33. Which of the following controls the allocation of time slices to the processes in the process table

Dispatcher

GUI

Scheduler

Kernel

34. Which of the following is a requirement for proper implementation of a critical region

Memory Manager

Dispatcher

Mutual Exclusion

GUI

35. The following describes ______________ Problem Solving Steps
•1. Understand the problem.
•2. Devise a plan for solving the problem.
•3. Carry out the plan.
•4. Evaluate the solution for accuracy and its potential as a tool for solving other prob

Poyla

Apoly

Russian-style

Polya

36. An algorithm is an __________ set of unambiguous, executable steps that defines a terminating process.

large

unordered

small

ordered

37. Which of the following is NOT a network topology classification?

Ring

Bus

Star

Ethernet

38. Possession of token provides right to introduce new message in which of the following network topologys?

Token Bus

Star

Token Ring

Bus

39. CSMA/CD, in which a silent bus provides right to introduce new message, is used within:

Token Ring

Ethernet

Star Ring

Virtual Bus Connection

40. A bridge ____________

Connects two incompatible networks

Connects many networks together

Is the backbone of the internet

Connects two compatible networks

41. Functions in C++ can not call other functions.

True

False

42. Suppose a C++ program has three functions, each of them with a variable called x. Then

This cannot be done in C++

These three variables have different scope

These three variables have the same scope

Variables in C++ must be longer than a single character

43. If you do not wish to have a function prototype, then you must declare functions so that they appear alphabetically.

True

False

44. Functions in C++ must be declared in lower case.

True

False

45. In order to use the toupper C++ function, we must include

cstdlib

iostream

The answer does not appear here

iomanip

string

46. If you want a parameters value to keep any changes that occur to it within a function, the parameter must be passed

by reference

by mutable

by value

by changing

47. The scope of a variable created within a function is

only in main

all functions, but not the main

the entire program

only that function

48. The return statement causes a function to immediately end if it is used within a void function

Return statements cannot be used in void functions

True

False

There is no such thing as a return statement!

49. In order for a parameter to be passed by value, you put a(n) ________ in front of the parameter name

NOTHING

&

*

\

50. The type void for a function means that it will ____________

Not return a value

Is an empty function

is the function main

There is not such thing as void in C++

51. Suppose you have the function header
void sample(int x = 5, int y = 6, int z = 7);
Which of the following IS NOT a valid call to this function?

sample(1,,3);

sample(1,2);

sampe(3);

sample();

52. Suppose you have the function
void swap(int x, int y)
{
int temp = x;
x = y;
y = temp;
}

and then in main(), you have:
int z = 3, w =2;
swap(z,w);
What would the values of z and w be after the call?

z = 3, w = 2

z = 2, w = 3

z - 3, w = 3

z = 2, w = 2

53. void swap(int x, int &y)
{
int temp = x;
x = y;
y = temp;
}

and then in main(), you have:
int z = 3, w =2;
swap(z,w);
What would the values of z and w be after the call?

z = 3, w = 3

z = 2, w = 3

z = 2,. w = 2

z = 3, w = 2

54. If you wish a function's parameters to assume a new value that may or may not be assigned to them within the body of a function, you precede the parameter's name with a(n) _____________

^

&

%

*
55. The signature of a function is composed of the name of the function, and the ________________________ of parameters.

order, type, method of passing, and quantity

order, type, and quantity

method of passing

order and quantity

56. In order to read and write to a file, which header file is required?

istream

ostream

fstream

iostream

57. When passing a stream to a function, the stream must

must be closed

must be open

passed by reference

be passed by value

58. Functions in iomanip will not work with files

True

False

59. To reset an error flag on the stream in, you would use:

in.removeError()

in.close()

in.clear()

in.resetAll();

60. If you want to add data to an already existing file, you would open the file for output with the modifier

ios:app

app:ios

append

ios:append

61. In order to read and write to a file, which header file is required?

fstream

iostream

ostream

istream

ifstream

ofstream

62. Suppose that widget is a C++ string. In order to change the first character of widget to upper case, you would use ______________

toupper(widget(0))

toupper(widget)

toupper(widget{0})

toupper(widget[0])

63. Suppose that widget is a C++ string. And, suppose that you wish to take the fourth through eighth characters out of widget to make a new substring called miniWidget. Which of the following would you use?

miniWidget = widget.substr(4);

miniWidget = widget.substr(4,4);

miniWidget = widget.substr(3);

miniWidget = widget.substr(3,4);

64. Suppose that widget is a C++ string. What would you use to find out how many characters are in widget?

widget.numberOfCharacters()

widget.size()

widget.mySize()

widget.length()

65. Suppose that widget and miniWidget are C++ strings. Further suppose that widget contains the string "data" and that miniWidget contains ".txt". What would a string, called result, be if result = widget + miniWidet?

"data.txt"

datatxt

"data"".txt"

You cannot add strings together!!!

66. What is the result of 5 % 3 % 2 is:

Undefined

2

0

1

67. In order to open a file, which header is required?

iostream

ostream

istream

fstream

68. srand(time(NULL)) is what is used to "seed" the random number generator

True

False

69. The value returned from time(NULL) generally represents the number of seconds since 00:00 hours, Jan 1, ______ UTC

2000

1980

1990

1970

70. The value returned from time(NULL) generally represents the number of seconds since 00:00 hours, Jan 1, 1970 UTC

True

False

71. Assume that ss is a stringstream, and that line is a string that contains integers. Then:
int data;
while(ss>>data)
cout<Will print all of the integers in the stringstream

True

False

72. A stringstream stream can be used to convert a number stored in a string to an integer or a double.

True

False

73. Assume that ss is a file handle associated to a file that contains integers. Then:
int data;
while(ss>>data)
cout<Will print all of the integers in the file.

True

False

74. By default, getline uses the "\n" as the data separator.

True

False

75. In order to find the position of the last > in a string that is stored in the variable line, you would use:

find_last_of

find_first_of

Answer not present

find_first_not_of

76. In order to "cut out" a substring that is between a "<" and a ">" within a string, the first thing that you would have to do is find the position (pos) of the "<" and the position (pos2) of the ">". Then, if this were stored in a variable called line, you would then say:

Answer not present

newLine = line.substr(pos, pos2);

newLine = line.substr(pos2);

newLine = line.substr(pos);

newLine = line.substr(pos, pos);

77. By default, if you do not enter a second parameter into the substr function of a string, it gives you the remainder of the string as a new substring

True

False

78. If the name of a file is stored within the C++ string fileName, then you would use in.open(fileName);

True

False

79. In order to determine how many characters are in the string stroed in the string variable line, you can use either line.size() or line.length()

True

False

80. Suppose that you are looking for a semicolon within the string stored within the string variable line. If you do not find a semicolon, line.find(';') will return a value equal to or greater than the size of the string.

True

False

81. In order to access the 10th character in a string of 20 characters stored in the string variable line, you would use line[10];

True

False

82. By default, the erase function within C++ strings will erase the remaining part of the string if you do not give a second parameter to the function

True

False

83. If you wanted to see if a vector was empty, you would use:
if(list.clear())
{
// Do something
}

True

False

84. In order to delete all elements of a vector called list, you would use list.empty()

True

False

85. Vectors, like arrays, are always passed by reference

True

False

86. By default, arrays are always passed by value.

True

False

87. A recursive function, in order to stop the recursion, must have a base case.

True

False

88. Suppose that widget is a C++ string. And, suppose that you wish to remove the fourth through eighth characters out of widget to make a new substring called miniWidget, yet keep the original string "as is". Would you use the erase string function for this?

True

False

89. Concatenation of a character to a C++ string is possible

True

False

90. If you open a file for write, by default, it will erase any existing file by that name.

True

False

91. If you open a file in "append" mode, but the file does not already exist, this will cause an error to occur.

True

False

92. If you open a file for input, and the file does not exist, no error occurs.

True

False

93. If you open a file for input, and the file does not exist, than an error occurs.

True

False

94. File streams cannot use items from iomanip

True

False

95. String streams can use items from iomanip

True

False

96. The number of digits in an integer is one less than the log base 10 of the number

True

False

97. The iomanip setfill() needs to be "turned off." Meaning, it is set only for the output statement you are currently within.

True

False

98. In order to use setfill(), or any of the other items, you must include and be using cout only.

True

False

99. A byte is 16 bits.

True

False

100. In order to shift the value in an integer variaible x one bit to the left, you would use x <<= 1;

True

False.

Solution Preview :

Prepared by a verified Expert
Computer Engineering: What would the values of z and w be after the call which of
Reference No:- TGS02309778

Now Priced at $100 (50% Discount)

Recommended (96%)

Rated (4.8/5)