Objective Questions

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

1.

C++ was originally developed by Nicolas Wirth Ans : 3 Donald Knuth Bjarne Stroustrup Ken Thompson

2. The standard c++ comment / Ans : 2 // /* and */ None of these

3. The preprocessor directive #include is required if Console output is used Ans : 3 Console input is used Both console input and output is used None of these

4. The operator << is called an insertion operator Ans : 3 put to operator either a or b None of these

5. The operator >> is called an extraction operator Ans : 3 a get from operator either a or b get to operator

6. When a language has the capability to produce new data type, it is called Extensible Ans : 1 7. The C++ symbol << perform the action is used to indicate of sending the value is adopted to of expression listed as the action from right resemble an arrow its right to the outputs to left strewn as the left. Ans : 4 8. C++ name was suggested by Rrick Mascitti Ans : 1 9. What is a reference? an operator a reference is an used to rename None of these Bjarne Stroustrup Donald Knuth Ken Thompson Overloaded Encapsulated Reprehensible

All the above

alias for an object Ans : 2 10. A constructor is called whenever a object is declared Ans : 1 an object is used

an object

a class is declared

a class is used

11. State the object oriented languages C++ Ans : 4 Java Eiffel All of the above

12. Overload function in C++ a group function with the same name Ans : 1 13. Operator overloading is making c++ operators works with objects Ans : 4 giving new meaning to existing c++ operators making new c++ operator both a& b above functions with all have the same same name and same number and type of number and type of arguments arguments

All of the above

14. A constructor is called whenever a object is declared Ans : 1 an object is used a class is declared a class is used

15. A class having no name is not allowed Ans : 3 16. The differences between constructors and destructor are constructors can take arguments but destructor can't Ans : 3 17. A destructor takes constructors can be overloaded but destructors can't be overloaded can't have a constructor can't have a destructor can't be passed as an argument

both a & b

None of these

one argument Ans : 4

two arguments

three arguments

Zero arguments

18. Constructors are used to initialize the objects Ans : 1 construct the data members both a & b None of these

19. In C++ a function contained with in a class is called a member function Ans : 1 an operator a class function a method

20. The fields in a class of a c++ program are by default protected Ans : 3 public private None of these

1. The meaning of conversion character for data input is Data item is a long integer Ans : 3 2. The conversion characters for data input means that the data item is An unsigned decimal integer Ans : 4 A short integer A hexadecimal integer A string followed by white space Data item is an unsigned decimal integer Data item is a short integer None of the above

3. An expression contains relational, assign. ment and arithmetic operators. If Parenthesis are not present, the order will be Assignment, arithmetic, relational Ans : 4 4. Which of the following is a key word is used for a storage class printf Ans : 3 external auto scanf Relational, arithmetic, assignment Assignment, relational, arithmetic Arithmetic, relational, assignment

5. In the C language 'a represents a digit Ans : 3 an integer a character a word

6. The number of the relational operators in the C language is Four Ans : 2 Six Three One

7. A compound statement is a group of statements included between a pair of double quote Ans : 2 8. A Link is a compiler Ans : 4 9. The continue command cannot be used with for Ans : 2 10. In C, a Union is memory location Ans : 1 memory store memory screen None of these switch do while an active debugger a C interpreter a analyzing tool in C curly braces parenthesis a pair of /s

11. When the main function is called, it is called with the arguments argc Ans : 4 argv None of these both a & b

12. A multidimensional array can be expressed in terms of array of pointers array without the rather than as group of contiguous pointers to a group of array contiguous array Ans : 1

data type arrays

None of these

13. C allows arrays of greater than two dimensions, who will determined this programmer Ans : 2 compiler parameter None of these

14. A pointer to a pointer in a form of multiple indirection Ans : 3 a chain of pointers both a and b None of these

15. Pointers are of integer data type Ans : 4 16. Maximum number of elements in the array declaration int a[5][8] is 28 Ans : 4 32 35 40 character data type unsigned integer data types None of these

17. If the size of the array is less than the number of initializers then, Extra values are being ignored Ans : 2 Generates an error message Size of Array is increased Size is neglected when values are given

