dis_chapter_quiz1 Flashcards
The primary role of the constructors is to initialize the data members of objects (either with default values or with values provided as arguments).
true
int a[4] = {7,5,3,1};
Given the array definition above, which of the following prints 7 as the output?
cout «_space;*a «_space;endl;
Function overloading is not permitted in C++.
False
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.
False
An object can access its public members by using the dot operator (.).
True
Data members of the classes normally placed in “public:” section of a class.
False
Most C++ compilers check whether array indices are out of range.
False
Which of the following is the subscript operator in C++ to access the elements of an array?
[ ]
Procedural programming paradigm focuses on the verbs of a problem’s specification whereas object-oriented programming paradigm focuses on its nouns.
True
n C++, all elements of an array have same data type.
True
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?
eof
Given a string s having more than 4 characters, s[3] and s.at(3) returns the same character.
True
When the capacity of a vector is full, push_back() function adds the element by removing the first element
False
When the capacity of a vector is full, push_back() function adds the element by removing the first element
False
Which of the following classes should be used to print output to a file?
ofstream
If you have a template class named MyClass, which of the following instantiates an object correctly?
MyClass<int> a;</int>
Dereferencing operator * is used to access the contents of memory location pointed by a pointer.
true
Only numbers can be stored in C++ variables.
False
unsigned short values are stored in 2 bytes in C++. What is the maximum number that can be stored in an unsigned short variable?
2^16-1
Logical errors occur when the source code violates the syntax (i.e., the grammar rules) of the language
False
A pointer is a variable whose value is the address of another variable.
True
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
True
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
True
The leftmost bit is the sign bit (0 for nonnegative values, 1 for negative) in two’s complement representation.
True