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

Question:
 Identify the correct sentence regarding inequality between reference and pointer.

1.we can not create the array of reference

2.we can create the Array of reference

3.we can use reference to reference

4.we can use variable


Question:
 Pick the correct statement about references in C++.

1. References stores the address of variables

2.References and variables both have the same address

3.References use dereferencing operator(*) to access the value of variable its referencing

4.References were also available in C


Question:
 Pick the correct statement about references.

1.References can be assigned value NULL

2. References once assigned cannot be changed to refer another variable

3. Reference should not be initialized when created

4.Reference is the same as pointers


Question:
 Pick the incorrect statement for namespaces in C++.

1.Namespace declarations are always global scope

2.Keyword namespace is used at the starting of a namespace definition

3.Namespace has access specifiers like private or public

4. Namespace definitions can be nested


Question:
 What is the meaning of the following declaration?

int(*ptr[5])();

1.ptr is pointer to function

2.ptr is array of pointer to function

3. ptr is pointer to such function which return type is array

4.ptr is pointer to array of function


Question:
 which keyword is used to define the macros in c++?

1.macro

2.define

3.#define

4.#macro


Question:
 Which operator is used for accessing a member of namespace?

1.:

2.::

3.->

4..


Question:
How a reference is different from a pointer?

1.A reference cannot be null

2.A reference once established cannot be changed

3.The reference doesn’t need an explicit dereferencing mechanism

4. All of the mentioned


Question:
How many types do functions fall depends on modularization?

1.1

2.2

3.3

4.4


Question:
How many types of linkages are there in C++?

1.1

2.2

3.3

4.4


Question:
How many types of macros are there in c++?

1.1

2.2

3.3

4.4


Question:
How many types of modularization are there in c++?

1.4

2.3

3.1

4.2


Question:
Identify the correct statement.

1.c++ does not have built-in interfaces

2.c++ does have built-in interfaces

3.c++ have no concept of interfaces

4. c++ does have built-in interfaces & classes


Question:
Identify the correct statement.

1.Namespace is used to group class objects and functions

2. Namespace is used to mark the beginning of the program

3.A namespace is used to separate the class objects

4.Namespace is used to mark the beginning & end of the program


Question:
Identify the incorrect statement.

1.Reference is the alternate name of the object

2.A reference value once defined can be reassigned

3.A reference value once defined cannot be reassigned

4.Reference is the alternate name of the variable


Question:
Which value can we not assign to reference?

1.integer

2.floating

3.unsigned

4.null


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

1.static

2.extern

3.static or extern

4.public


Question:
To where does the program control transfers when the exception is arisen?

1.catch

2.handlers

3.throw

4.try


Question:
To which does the function pointer point to?

1.variable

2.constants

3.function

4.absolute variables


Question:
What are the references in C++?

1.An alternative name for already existing variables

2.A pointer to a variable

3.A new type of variables

4.A new type of constant variable


Question:
What does a reference provide?

1.Alternate name for the class

2.Alternate name for the variable

3.Alternate name for the pointer

4.Alternate name for the object


Question:
What does the client module import?

1.macro

2.records

3.interface

4.instance


Question:
What is similar to the interface in c++?

1.methods

2. instance of a class

3. pure abstract class

4.methods & instance of a class


Question:
What is the ability to group some lines of code that can be included?
in the program?

1.specific task

2. program control

3.modularization

4.macros


Question:
What is the correct syntax of defining a namespace?

1.namespace name{}

2.Namespace name{};

3.namespace name{};

4.typedef namespace name{} NAME


Question:
What is the default calling convention for a compiler in c++?

1.__cdecl

2.__stdcall

3.__pascal

4.__fastcall


Question:
What is the default type of linkage that is available for identifiers?

1.internal

2.external

3. no linkage

4.single linkage


Question:
What is the difference between references and pointers?

1.References are an alias for a variable whereas pointer stores the address of a variable

2.References and pointers are similar

3.References stores address of variables whereas pointer points to variables

4.Pointers are an alias for a variable whereas references stores the address of a variable


Question:
What is the general syntax for accessing the namespace variable?

1.namespace::operator

2.namespaceoperator

3.namespace#operator

4.namespace$operator


Question:
What is the mandatory part to present in function pointers?

1.&

2.return values

3.data types

4.$


Question:
What is the mandatory preprocessor directive for c++?

1. #define <iostream>

2.#include <iostream>

3. #undef <iostream>

4.#macro <iostream>


Question:
What is the other name of the macro?

1.scripted directive

2.executed directive

3.link directive

4.executed & link directive


Question:
What is the use of Namespace?

1.To encapsulate the data

2. To structure a program into logical units

3.Encapsulate the data & structure a program into logical units

4. It is used to mark the beginning of the program


Question:
What will happen when the exception is not caught in the program?

1.error

2.program will execute

3.block of that code will not execute

4.program will execute & displays wrong output


Question:
What will happen when the handler is not found for an exception?

1.calls the standard library function terminate()

2. raise an error

3.executes the remaining block

4.raise an error and executes the remaining block


Question:
What will we not do with function pointers?

1.allocation of memory

2.deallocation of memory

3.both allocation & deallocation of memory

4.finds memory status


Question:
Which keyword is used to access the variable in the namespace?

1.using

2.dynamic

3.const

4.static


Question:
Which keyword is used to check exception in the block of code?

1.catch

2.throw

3.try

4.handlers


Question:
which of the following can be passed in function pointers?

1.variables

2. data types

3.functions

4.objects


Question:
Which of the following function must use reference.

1.Assignment operator function

2.Copy Constructor

3.Destructor

4.Parameterized constructor


Question:
Which of the following implements the module in the program?

1.macro

2.header files

3.macro & header files

4.interfaces


Question:
Which of the following is incorrect?

1.References cannot be NULL

2. A reference must be initialized when declared

3.Once a reference is declared it cannot be modified later to reference another object i.e. it cannot be reset

4.References cannot refer to a constant value


Question:
which of the following is used to implement the c++ interfaces?

1.absolute variables

2.abstract classes

3.constant variables

4.default variables


Question:
Which of the following operator is used while declaring references?

1.*

2.&

3.^

4.>


Question:
Which of the following statement(s) is/are correct?

1.operator is used to declare a reference

2.A reference variable defined to refer a particular variable can refer to any other variable also

3.References must always be initialized inside classes

4.A variable can have more than one references


Question:
Which one is used to refer to program elements in any translation units?

1.internal linkage

2.external linkage

3. no linkage

4.internal & external linkage


Question:
Which operator is used to signify the namespace?

1.conditional operator

2.ternary operator

3. scope operator

4. bitwise operator


Question:
Which reference modifier is used to define the reference variable?

1.&

2.$

3.#

4.@


Question:
Which symbol is used to declare the preprocessor directives?

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!