18. Array subscripts in C always start at -1 Ans : 2 19. A Structure can be read as a single entity Ans : 2 20. Identify the invalid pointer arithmetic Addition of float value to a pointer Ans : 1 1. The meaning of conversion character for data input is Data item is a long integer Ans : 3 2. The conversion characters for data input means that the data item is An unsigned decimal integer Ans : 4 A short integer A hexadecimal integer A string followed by white space Data item is an unsigned decimal integer Data item is a short integer None of the above Comparision of pointers that do not point to the element of the same array Assigning the Subtracting an value 0 to a pointer integer from a pointer variable cannot be read as can be displayed a single entity as a single entity has member variables that cannot be read individually 1 0 Value provided by user

3. An expression contains relational, assign. ment and arithmetic operators. If Parenthesis are not present, the order will be Assignment, arithmetic, relational Ans : 4 4. Which of the following is a key word is used for a storage class printf Ans : 3 external auto scanf Relational, arithmetic, assignment Assignment, relational, arithmetic Arithmetic, relational, assignment

5. In the C language 'a represents a digit Ans : 3 an integer a character a word

6. The number of the relational operators in the C language is Four Ans : 2 Six Three One

7. A compound statement is a group of statements included between a pair of double quote Ans : 2 8. A Link is a compiler Ans : 4 9. The continue command cannot be used with for Ans : 2 10. In C, a Union is memory location Ans : 1 memory store memory screen None of these switch do while an active debugger a C interpreter a analyzing tool in C curly braces parenthesis a pair of /s

11. When the main function is called, it is called with the arguments argc Ans : 4 argv None of these both a & b

12. A multidimensional array can be expressed in terms of

array of pointers array without the rather than as group of contiguous pointers to a group of array contiguous array Ans : 1

data type arrays

None of these

13. C allows arrays of greater than two dimensions, who will determined this programmer Ans : 2 compiler parameter None of these

14. A pointer to a pointer in a form of multiple indirection Ans : 3 15. Pointers are of integer data type Ans : 4 16. Maximum number of elements in the array declaration int a[5][8] is 28 Ans : 4 32 35 40 character data type unsigned integer data types None of these a chain of pointers both a and b None of these

17. If the size of the array is less than the number of initializers then, Extra values are being ignored Ans : 2 Generates an error message Size of Array is increased Size is neglected when values are given

18. Array subscripts in C always start at -1 Ans : 2 19. A Structure can be read as a single entity Ans : 2 20. Identify the invalid pointer arithmetic Addition of float Comparision of Subtracting an Assigning the cannot be read as can be displayed a single entity as a single entity has member variables that cannot be read individually 1 0 Value provided by user

value to a pointer

pointers that do not point to the element of the same array

integer from a pointer value 0 to a pointer variable

Ans : 1 In Late binding the function calls gets resolved during Compile Time Run Time Both A and B None of the Above Ans B The value of EOF is 1 0 Infinity -1 Ans d What is the notation used to place block of statements in a looping structure in C++? % % ( ) { } None of the Above Ans c The notation of member access operator in structures is & . $ * Ans b Using pointers to call a function is called as call by value call by reference call by address All the Above Ans b The variable that contains address of another variable is called as pointer arrays unions None of the Above Ans a Inheritance in C++ have default access specifier as private public protected None of the Above Ans a

How many values can be returned by a C++ function? 1 infinity 0 None of the Above Ans a Which of the following denote library function in C++? isalpha isdigits isspace All the Above Ans d The array exforsys[10] can be declared using pointers as % exforsys[] & exforsys[] * exforsys[] @ exforsys[] Ans c Which of the following is mandatory for all C++ program? main() scanf() system() All the Above Ans a The variables that can be used only within the function in which it is declared is called as Global Variables Local Variables Both A and B None of the Above Ans b The class that in C++ for file input is ifstream ofstream Both A and B The class that in C++ for file input is Ans a Which of the following is an error statement in C++ array declaration? None of the Above int exforsys(10); float exforsys[5][5]; int exforsys[5]; Ans b The members of a class are by default private public protected None of the Above

