Quiz 1 C++
Quiz 1 C++
1
6. ____________ is a device to connect a computer to a local area network (LAN).
A. Regular modem
B. DSL
C. Cable modem
D. NIC
2
12. ________ is an object-oriented programming language.
A. Java
B. C++
C. C
D. C#
E. Python
14. Which of the following statements is correct to display Welcome to C++ on the console?
A. cout << "Welcome to C++";
B. cout >> "Welcome to C++";
C. cout < "Welcome to C++";
D. cout << 'Welcome to C++';
E. System.out.print("Welcome to C++");
3
18. Suppose you define a C++ as follows:
int main()
{
22. Every statement in C++ ends with ________, which is called a statement terminator.
A. a semicolon (;)
B. a comma (,)
C. a period (.)
D. an asterisk (*)
23. ___________ is called a stream insertion operator for sending output to the console.
4
A. a semicolon (;)
B. a comma (,)
C. a period (.)
D. an asterisk (*)
E. <<
#include <iostream>
using namespace std;
int main()
{
cout << 1 + 2 << endl;
return 0;
}
A. 1 + 2
B. 2
C. 12
D. 3
E. 1
#include <iostream>
using namespace std;
int main()
{
cout << "A";
cout << "B";
return 0;
}
A. A B
5
B. AB
C. B A
D. BA
I:
#include <iostream>
using namespace std;
int main()
{
cout << "Welcome to C++" << endl;
return 0;
}
II:
#include <iostream>
using namespace std;
A. Both I and II can compile and run and display Welcome to C++, but the code in II has
a better style than I.
B. Only the code in I can compile and run and display Welcome to C++.
C. Only the code in II can compile and run and display Welcome to C++.
D. Both I and II can compile and run and display Welcome to C++, but the code in I has
a better style than II.
I:
#include <iostream>
using namespace std;
int main()
{
cout << "Welcome to C++" << endl;
6
return 0;
}
II:
#include <iostream>
using namespace std;
int main()
{
cout << "Welcome to C++" << endl;
return 0;
}
III:
#include <iostream>
using namespace std;
int main()
{ cout << "Welcome to C++" << endl;
return 0;
}
IV:
#include <iostream>
using namespace std;
int main()
{
cout << "Welcome to C++" << endl;
return 0;
}
A. I
B. II
C. III
D. IV
30. If a program compiles fine, but it produces incorrect result, then the program suffers
__________.
A. a compilation error
B. a runtime error
C. a logic error
>>>>>>>end of question<<<<<<
7
8