C++ | Which of the following are good reasons to use an object oriented language?
| You can define your data types | Program statements are simpler than in procedural languages. | An OO program can be taught to correct its own errors. | It's easier to conceptualize an OO program. | A |
C++ | When a language has the capacity to produce new data type, it is said to be
| Reprehensible | Encapsulated
| Overload
| Extensible | D |
C++ | A normal C++ operator that acts in a special way on newly defined data types is said to be
| Glorified | Encapsulated
| Classified
| Overloaded | D |
C++ | main() returns a value of type
| real | char | int | null
| C |
C++ | Sharing of common information are achieved by the concept of
| Virtual copying | Inheritance | Encapsulation | None of these | B |
C++ | In a for loop with a multi-statement loop body, semicolons should appear following
| The for statement itself | The closing brace in a multi-statement loop body | Each statement within the loop body. | The test expression | C |
C++ | A variable defined within a block is visible
| From the point of definition onwards in the program | From the point of definition onwards in the function
| From the point of definition onwards in the block | Throughout the function | C |
C++ | The library function exit() causes an exit from
| The loop in which it occurs | The block in which it occurs | The function in which it occurs | The program in which it occurs
| D |
C++ | The getch() library function
| Returns a character when any key is pressed | Returns a character when ENTER is pressed | Display a character on the screen when a key is pressed | Does not display a character on the screen | A |
C++ | _______ argument(s) are passed in case of binary overloaded operators.
| Two
| One | No | None of the above | A |
C++ | _______ argument(s) are passed in case of unary overloaded operators.
| Two | One | No | None of the above
| B |
C++ | The && and || operators
| Compare two numeric values | Combine two numeric values | Compare two Boolean values | Combine two Boolean values | C |
C++ | The break statement causes an exit
| Only from the innermost loop | Only from the innermost switch | From all loops and switch | Only from the innermost loops or switch | A |
C++ | When accessing a structure member, the identifier to the left of the dot operator is the name of
| Structure member | Structure tag | Structure variable | The keyword struct. | C |
C++ | cc ___________ option is used only to create object file
| -a | -o | -c | none of these | B |
C++ | :: is known as
| scope resolution operator | global operator | Both (a) & (b)
| None of these
| A |
C++ | Which of the following can legitimately be passed to a function?
| A constant | A variable | A structure | A header file | B |
C++ | _____________ operator must have one class object
| + | new
| all
| None of these | B |
C++ | Overloaded functions
| Are a group of functions with the same name | All have the same number and types of arguments | Make life simpler for programmer | May fail unexpectedly due to stress | A |
C++ | In C++, the stream base class is
| iostream | iofstream | ios | stdio | C |
C++ | The template function declaration specifies
| template class | a generic class | exception | identifier | B |
C++ | In C++, the exception handler is invoked with a-
| try block | throw exception
| catch function | abort() | B |
C++ | The exception is processed using
| unexpected() | perform() | catch() | try()
| C |
C++ |
A member function can always access the data | In the object of which it is a member | In the class of which it is a member | In the object of the class of which it is a member | In the public part of its class
| B |
C++ | Classes are useful because they
| Are removed from memory when not in use | Permit data to be hidden from other classes | Bring together all aspects of an entity in one place | Can closely model objects in the real world
| B |
C++ |
Element double Array[7] is which element of the array? | sixth
| seventh | eighth | impossible to tell | C |
C++ | You can read input that consists of multiple lines of text using
| The normal cout<<> | The cin.get() function with one argument | The cin.get() function with two argument | The cin.get() function with three argument | C |
C++ | Operator overloading is
| Making C++ operators work with objects
| Making C++ operators more then they can handle | Giving new meaning to existing c++ operators | Making new C++ operators | C |
C++ | Private data members can be accessed
| Only from the base class itself
| Both from the base class and form its derived classes | From the class which is a friend of the base class | None of the above is correct | AC |
C++ | Protected data members can be accessed
| Only from the base class itself | Both form the base class and from its derived classes | From the class which is friend of the base class
| None of the above are correct | B |
C++ | Public data members can be accessed
| Only from the base class itself | Both form the base class and from its derived classes | From the class which is friend of the base class
| None of the above are correct | B |
C++ | When you overload an arithmetic assignment operator, the result
| Goes in the object to the right of the operator | Goes in the object to the left of the operator | Goes in the object of which the operator is a member | Must be returned | B |
C++ | new operator is used
| To dynamically allocate storage
| To statically allocate storage | To allocate storage for a new variable | None of the above are correct | C |
C++ | Delete operator is used
| To allocate storage
| To deallocate storage | To delete variable name | None of the above are correct | B |
C++ | Class members are _______________ by default
| Private | protected | public | None of the above are correct | A |
C++ | Friend function have access to the
| private and protected members
| public members only | private members only
| None of the above are correct | B |
C++ | Inline functions_____________ call overload.
| Increase
| Reduce | None of the above are correct |
| B |
C++ | The characteristic that data can be manipulated only through member functions that are part of the class is called
| Encapsulation | Data dependency | Inheritance | Instantiation | A |
C++ | In a class, only the member function can access data, which is not accessible to outside. This feature is called:
| Data security
| Data hiding | Data manipulation | Data definition
| B |
C++ | The scope resolution operator is -
| ::
| ; | <<
| ->
| A |
C++ | The signature of a function is
| The return type | The number and type of arguments | The class of a function
| None of the above | D |
C++ | Pick out the most appropriate statement
| All variables must be declared before they are used | Variables in C++ need not be declared and the type can be assigned dynamically | Variables in C++ can be declared at the end of the program (before the main function terminates) | Variables can not be used explicitly in C++ | A |
C++ | What is the value of Friday in the following - enum days { Monday, Tuesday, Wednesday = -1, Thursday, Friday, Saturday = 6, Sunday}
| 1
| 5 | 0
| -3
| A |
C++ |
What is the output of the following program segment - for(i = 1, j = 0; i < 10; i++) j += i; cout < | 10 | 20 | 55 | there is an error in the program | A |
C++ | The string table in C++ holds the
| string constants in your program | program statements in string form | variables whose type is of string
| none of the above | A |
C++ | The declaration int **var1; shows that
| var1 can not be accessed | var1 is a pointer to a pointer of type int | var1 is a protected data type of integer | this type declaration shows an error
| B |
C++ |
In C++, the keyword auto can be used for | Automatic assignment of data to object during instantiation | Automatic call of a function | To declare a local variable | It is not a keyword in C++ | C |
C++ |
By default, C++ uses the following method of passing arguments | Call-by-Reference | Call-by-Value
| Call-by-Pointer | None of the above | B |
C++ | Pick out the most appropriate statement from the following
| references are pointers | array of references can be created | you can not reference a reference variable | all of the above | C |
C++ | The ?: can be used to replace
| if-else statement
| wild cards
| no meaning in C++ | returns the value | A |
C++ | Dynamic memory can be allocated by the following declaration
| new | volatile | static | == | A |
C++ |
The member of a structure can be directly accessed by | -> | dot operator
| :: | >> | B |
C++ | The member of a structure can be accessed through a pointer by
| -> | dot operator | ::
| >>
| A |
C++ | The members of a class can be made private by
| declaring them private | by default they are private | by declaring them in the beginning of the program immediately after main() | they are always public | AB |
C++ | A function that is called automatically when an object is created is known as
| instantiation
| function prototype | constructor | structure | C |
C++ | A function that is called automatically when an object is destroyed is known as
| instantiation | function prototype | constructor | destructor | D |
C++ | It is possible to allow non member function access to private members of a class by declaring it as
| public | friend | private | not possible | B |
C++ | When one object initializes another object the following function is invoked
| copy constructor | new | instantiation | none of the above | A |
C++ | A base class is inherited by
| derived class | inline function | constructor | none of the above | A |
C++ | By using protected, one can create class members that are private to their class but
| that can not be inherited and accessed by a derived class | that can still be inherited and accessed by a derived class | that can be public | none of the above | B |
C++ | A pure virtual function is a virtual function that has
| no definition in its base class | a definition in its base class | a definition in at least one derived class | definition in base class and at least one derived class | A |
C++ | A class that contains at least one pure virtual function is called as
| pure class
| abstract class | base class | derived class | B |
C++ | The binding that binds a function call at run time is called
| early binding | run time binding | late binding | linking | C |
C++ | One of the major disadvantage with late binding is
| the source code should be made available at compile time
| the program runs slower | dynamic variables can not be used in the program | static variables can not be used | B |
C++ | One of the important features of an abstract class is
| it need not have any object | it should be used only as a derived class | it need not have any members
| none of the above | A |
C++ | Organizing data with methods that operate on the data and creating a new data type is called encapsulation. | True | False |
|
| A |
C++ | Class is similar to a variable. | True | False | B | ||
C++ | By default, members cannot be inherited. | True | False | A | ||
C++ | Protected members cannot be inherited. | True | False | B | ||
C++ | Inline function specifier reduces the overheads associated with a normal function call. | True | False | A | ||
C++ | The new operator always returns a void pointer. | True | False | A | ||
C++ | 'this' pointer has to be used while accessing data members in a member function. | True | False | A | ||
C++ | In C++, identifiers have to be declared at the beginning of the blocks. | True | False | A | ||
C++ | In C++, an identifier must be initialized using constant expression. | True | False | B | ||
C++ | Data objects can be initialized when allocating memory using 'new'. | True | False | A | ||
C++ | Scope resolution operator has the highest precedence. | True | False | A | ||
C++ | Reference to an object behaves like a constant pointer.
| True | False | B | ||
C++ | We can make function inline by using the keyword 'inline'. | True | False | A | ||
C++ | Private members of a structure can be accessed directly from the outside of the structure. | True | False | B | ||
C++ | The following syntax is valid. void inline gram_ panchayat :: show_gram_ panchayat_info(). | True | False | B | ||
C++ | "[]" Operator is a unary operator. | True | False | A | ||
C++ | The members of a class by default are private. | True | False | A | ||
C++ | An object is an allocated space in memory. | True | False | A | ||
C++ | Constructor returns void type value. | True | False | B | ||
C++ | A copy constructor is used to copy an object member wise to another object of the same class. | True | False | A | ||
C++ | Member function cannot be called from within a constructor. | True | False | A | ||
C++ | We cannot have the address of a constructor. | True | False | A | ||
C++ | A constructor cannot be explicitly called.
| True | False | A | ||
C++ | A destructor can have arguments like constructor. | True | False | B | ||
C++ | A destructor can have a return type. | True | False | B | ||
C++ | Objects get destroyed in the reverse order as they are created. | True | False | A | ||
C++ | 'this' is an implicit pointer. | True | False | A | ||
C++ | The value of 'this' pointer can be changed. | True | False | B | ||
C++ | In case of nested class, enclosing class can directly access the private data member of nested class.
| True | False | A | ||
C++ | ios containes a pointer to streambuf.
| True | False | A | ||
C++ | iostream is inheried from istream, ostream and ios class. | True | False | B | ||
C++ | Static member functions have file scope. | True | False | A | ||
C++ | Static data member occurs in only class scope. | True | False | B | ||
C++ | Static data member can be declared as const too. | True | False | A | ||
C++ | If a friend function is declared inside a class it can access all data members of the class. | True | False | A |
Comments