|
|
Computer Science and C++ Quiz Answers, Page 5
| |
Question #41 What does the following code do?
void afunction(int *x)
{
x=new int;
*x=12;
}
int main()
{
int v=10;
afunction(&v);
cout<<v;
}
Outputs 12 Outputs 10
Outputs the address of v
Question #42
To what value do nonglobal variables default?
auto
register
static
Question #43
Which header file allows file I/O with streams?
iostream fstream
fileio.h
Question #44
What is the outcome of the line of code "cout<<abs(-16.5);"?
16
17
16.5
Question #45
What value will "strcmp("Astring", "Astring");" return?
A positive value
A negative value Zero
|
Question #46 Evaluate !(1&&1||1&&0)
Error
True False
Question #47
What header file is needed for the function exit()?
stdlib.h
conio.h
dos.h
Question #48
What ANSI C++ function clears the screen?
clrscr()
clear() There is no function, defined by the ANSII C++ standard, which will clear the screen
Question #49
When run on a computer, will a recursive function without an end condition ever quit?
Compiler-Specific (Some compilers can convert these functions to infinite loops)
No
Yes
Question #50
How long does the following code run?
for(int x=0; x=3; x++)
Never
Three times Forever
|
|
|
Answers index
|
|