Tạo Trắc Nghiệm

400 Câu hỏi trắc nghiệm lập trình C/C++ có đáp án (Phần 7)

50 câu · Đề ôn tập tổng hợp

Xem trước: đọc nhanh mọi câu dạng chữ, chưa tính giờ, chưa hiện đáp án.
Luyện tập: chọn đáp án là biết đúng sai ngay, kèm lời giải.
Thi thử: nộp bài mới chấm điểm và hiện lời giải.

Câu 1

Class members are public by default.

Đáp án và lời giải

Đáp án: B

Câu 2

Friend functions have access only to public members of the class.

Đáp án và lời giải

Đáp án: B

Câu 3

A function designed as public can be accessible by non-members of a class.

Đáp án và lời giải

Đáp án: A

Câu 4

Friendship is commutative.

Đáp án và lời giải

Đáp án: B

Câu 5

New and delete are operators.

Đáp án và lời giải

Đáp án: A

Câu 6

We can implement generic classes using templates

Đáp án và lời giải

Đáp án: A

Câu 7

Using operator overloading we can invent new operators.

Đáp án và lời giải

Đáp án: B

Câu 8

Inheritance helps in making a general class into a more specific class.

Đáp án và lời giải

Đáp án: A

Câu 9

A base class is never used to create objects.

Đáp án và lời giải

Đáp án: B

Câu 10

Classes can be inherited privately.

Đáp án và lời giải

Đáp án: A

Câu 11

It Is legal to return local variables from a function which returns by reference.

Đáp án và lời giải

Đáp án: B

Câu 12

Constructors can be virtual like virtual destructors

Đáp án và lời giải

Đáp án: B

Câu 13

C++ is a pure object oriented programming language.

Đáp án và lời giải

Đáp án: B

Câu 14

In C++ one can define a function within another function.

Đáp án và lời giải

Đáp án: B

Câu 15

A class encapsulates the implementation and interface of a userdefined data type and constitutes an abstract data type.

Đáp án và lời giải

Đáp án: A

Câu 16

In c++ an identifier can begin with a $ sign.

Đáp án và lời giải

Đáp án: A

Câu 17

“My Variable” is a valid identifier in C++

Đáp án và lời giải

Đáp án: A

Câu 18

In C++ one can get the memory addresses of variables and functions.

Đáp án và lời giải

Đáp án: A

Câu 19

%= is not a operator in C++

Đáp án và lời giải

Đáp án: B

Câu 20

std::cout is a standard input stream.

Đáp án và lời giải

Đáp án: B

Câu 21

Preprocessor #define macro and inline functions use the same mechanism.

Đáp án và lời giải

Đáp án: B

Câu 22

All C++ functions are recursive.

Đáp án và lời giải

Đáp án: A

Câu 23

The ‘break’ keyword is only used in the switch..case statement.

Đáp án và lời giải

Đáp án: B

Câu 24

The new operator returns the address and size of the memory block that it allocates.

Đáp án và lời giải

Đáp án: B

Câu 25

The heap storage is used for local objects.

Đáp án và lời giải

Đáp án: B

Câu 26

It is not necessary to initialize a reference to real object when it is declared.

Đáp án và lời giải

Đáp án: B

Câu 27

There can be a null reference.

Đáp án và lời giải

Đáp án: B

Câu 28

One can reassign reference after it is initialized.

Đáp án và lời giải

Đáp án: B

Câu 29

It is nothing wrong that a function returning a reference to an automatic variable.

Đáp án và lời giải

Đáp án: B

Câu 30

One can apply pointer arithmetic with reference variables

Đáp án và lời giải

Đáp án: B

Câu 31

The preprocessor processes source code before the compiler does.

Đáp án và lời giải

Đáp án: A

Câu 32

A class is a basic unit of object-oriented programming.

Đáp án và lời giải

Đáp án: B

Câu 33

A function template defines a parameterized nonmember function, which enables a program to call the same function with different types of arguments.

Đáp án và lời giải

Đáp án: A

Câu 34

Destructors can be overloaded.

Đáp án và lời giải

Đáp án: B

Câu 35

Static data members cannot be private.

Đáp án và lời giải

Đáp án: B

Câu 36

Static member functions can use this pointer.

Đáp án và lời giải

Đáp án: B

Câu 37

One cannot use enumerations in a class.

Đáp án và lời giải

Đáp án: A

Câu 38

One cannot create an object of a virtual class.

Đáp án và lời giải

Đáp án: B

Câu 39

A class that builds a linked list should destroy the list in the class destructor.

Đáp án và lời giải

Đáp án: A

Câu 40

Once an exception has been thrown, it is not possible for the program to jump back to the throw point.

Đáp án và lời giải

Đáp án: A

Câu 41

In C++, only one catch block can handle all the exceptions.

Đáp án và lời giải

Đáp án: A

Câu 42

There can be only one catch block in a program.

Đáp án và lời giải

Đáp án: B

Câu 43

When an exception if throw, but not caught, the program ignores the error.

Đáp án và lời giải

Đáp án: B

Câu 44

A class object passed to a function template must overload any operators used on the class object by the template.

Đáp án và lời giải

Đáp án: A

Câu 45

In the function template definition it is not necessary to use each type parameter declared in the template prefix.

Đáp án và lời giải

Đáp án: B

Câu 46

It is possible to overload a function template and an ordinary (nontemplate) function.

Đáp án và lời giải

Đáp án: A

Câu 47

A class template may not be used as a base class

Đáp án và lời giải

Đáp án: B

Câu 48

When declaring an iterator from the STL, the compiler automatically creates the right kind, depending upon the container it is used with.

Đáp án và lời giải

Đáp án: A

Câu 49

‘ios’ stream is derived from iostream.

Đáp án và lời giải

Đáp án: B

Câu 50

What is the output of the following code?
Media VietJack

Đáp án và lời giải

Đáp án: D