Ans a The header that should be included while using manipulators in C++ is iomanip.h manip.h ifstream.h None of the Above Ans a The header file that must be included while using cout function in a C++ program is conio.h math.h iostream.h None of the Above Ans c The other name for external variables in C++ is static variables register variables global variables None of the Above Ans c The notation of ternary operator is & ?: ~ % Ans b Which of the following denote stream classes in C++? ios fstream ostream All the Above Ans d Pure virtual function in C++ is one in which the virtual function has no body has at least one member which cannot be inherited None of the Above Ans a The notation used for representing destructor in C++ program is ! & * ~ Ans d Which of the following denote newline character in C++ program? '/nc' 'nc' '/n' '\n' Ans d A function in a C++ program can be called Only Once Cannot be called at all Any number of times None of the Above Ans c The notation of logical NOT operator in a C++ program is

: ; ! None of the Above Ans c In a C++ program each statement is ended with the character . ; * : Ans b Which of the following denote insertion operator in C++? & < << ! Ans c (important) Which of the following denotes feature of OOPS? Inheritance Encapsulation Polymorphism All the Above Ans d What is used to convert C++ source code into object modules? Compiler Linker Both A and B None of the Above Ans a Which of the looping structure in C++ check condition at the beginning of loop? do-while while Both A and B None of the Above Ans b A condition that must be true on exit from a member function if called as Precondition Post-condition Both A and B None of the Above Ans b Comments in C++ program is written by using / / // /* /* * * Ans b cin in C++ program uses the operator >> < << > Ans a Which of the following denote C++ looping statement? While

do-while for All the Above Ans d What is the keyword used to allocate memory in C++? assign malloc new None of the Above Ans c What is the minimum number of times a do loop would definitely get executed? 0 1 Infinity Could not be predicted Ans b Which of the following notation compares two variables X and Y? X==Y X=Y X!=Y X equals Y Ans a Which of the following statements are TRUE? Reference variables must be initialized in C++ Array of reference is possible Both A) and B) None of the Above Ans a The method that is used for writing characters in C++ program is put get write None of the Above Ans a The variables that are used to represent individual array element in an array is called as Pointer Variable Subscripted variable Index Variable Real Variable Ans b In C++ the function that is used to release the block of memory already used is release deallocate delete All the Above Ans c Which of the following denote incorrect data type in C++? real double float int Ans a Which of the following functions are used in dynamic memory handling in C++? new

delete Both A and B None of the Above Ans c Which of the following is allowed Positive Integer Negative Integer Both A and B Float Ans a The isolation of data from direct Data Hiding Data Isolation Data Encapsulation None of the Above Ans a Which of the following is used to Arrays Structures Both A and B None of the Above Ans b The operator that denotes address * % $ & for the value of subscript variable?

access by a C+ program is called as

store data of different types?

of a variable in C++ program is

Ans d If an array in C++ is declared as exforsys[10] then exforsys is equal to &exforsys[0] &exforsys[9] *exforsys[0] None of the Above Ans a Which of the following is returned by the operating system if a C++ program completes successfully? No Value Returned -1 1 0 Ans d Which of the following is used to group a set of global classes, objects and functions under a name? Area named Namearea Namespaces None of the above Ans c The class with name exforsys and having integer data x in its have constructor name as exforsys x any name None of the Above

Ans a The function named as exforsys declared as int exforsys(float x, double y) has return type as double int float None of the Above Ans b Which of the following language given below uses the concepts of OOPS? C++ Java C# All the Above Ans d A variable modified by multiple threads should be declared as global static volatile None of the Above Ans c (important) Reference to its own class can be accepted by simple constructor copy constructor Both A and B None of the Above Ans b What is the value of variable z when the following program segment ends? int z; for(z=0; z<50; z++) {} 51 49 0 50 Ans d The actual implementation is present in declaration definition Both A and B None of the Above Ans b Strict parameter type checking is followed with which of the following? Inline Macros Both A and B None of the Above Ans a When dynamically allocated memory is lost to the C++ program then warning occurs memory leak occurs The program executes successfully None of the above Ans b Which of the following OOPS concepts are used with cin and cout? Encapsulation Data Hiding Operator Overloading

