C/C /C Programming MCQS Set-4 Sample Test,Sample questions

Question:
 How the objects are self-referenced in a member function of that class.

1.Using a special keyword object

2.Using this pointer

3.Using * with the name of that object

4.By passing self as a parameter in the member function


Question:
 How to access the object in the class?

1.scope resolution operator

2.ternary operator

3.direct member access operator

4. resolution operator


Question:
 Pick the other name of operator function.

1.function overloading

2.operator overloading

3.member overloading

4.object overloading


Question:
 When struct is used instead of the keyword class means what will happen in the program?

1.access is public by default

2. access is private by default

3.access is protected by default

4.access is denied


Question:
 Which of the header file must be included to use stringstream?

1.<iostream>

2.<string>

3.<sstring>

4.<sstream>


Question:
Choose the operator which cannot be overloaded.

1./

2.()

3.::

4.%


Question:
Constructors are used to ___________

1. initialize the objects

2. construct the data members

3. both initialize the objects & construct the data members

4.delete the objects


Question:
How many approaches are used for operator overloading?

1.1

2.2

3.3

4.4


Question:
How many arguments will the subscript operator will take for overloading?

1.1

2.2

3.3

4.as many as possible


Question:
How many objects can present in a single class?

1.1

2.2

3.3

4.as many as possible


Question:
How to declare operator function?

1.operator sign

2.operator

3.name of the operator

4.name of the class


Question:
Identify the incorrect statement.

1.iostream is a standard header and iostream.h is a non-standard header

2. iostream is a non-standard header and iostream.h is a non-standard header

3.iostream is a standard header and iostream.h is a standard header

4.iostream is a non-standard header


Question:
In which direction does the assignment operation will take place?

1.left to right

2. right to left

3. top to bottom

4.bottom to top


Question:
To use external linkage we have to use which keyword?

1.static

2.extern

3.const

4.argc


Question:
Operator overloading is ___________

1.making c++ operator works with objects

2.giving new meaning to existing operator

3.making the new operator

4.adding operation to the existing operators


Question:
Pick out the compound assignment statement.

1. a = a – 5

2.a = a / b

3.a -= 5

4. a = a + 5


Question:
Pick out the correct statement.

1.subscript operator has a higher precedence than the assignment operator

2.subscript operator has a lower precedence than the assignment operator

3.subscript operator is used with string elements

4.subscript operator is used with char elements


Question:
Pick out the correct statement.

1.virtual functions does not give the ability to write a templated function

2.virtual functions does not give the ability to rewrite a templated function

3.virtual functions does give the ability to write a templated function

4.virtual functions does not give the ability to rewrite a simple function


Question:
Pick out the other definition of objects.

1.member of the class

2.associate of the class

3.attribute of the class

4.instance of the class


Question:
setprecision requires which of the following header file?

1.stdlib.h

2.iomanip.h

3.console.h

4.conio.h


Question:
subscript operator is used to access which elements?

1.string

2.char

3.array

4.float


Question:
The data members and functions of a class in C++ are by default _______

1.protected

2.private

3.public

4. public & protected


Question:
What do we need to do to pointer for overloading the subscript operator?

1.reference pointer

2.dereference pointer

3.store it in heap

4.memory locator


Question:
What do we need to use when we have multiple subscripts?

1.operator()

2.operator[]

3.operator

4.operator<>


Question:
What does a class in C++ holds?

1.data

2.functions

3.both data & functions

4.arrays


Question:
What does a default header file contain?

1.prototype

2.implementation

3.declarations

4.pointing


Question:
What does a mutable member of a class mean?

1.A member that can never be changed

2. A member that can be updated only if it not a member of constant object

3.A member that can be updated even if it a member of constant object

4. A member that is global throughout the class


Question:
What is operator overloading in C++?

1.Overriding the operator meaning by the user defined meaning for user defined data type

2. Redefining the way operator works for user defined types

3.Ability to provide the operators with some special meaning for user defined data type

4.All of the mentioned


Question:
What is the associativity of add(+);?

1.right to left

