2. Intro C++¶


Q) Which of the follow prints one linefeed?¶

a) cout << "Hello!" << endl;
b) cout << "Yes\n\n";
c) cout << "New line here.";
d) cout << "endl";


Q) What are the 3 types of errors in C++ code?¶

a) Typo, Gilitch, Error
b) Run-time, Debug-time, Local time
c) Logic, Value, Output
d) Compile-time, Run-time, Logic


Q) What is the output of the following?¶

cout << "I see you said, \"It's true!\"" << endl;

a) I see you said, It's true!
b) "I see you said, "It's true!""
c) I see you said, "It's true!"
d) Error: no output.


Answers¶

a) cout << "Hello!" << endl;
d) Compile-time, Run-time, Logic
c) I see you said, "It's true!"