Try new tool: URL Shortener

https://res.cloudinary.com/hg6hswtwo/image/upload/v1/media/pics/oop_toolsandjobs_se2jyx
secondyear

OOP - Classes & Objects MCQs With Answers For Exams Part 2





OOP - Classes & Objects MCQs With Answers For Exams Part 2. This questions helps in SPPU online exams 2020 and other competative exams.

Click here to read part 1 of OOP- Classes and Objects

1 When a function returns a value, the entire function call can appear on the right side of the
equal sign and be assigned to another variable.
A TRUE
B FALSE

Answer A
   
   
2 When an argument is passed by reference
A a variable is created in the function to hold the argument’s value.
B the function cannot access the argument’s value.
C a temporary variable is created in the calling program to hold the argument’s value.
D the function accesses the argument’s original value in the calling program.

Answer D
   
   
3 Overloaded functions
A are a group of functions with the same name.
B all have the same number and types of arguments.
C make life simpler for programmers.
D A and C

Answer D

   
4 A default argument has a value that
A may be supplied by the calling program.
B may be supplied by the function.
C must have a constant value.
D A and B

Answer A
   
   
5 A static local variable is used to
A make a variable visible to several functions.
B make a variable visible to only one function.
C retain a value when a function is not executing.
D B and C

Answer D

6 In C++ there can be an array of four dimensions.
A TRUE
B FALSE

Answer A
   
   
7 When an array name is passed to a function, the function
A accesses exactly the same array as the calling program.
B refers to the array using a different name than that used by the calling program.
C refers to the array using the same name as that used by the calling program.
D A and B

Answer D
   
8 The compiler will complain if you try to access array element 14 in a 10-element array.
A TRUE
B FALSE

Answer B
    
9 The extraction operator (>>) stops reading a string when it encounters a space.
A TRUE
B FALSE

Answer A
  
10 You can read input that consists of multiple lines of text using
A the normal cout <<combination.
B the cin.get() function with one argument.
C the cin.get() function with two arguments.
D the cin.get() function with three arguments.

Answer D

11 You should prefer C-strings to the Standard C++ string class in new programs.
A TRUE
B FALSE

Answer B
   
12 Objects of the string class
A are zero-terminated.
B can be copied with the assignment operator.
C do not require memory management.
D Both B and C

Answer D
      
13 Can destuctors be private in C++?
A Yes
B No

Answer A

14 Which of the following feature is not supported by C++?
A Exception Handling
B Reflection
C Operator Overloading
D Namespace

Answer B
 
15 Suppose aand bare integer variables and we form the sum a + b. Now suppose cand
dare floating-point variables and we form the sum c + d.The two +operators here are
clearly being used for different purposes. This is an example of ____________
A Operator Overloading
B Inheritance
C Function Overloading
D Constructor

Answer A
 
  
16 The operators that cannot be overloaded is
A *
B -
C ::
D ()

Answer C
 
  
17 Empty parentheses following a function name in a function prototype indicate that the
function does not require any parameters to perform its task.
A TRUE
B FALSE

Answer A
  
18 C++ programmers concentrate on creating , which contain data members and the member
functions that manipulate those data members and provide services to clients.
A Structures
B Classes
C Objects
D Function

Answer B
 
  
19 Which of the following is FALSE about references in C++
A A reference must be initialized when declared
B Once a reference is created, it cannot be later made to reference another object; it cannot
be reset
C References cannot be NULL
D References cannot refer to constant value

Answer D
 
  
20 What will be the output of following program?
#include <iostream>
using namespace std;
class Test
{
public:
 Test() { cout <<"Hello from Test() "; }
} a;
int main()
{
 cout <<"Main Started ";
 return 0;
}
A Main Started
B Main Started Hello from Test()
C Hello from Test() Main Started
D Compiler Error: Global objects are not allowed

Answer C

21 Which of the following is true about constructors.
They cannot be virtual.
 They cannot be private.
They are automatically called by new operator
A All 1, 2, and 3
B Only 1 and 3
C Only 1 and 2
D Only 2 and 3

Answer B

22 Which of the following operators are overloaded by default by the compiler?
1) Comparison Operator ( == )
2) Assignment Operator ( = )
A Both 1 and 2
B Only 1
C Only 2
D None of the two

Answer C
 
  
23 Which of the following is true about inline functions and macros.
A Inline functions do type checking for parameters, macros don't
B Macros cannot have return statement, inline functions can
C Macros are processed by pre-processor and inline functions are processed in later stages
of compilation.
D All of the above

Answer D
 
  
24 In C++, const qualifier can be applied to
Member functions of a class
Function arguments
To a class data member which is declared as static
Reference variables
A Only 1, 2 and 3
B Only 1, 2 and 4
C All
D Only 1, 3 and 4

Answer C
  
25 In C++ ..................... operator is used for Dynamic memory allocation.
A Scope resolution
B Conditional
C New
D Membership access

Answer C
  
26 What is the output of the program
#include<iostream.h>
void main()
{
int n=1;
cout<<endl<<"The numbers are;"<<endl;
do
{
cout <<n<<"\t";
n++;
} while (n<=100);
cout <<endl;
}
A Print natural numbers 0 to 99
B Print natural numbers 1 to 99
C Print natural numbers 0 to 100
D Print natural numbers 1 to 100

Answer D

  
27 Because the lifetime of a local variable is limited and determined automatically, these
variables are also called
A Automator
B Automatic
C Dynamic
D Static

Answer B

28 Which of the following header file includes definition of cin and cout?
A istream.h
B ostream.h
C iomanip.h
D iostream.h

Answer D
 
  
29 Which of the following statements regarding inline functions is correct?
A It speeds up execution
B It slows down execution
C It increases the code size
D Both A and C.

Answer D
 
  
30 Which of the following access specifier is used as a default in a class definition?
A Public
B Private
C Protected
D Friend

Answer B
 
  
31 Which of the following statements is correct in C++?
A Classes cannot have data as protected members.
B Structures can have functions as members.
C Class members are public by default.
D Structure members are private by default.

Answer B

Click to see part 3 of OOP - Classes and Objects mcqs





Publish Your Great Work

Your AD here