Question No: 1 There are mainly -------------------- types of software
► Two
► Three
► Four
► Five
Question No: 2 When x = 7; then the expression x%= 2; will calculate the value of x as,
► 1
► 3
► 7
► 2
Question No: 3 A pointer variable can be,
► Decremented only
► Incremented only
► Multiplied only
► Both 1 and 2
Question No: 4 setprecision is a parameter less manipulator.
► True
►False
Question No: 5 We can change a Unary operator to Binary operator through operator overloading.
►False
► True
Question No: 6 delete operator is used to return memory to free store which is allocated by the new operator
► True
►False.
Question No: 7 When we do dynamic memory allocation in the constructor of a class, then it is necessary to provide a destructor.
► True
►False
Question No: 8 What is the functionality of the following statement?
String str[5] = {String(“Programming”), String(“CS201”)};
► Default constructor will call for all objects of array
► Parameterized constructor will call for all objects of array
► Parameterized constructor will call for first 2 objects and default constructor for remaining objects
► Default constructor will call for first 3 objects and Parameterized constructor for remaining objects
Question No: 9 What is the sequence of event(s) when allocating memory using new operator?
► Only block of memory is allocated for objects
► Only constructor is called for objects
► Memory is allocated first before calling constructor
► Constructor is called first before allocating memory
Question No: 10 Deleting an array of objects without specifying [] brackets may lead to memory leak
► True
►False
Question No: 11 Which of the following data type will be assumed if no data type is specified with constant?
► short
► float
► int
► double
Question No: 12 There is an array of characters having name ‘course’ that has to be initialized by string ‘programming’ which of the following is the correct way to do this,
i. course[] = {‘p’, ’r’, ’o’, ’g’, ’r’, ’a’, ’m’, ’m’, ’i’, ’n’, ’g’};
ii.course[] = ‘programming’ ;
iii. course[12] = “programming” ;
iv. course = “programming” ;
Choose the correct options.
► (i) and (ii) only
► (i) and (iv) only
► (i) and (iii) only
► (ii) and (iii) only
Question No: 13 What will be the correct syntax of the following statement?
ptr is a constant pointer to integer.
► const int *ptr ;
► const *int ptr ;
► int const *ptr ;
► int *const ptr ;
Question No: 14 Overloaded member operator function is always called by _______
► Class
► Object
► Compiler
► Primitive data type
Question No: 15
Loader loads the executable code from hard disk to main memory.
► True
►False
Question No: 16 Which of the following is the correct C++ syntax to allocate space dynamically for an array of 10 int?
► new int(10) ;
► new int[10] ;
► int new(10) ;
► int new[10];
Question No: 17 The prototype of friend functions must be written ____ the class and its definition must be written ____
► inside, inside the class
► inside, outside the class
► outside, inside the class
► outside, outside the class
Question No: 18 Like member functions, ______ can also access the private data members of a class.
► Non-member functions
► Friend functions
► Any function outside class
► None of the given options
Question No: 19 To perform manipulation with input/output, we have to include _____ header file.
► iostream.h
► stdlib.h
► iomanip.h
► fstream.h
Question No: 20 The endl and flush are _______
► Functions
► Operators
► Manipulators
► Objects
Question No: 21 If we want to use stream insertion and extraction operators with _______ then we have to overload these operators.
► int, float, double
► objects of class
► int, float, object
► int, char, float
Question No: 22 The static data members of a class can be accessed by ________
► only class
► only objects (not sure ) .....
► both class and objects
► none of given options
Question No: 23 Classes defined inside other classes are called ________ classes
► looped
► nested
► overloaded
► none of the given options.
Question No: 24 Which value is returned by the destructor of a class?
► A pointer to the class.
► An object of the class.
► A status code determining whether the class was destructed correctly
► Destructors do not return a value.
Question No: 25 Consider the following code segment
class M {
friend int operator!(const M &);
...
};
!s // code of line implies that operator!(s)
...
Let assume if s is an object of the class then function is implemented as ___________
► Member function
► Non-member function
► Binary operator function
► None of the given options
Question No: 26 When the compiler overloads the assignment (=) operator by default then __________
► compiler does member wise assignment.
► compiler does not allow default overload of assignment (=) operator
► member of the class are not assigned properly
► None of the given options
Question No: 27 If text is a pointer of class String then what is meant by the following statement?
text = new String [5];
► Creates an array of 5 string objects statically
► Creates an array of 5 string objects dynamically
► Creates an array of pointers to string
► Creates a string Object
Question No: 28 Static variable which is defined in a function is initialized ________
► Only once during its life time
► Every time the function call
► Compile time of the program
► None of the above
Question No: 29 The appropriate data type to store the number of rows and is________
► floatcolums of the matrix
► int
► char
► none of the given options.
Question No: 30 Copy constructor becomes necessary while dealing with _______allocation in the class.
► Dynamic memory
► Static memory
► Both Dynamic and Static memory
► None of the given options
► Two
► Three
► Four
► Five
Question No: 2 When x = 7; then the expression x%= 2; will calculate the value of x as,
► 1
► 3
► 7
► 2
Question No: 3 A pointer variable can be,
► Decremented only
► Incremented only
► Multiplied only
► Both 1 and 2
Question No: 4 setprecision is a parameter less manipulator.
► True
►False
Question No: 5 We can change a Unary operator to Binary operator through operator overloading.
►False
► True
Question No: 6 delete operator is used to return memory to free store which is allocated by the new operator
► True
►False.
Question No: 7 When we do dynamic memory allocation in the constructor of a class, then it is necessary to provide a destructor.
► True
►False
Question No: 8 What is the functionality of the following statement?
String str[5] = {String(“Programming”), String(“CS201”)};
► Default constructor will call for all objects of array
► Parameterized constructor will call for all objects of array
► Parameterized constructor will call for first 2 objects and default constructor for remaining objects
► Default constructor will call for first 3 objects and Parameterized constructor for remaining objects
Question No: 9 What is the sequence of event(s) when allocating memory using new operator?
► Only block of memory is allocated for objects
► Only constructor is called for objects
► Memory is allocated first before calling constructor
► Constructor is called first before allocating memory
Question No: 10 Deleting an array of objects without specifying [] brackets may lead to memory leak
► True
►False
Question No: 11 Which of the following data type will be assumed if no data type is specified with constant?
► short
► float
► int
► double
Question No: 12 There is an array of characters having name ‘course’ that has to be initialized by string ‘programming’ which of the following is the correct way to do this,
i. course[] = {‘p’, ’r’, ’o’, ’g’, ’r’, ’a’, ’m’, ’m’, ’i’, ’n’, ’g’};
ii.course[] = ‘programming’ ;
iii. course[12] = “programming” ;
iv. course = “programming” ;
Choose the correct options.
► (i) and (ii) only
► (i) and (iv) only
► (i) and (iii) only
► (ii) and (iii) only
Question No: 13 What will be the correct syntax of the following statement?
ptr is a constant pointer to integer.
► const int *ptr ;
► const *int ptr ;
► int const *ptr ;
► int *const ptr ;
Question No: 14 Overloaded member operator function is always called by _______
► Class
► Object
► Compiler
► Primitive data type
Question No: 15
Loader loads the executable code from hard disk to main memory.
► True
►False
Question No: 16 Which of the following is the correct C++ syntax to allocate space dynamically for an array of 10 int?
► new int(10) ;
► new int[10] ;
► int new(10) ;
► int new[10];
Question No: 17 The prototype of friend functions must be written ____ the class and its definition must be written ____
► inside, inside the class
► inside, outside the class
► outside, inside the class
► outside, outside the class
Question No: 18 Like member functions, ______ can also access the private data members of a class.
► Non-member functions
► Friend functions
► Any function outside class
► None of the given options
Question No: 19 To perform manipulation with input/output, we have to include _____ header file.
► iostream.h
► stdlib.h
► iomanip.h
► fstream.h
Question No: 20 The endl and flush are _______
► Functions
► Operators
► Manipulators
► Objects
Question No: 21 If we want to use stream insertion and extraction operators with _______ then we have to overload these operators.
► int, float, double
► objects of class
► int, float, object
► int, char, float
Question No: 22 The static data members of a class can be accessed by ________
► only class
► only objects (not sure ) .....
► both class and objects
► none of given options
Question No: 23 Classes defined inside other classes are called ________ classes
► looped
► nested
► overloaded
► none of the given options.
Question No: 24 Which value is returned by the destructor of a class?
► A pointer to the class.
► An object of the class.
► A status code determining whether the class was destructed correctly
► Destructors do not return a value.
Question No: 25 Consider the following code segment
class M {
friend int operator!(const M &);
...
};
!s // code of line implies that operator!(s)
...
Let assume if s is an object of the class then function is implemented as ___________
► Member function
► Non-member function
► Binary operator function
► None of the given options
Question No: 26 When the compiler overloads the assignment (=) operator by default then __________
► compiler does member wise assignment.
► compiler does not allow default overload of assignment (=) operator
► member of the class are not assigned properly
► None of the given options
Question No: 27 If text is a pointer of class String then what is meant by the following statement?
text = new String [5];
► Creates an array of 5 string objects statically
► Creates an array of 5 string objects dynamically
► Creates an array of pointers to string
► Creates a string Object
Question No: 28 Static variable which is defined in a function is initialized ________
► Only once during its life time
► Every time the function call
► Compile time of the program
► None of the above
Question No: 29 The appropriate data type to store the number of rows and is________
► floatcolums of the matrix
► int
► char
► none of the given options.
Question No: 30 Copy constructor becomes necessary while dealing with _______allocation in the class.
► Dynamic memory
► Static memory
► Both Dynamic and Static memory
► None of the given options
0 comments
Post a Comment