2.left to right

3.right to left & left to right

4.top to bottom


Question:
What is the name of | operator?

1.sizeof

2.or

3.and

4.modulus


Question:
What is the syntax of overloading operator + for class A?

1.A operator+(argument_list){}

2. A operator[+](argument_list){}

3.int +(argument_list){}

4. int [+](argument_list){}


Question:
What is the use of function call operator?

1.overloading the methods

2. overloading the objects

3.overloading the parameters

4.overloading the string


Question:
What is the use of no linkage?

1.make the entity visible to other programs

2.make the entity visible to other blocks in the same program

3.make the entity visible only to that block

4. make the entity invisible


Question:
What is the user-defined header file extension in c++?

1.cpp

2.h

3.hf

4.hg


Question:
Where does the object is created?

1.class

2.constructor

3.destructor

4.attributes


Question:
Which category of data type a class belongs to?

1.Fundamental data type

2. Derived data type

3.User defined derived data type

4.Atomic data type


Question:
Which is used to define the member of a class externally?

1.:

2.::

3.#

4.!!$


Question:
Which is used to use a function from one source file to another?

1.code

2.declaration

3.prototype

4.variable


Question:
Which keyword is used to define the user defined data types?

1.def

2.union

3.typedef

4.type


Question:
Which of the following header file does not exist?

1.<iostream>

2.<string>

3.<sstring>

4.<sstream>


Question:
Which of the following header files is required for creating and reading data files?

1.ofstream.h

2.fstream.h

3.ifstream.h

4. console.h


Question:
Which of the following is a valid class declaration?

1.class A { int x; };

2.class B { }

3.public class A { }

4.object A { int x; };


Question:
Which of the following keyword is used to declare the header file? 

1.include

2.exclude

3.string

4.namespace


Question:
Which of the following operator can be overloaded?

1.?:

2.::

3..

4.==


Question:
Which of the following operator cannot be overloaded?

1.+

2.?:

3.–

4.%


Question:
Which of the following operator cannot be used to overload when that function is declared as friend function?

1.-=

2.||

3.==

4.[]


Question:
Which of the following operators can’t be overloaded?

1.::

2.+

3.–

4.[]


Question:
Which of the following statements is NOT valid about operator overloading?

1.Only existing operators can be overloaded

2.The overloaded operator must have at least one operand of its class type

3.The overloaded operators follow the syntax rules of the original operator

4.None of the mentioned


Question:
Which of these following members are not accessed by using direct member access operator?

1.public

2.private

3.protected

4.both private & protected


Question:
Which operator is having the highest precedence in c++?

1.array subscript

2.Scope resolution operator

3.static_cast

4.dynamic_cast


Question:
Which other keywords are also used to declare the class other than class?

1.struct

2.union

3.object

4. both struct & union


Question:
Which special character is used to mark the end of class?

1.;

2.:

3.#

4.$


More MCQS

  1. C++ Programming MCQS Set-1
  2. C++ Multiple Choice Questions Set-1
  3. C++ Multiple Choice Questions Set-2
  4. C++ Programming MCQS Set-2
  5. C++ Programming MCQS Set-3
  6. C++ Programming MCQS Set-4
  7. C++ (CPP) MCQ Question with Answer
  8. Advanced c++ multiple choice question(MCQS)
  9. OOPS Quiz Questions and Answers(MCQS)
  10. C Programming - MCQ Questions Set 1
  11. C Programming - MCQ Questions Set 2
  12. C Programming - MCQ Questions Set 3
  13. C Programming - MCQ Questions Set 4
  14. C Programming - MCQ Questions Set 5
  15. C++ programming language MCQ Questions Set 1
  16. C++ programming language MCQ Questions Set 2
  17. C++ programming language MCQ Questions Set 3
  18. C++ programming language MCQ Questions Set 4
  19. C++ programming language MCQ Questions Set 5
  20. C++ Programming -Constructors and Destructors
  21. C++ Programming -OOPS Concepts
  22. C++ Programming - References
  23. C++ Programming - Functions
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!