None of the Above Ans c The friend function of a class in C++ can access Private members of the class protected members of the class Both A and B None of the Above Ans c A function defined within a class is called as Member Function Class Function Object Function None of the Above Ans a The private member in derived class Cannot be inherited Can be inherited at all instances Can be inherited only if the derived class is inheriting from base class with private access level None of the Above Ans c (important) Which of the following denote types of polymorphism in C++? Virtual function Function overloading Operator Overloading All the Above Ans d An instance of a user-defined type is called Class Object Method None of the Above Ans b Which of the following denote operator of logical AND? && ^& !& & Ans a Which of the following denotes growable array? Vector ArrayList Both A and B None of the Above Ans c Which of the following can be used to initialize a newly declared variable from an existing variable? Virtual Function Namespaces copy constructor None of the Above Ans c The vtable entry for a pure virtual function in C++ is zero NULL one

No Entry in vtable Ans b Class that reads and writes to an array in memory is ostream ifstream strstream None of the Above Ans c Mutable keyword can be applied to non-static data members of a class non-const data members of a class Both A and B None of the Above Ans c (imp) The member functions of a class can be defined outside the class using Extraction Operator Insertion Operator Scope resolution operator None of the Above Ans c Objects have behavior state Both A and B None of the Above Ans c Which of the following operators cannot be overloaded? sizeof :: :? All the Above Ans d The output of operation 20%3 is 6 2 1 4 Ans b Which of the following is used in C++ to create a copy of an object? Assignment operator Copy constructor Both A) and B) None of the Above Ans b RAiI stands for Read Acquisition is Initialization Resource Acquisition is Initializer Resource Acquisition is Initialization None of the Above Ans c Which of the following exists in C++? virtual destructor virtual constructor Both A and B None of the Above

Ans a A template can be instantiated by Explicit Instantiation Implicit instantiation Both A and B None of the Above Ans c (imp) The inserting of the code of a called function at the point where the function gets called is achieved by using Inline functions virtual functions Both A and B None of the Above Ans a The new operator in C++ Initialize the allocated memory Allocates memory for the object Both A and B None of the Above Ans c (imp) The block of memory allocated by the new is released by using delete realloc Both A and B None of the Above Ans a Which of the following denotes advantages of operator overloading? Operator not limited to operate only with primitive Data Type Extensibility Both A and B None of the Above Ans c A function named as exforsys has three implementations associated with it. This means the function exforsys is overloaded Overriding Both A and B None of the Above Ans a Which of the following denote bitwise operators of C++? ^ << ~ All the Above Ans d The notation of scope resolution operator is * : :: None of the Above Ans c Virtual functions are defined in Derived class Base class Both A and B

None of the Above Ans a The data members and member functions that are only available to derived classes are private public protected None of the Above Ans c(???) For the class exforsys defined as below: class exforsys() { }; int main() { exforsys a; } Which of the following is TRUE? No default constructor is provided by the compiler The compiler provides the default constructor The compiler generates error None of the Above Ans b Which of the following remains static in a C++ program? Class Object Both A and B None of the Above Ans a Which of the following allocates memory but does not initialize it? new operator operator new Both A and B None of the Above Ans b (imp) Which of the following includes the concept of derived classes in C++? Encapsulation Polymorphism Inheritance None of the Above Ans c When object of the first class is instantiated then which of the following is called? Destructor Constructor Both A and B None of the Above Ans b The overriding method must have the which of the following same as that of the method in the super class definition same identifier same signature Both A and B None of the Above Ans c (imp) Index of an array starts from One Zero Two None of the Above Ans b Value is given to a variable using conditional statement assignment statement

looping statement None of the Above Ans b Which of the following denote advantages of inheritance? saves program development time code reusability Both A and B All the Above Ans c If a function in C++ does not return a value then its return type is denoted as float void int None of the Above Ans b The first fully Object-oriented language is Java C++ Simula None of the Above Ans c

You might also like