dis_chapter_quiz1 Flashcards

1
Q

The primary role of the constructors is to initialize the data members of objects (either with default values or with values provided as arguments).

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

int a[4] = {7,5,3,1};
Given the array definition above, which of the following prints 7 as the output?

A

cout &laquo_space;*a &laquo_space;endl;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Function overloading is not permitted in C++.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In C++, process of deallocating memory is handled automatically by the garbage collector. Therefore, unused memory locations are returned to the heap automatically for later allocations.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

An object can access its public members by using the dot operator (.).

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Data members of the classes normally placed in “public:” section of a class.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Most C++ compilers check whether array indices are out of range.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which of the following is the subscript operator in C++ to access the elements of an array?

A

[ ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Procedural programming paradigm focuses on the verbs of a problem’s specification whereas object-oriented programming paradigm focuses on its nouns.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

n C++, all elements of an array have same data type.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which of the following function can be used to check whether there is more data to be read from an input file stream or not?

A

eof

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Given a string s having more than 4 characters, s[3] and s.at(3) returns the same character.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

When the capacity of a vector is full, push_back() function adds the element by removing the first element

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When the capacity of a vector is full, push_back() function adds the element by removing the first element

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which of the following classes should be used to print output to a file?

A

ofstream

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

If you have a template class named MyClass, which of the following instantiates an object correctly?

A

MyClass<int> a;</int>

17
Q

Dereferencing operator * is used to access the contents of memory location pointed by a pointer.

A

true

18
Q

Only numbers can be stored in C++ variables.

A

False

19
Q

unsigned short values are stored in 2 bytes in C++. What is the maximum number that can be stored in an unsigned short variable?

A

2^16-1

20
Q

Logical errors occur when the source code violates the syntax (i.e., the grammar rules) of the language

A

False

21
Q

A pointer is a variable whose value is the address of another variable.

A

True

22
Q

An algorithm is a finite sequence of well-defined, computer-implementable instructions, typically to solve a class of specific problems or to perform a computation

A

True

23
Q

One of the earliest models of software development in which the phases are carried out sequentially, moving from one phase to the next, is known as the waterfall model

A

True

24
Q

The leftmost bit is the sign bit (0 for nonnegative values, 1 for negative) in two’s complement representation.

A

True

25
Q

bool values are stored in 2 bytes in C++.

A

False

26
Q

Arithmetic overflow happens when an arithmetic operation results in a value that is outside the range of values representable by the expression’s type.

A

True

27
Q

Linked lists remove requirement that list elements be stored in consecutive memory locations.

A
28
Q

Linked lists have direct access to each element of the list.

A
29
Q

Insertion is not possible at the beginning of a linked list.

A
30
Q

Adding an element to the end of an array-based list is easier (requires less operation) than linked lists.

A

True

31
Q

The array-based implementation of a list works well for lists with many insertions and deletions.

A

False

32
Q

Since default assignment operator makes a shallow copy, assignment operator should be overloaded for a deep copy when there is dynamically allocated data members in a class.

A

True

33
Q

A linked list with 100 elements uses more memory than an array-based list with a capacity of 100 elements.

A

True

34
Q

Which of the following does not require shifting during insertion or deletion?

A

Linked List

35
Q

Which of the following accepts the capacity of the list as a parameter of the constructor (e.g., List aList (500))

A

Linked List array