c ++ basics, control statements, and OOPS

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/28

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

29 Terms

1
New cards

Which of the following is the correct syntax to include a header file in C++?

B. #include

3 multiple choice options

2
New cards

Which operator is used to access members of a class using a pointer?

C. ->

3 multiple choice options

3
New cards

What is the default return type of the main() function?

B. int

3 multiple choice options

4
New cards

How many times will the loop run?

for (int i = 0; i < 5; i++);

C. 5

3 multiple choice options

5
New cards

Which of the following is NOT a loop control statement?

D. switch

3 multiple choice options

6
New cards

Which of the following is NOT a principle of OOP?

C. Compilation

3 multiple choice options

7
New cards

Which access specifier allows access from anywhere?

C. Public

3 multiple choice options

8
New cards

What is function overloading?

A. Same name, different parameters

3 multiple choice options

9
New cards

Which is a feature of polymorphism?

D. All of the above

3 multiple choice options

10
New cards

What will sizeof(char) return?

B. 1

3 multiple choice options

11
New cards

The keyword used to define a constant in C++ is

const

12
New cards

The conditional (ternary) operator is written as

condition ? expression if true : expression if false

13
New cards

The keyword _____________ is used to skip the current iteration of a loop.

continue

14
New cards

A do-while loop executes at least _____________ time(s)

one

15
New cards

A class is a _____________ for creating objects

blueprint

16
New cards

The process of hiding data members inside a class is called _____________.

encapsulation

17
New cards

When a function in a base class is redefined in a derived class, it is called _____________.

function overloading

18
New cards

The virtual keyword is used to implement _____________ polymorphism

runtime

19
New cards

. A pointer stores the _____________ of another variable.

address

20
New cards

new is used for _____________ memory allocation

dynamic

21
New cards

cin is used to display output in C++. (T/F)

false

1 multiple choice option

22
New cards

for, while, and do-while are looping constructs. (T/F)

true

1 multiple choice option

23
New cards

switch can evaluate both int and float types. (T/F)

false

1 multiple choice option

24
New cards

Private members of a class are accessible outside the class. (T/F)

false

1 multiple choice option

25
New cards

A derived class can access protected members of the base class. (T/F)

true

1 multiple choice option

26
New cards

Constructors can be overloaded in C++. (T/F)

true

1 multiple choice option

27
New cards

Destructors can take parameters. (T/F)

false

1 multiple choice option

28
New cards

You must use delete with new to avoid memory leaks. (T/F)

true

1 multiple choice option

29
New cards

static members are shared across all objects of a class. (T/F)

true

1 multiple choice option