C++ Programming Fundamentals
C++ programming concepts including STL, object-oriented programming, file I/O, templates, and virtual functions
Questions
Which of the following components of Standard Template Library hold(s) data of some type?
- Algorithms
- ssssContainers
- Iterators
- Encapsulation
- Data abstraction
Which of the following error handling functions in C++ returns true when an input or output operation has failed?
- Exit()
- Good()
- Bad()
- Eof()
- Fail()
The default visibility mode in C++ is
- public
- protected
- private
- public-private
- unprotected
Which of the following member functions of the map class is used to give the location of a specified element?
- Begin()
- Clear()
- Find()
- Erase()
- Insert()
The _____________ member function of a class modifies the values of the member variables.
- Accessor function
- Mutator function
- Constructor function
- Inline function
- Destructor function
The ____________ file mode is used in C++ to write all the data at the end of the file.
- ios::in
- ios::out
- ios::trunc
- ios::ate
- ios::binary
The _____________ I/O stream function is used to return the next character from an input file stream without moving the inside pointer.
- _unlink()
- putback()
- flush()
- peek()
- getline()
_____________ is the process of deciding which class function is to be called at runtime.
- Static binding
- Late binding
- Virtual function
- Abstract class
- Derived class
A function generated from a function template is called
- generated class
- generated function
- static member function
- inline function
- constructor function
Which function is used to make use of a function which is used in two derived classes and also in the base class without having any complexity in the program.
- Virtual function
- Function overloading
- Operator overloading
- Inheritance
- Encapsulation
__________ visibility mode is used when public and protected members of base class become protected members of derived class.
- Public
- Private
- Protected
- Not inherited
- Public-Private
________ is the one in which all code is written without mention of any specific type and thus, can be used transparently with any number of new types.
- Run-time polymorphism
- Compile-time polymorphism
- Parametric polymorphism
- Ad-hoc polymorphism
- Abstract class
The _____________ operator is used to define a member function outside the class declaration using the class name.
- ::
- '*'
- '&'
- '=='
- '!'
_____________ is the class object used to read data from disk files.
- ofstream
- ifstream
- PRN
- argc
- istream_withassign
Consider the following C++ code:
class Sample {
int a;
public:
Sample(int b)
{
a = b;
}
Sample(Sample s)
{
a = s.a;
}
};
void main()
{
Sample s(100);
Sample s1(s);
}
Referring to the above program code, what initialises the object s1?
- 1000
- Value of s object
- 200
- 300
- 400