Folder101   Home Notes Quiz Assigns Info  
Forum Forum
101 Home 101
 
  C++ Level 2

Practice Quiz 2 - Input and Output Streams


There are 10 questions in this quiz

Question 1: Multiple Choice       

Which statement about the preprocessor is FALSE?

Choice 1 it can includes files indicated by the #include directive
Choice 2 it replaces constants with their real values
Choice 3 it compiles source code
Choice 4 it runs before the compiler

Question 2: Multiple Choice       

The #include directive:-

Choice 1 indicates a file to be included in the program
Choice 2 indicates that parts of the source code should not be compiled
Choice 3 indicates which parts of the source code should be compiled
Choice 4 includes a constant value

Question 3: Multiple Choice       

When angle brackets are used with the #include directive, this indicates:-

Choice 1 the file to be included can be located in the project folder
Choice 2 the file is to be excluded when compiling
Choice 3 the file will be written at at a later point
Choice 4 the file to be included can be located in default folder for .H files

Question 4: Multiple Choice      

Which of the following directives is involved in the creation of a constant?

Choice 1 #include
Choice 2 #endif
Choice 3 #define
Choice 4 #import

Question 5: Multiple Choice       

The function main() is special because:-

Choice 1 it is automatically executed when a program is first run
Choice 2 it returns a value
Choice 3 it is the only function that doesn't have to return a value
Choice 4 it returns an integer value

Question 6: Multiple Choice     

When the function main() is declared as follows:-

void main()

What type of value is returned?

Choice 1 int
Choice 2 float
Choice 3 void
Choice 4 no value

Question 7: Multiple Choice       

Which statement about the cin function is TRUE?

Choice 1 it can be used to capture input from a console
Choice 2 it can be used to send output to a console
Choice 3 it can be used to capture input from textboxes
Choice 4 it is only used with the C programming language and not C++

Question 8: Multiple Choice       

The special escape characters \t indicates to the function cin:-

Choice 1 a new line
Choice 2 the F1 key was pressed
Choice 3 a tab character
Choice 4 the ESC key was pressed

Question 9: Multiple Choice       

Which of the following is a valid set of escape characters?

Choice 1 endl   \n   \r   \t   \\   \a   \”   \’
Choice 2 endl   \n   \r   \t   \\   \a    ”    ’
Choice 3 endl  /n   /r   /t
Choice 4 endl   \n   \r   \t   \u   \v  \w  \y

Question 10: Multiple Choice       

What sort of error will the following code produce?

void main() {

return 0;

}

Choice 1 a run-time error
Choice 2 a linker error
Choice 3 no error, the code is fine
Choice 4 a compiler error