Introduction to C++ Programming, Y. Daniel Liang
Chapter 1 Introduction to Computers, Programs, and C++
Section 1.2 What is a Computer?
1
________ is the physical aspect of the computer that can be seen.
A.
Hardware
B.
Software
C.
operating system
D.
Application program
2
__________ is the brain of a computer.
A.
Hardware
B.
CPU
C.
Memory
D.
Disk
3
The speed of the CPU is measured in __________.
A.
megabytes
B.
gigabytes
C.
megahertz
D.
gigahertz
4
Why do computers use zeros and ones?
A.
because combinations of zeros and ones can represent any numbers and characters.
B.
because digital devices have two stable states and it is natural to use one state for 0 and the other for 1.
C.
because binary numbers are simplest.
D.
because binary numbers are the bases upon which all other number systems are built.
5
One byte has ________ bits.
A.
4
B.
8
C.
12
D.
16
6
A 3.5-inch floppy can hold up to _________ bytes.
A.
0.5 MB.
B.
1.44 MB.
C.
10 MB.
D.
100 MB.
7
A regular CD-ROM can hold up to _________ bytes.
A.
100 MB.
B.
700 MB.
C.
1 GB.
D.
10 GB.
8
____________ is a device to connect a computer to a local area network (LAN).
A.
Regular modem
B.
DSL
C.
Cable modem
D.
NIC
Section 1.3 Programs
9
____________ are instructions to the computer.
A.
Hardware
B.
Software
C.
Programs
D.
Keyboards
10
Computer can execute the code in ____________.
A.
machine language
B.
assembly language
C.
high-level language
D.
none of the above
11
___________ translates high-level language program into machine language program.
A.
An assembler
B.
A compiler
C.
CPU
D.
The operating system
Section 1.4 Operating Systems
12
____________ is an operating system.
A.
Java
B.
C++
C.
Windows XP
D.
Visual Basic
E.
Ada
13
_____________ is a program that runs on a computer to manage and control a computer's activities.
A.
Operating system
B.
C++
C.
Modem
D.
Interpreter
E.
Compiler
Section 1.5 Number Systems (Optional)
14
Decimal number 10 is binary number ____________.
A.
10
B.
2
C.
1000
D.
1100
E.
1010
15
Decimal number 20 is hexadecimal number ____________.
A.
A
B.
FF
C.
F1
D.
14
E.
1F
16
Binary number 1001 is decimal number ____________.
A.
5
B.
9
C.
10
D.
11
E.
12
17
Binary number 1001 is hexadecimal number ____________.
A.
5
B.
9
C.
A
D.
B
E.
C
18
Hexadecimal number A1 is decimal number ____________.
A.
100
B.
101
C.
161
D.
162
E.
163
19
Hexadecimal number A1 is binary number ____________.
A.
10010100
B.
10100001
C.
01100001
D.
11100001
E.
11001001
20
________ is an object-oriented programming language.
A.
Java
B.
C++
C.
C
D.
Ada
E.
Pascal
Section 1.7 A Simple C++ Program
21
The main function header is written as:
A.
public static void main(string[] args)
B.
public int main(String[] args)
C.
int main()
D.
public static main(String[] args)
E.
public void main(String[] args)
22
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++");
23
Which of the following statements is correct?
A.
Every line in a program must end with a semicolon.
B.
Every statement in a program must end with a semicolon.
C.
Every comment line must end with a semicolon;
D.
Every function must end with a semicolon;
E.
Every preprocessor directive must end with a semicolon;
24
C++ compiler translates C++ source code into _________.
A.
Java code
B.
machine code
C.
C code
D.
another high-level language code
25
Suppose you define a C++ as follows:
int main()
{
}
In order to compile this program, the source code should be stored in a file named
A.
Test.cpp
B.
Test.doc
C.
Test.txt
D.
Test.java
E.
Any name with extension .cpp
26
The extension name of a C++ object file is
A.
.java
B.
.obj
C.
.class
D.
.exe
27
The extension name of a C++ source code file is
A.
.java
B.
.obj
C.
.class
D.
.exe
E.
.cpp
28
Which of the following lines is not a C++ comment?
A.
/** comments */
B.
// comments
C.
-- comments
D.
/* comments */
E.
** comments **
29
Every statement in C++ ends with ________.
A.
a semicolon (;)
B.
a comma (,)
C.
a period (.)
D.
an asterisk (*)
30
A block is enclosed inside __________.
A.
Parentheses
B.
Braces
C.
Brackets
D.
Quotes