• No results found

Objective Questions

N/A
N/A
Protected

Academic year: 2021

Share "Objective Questions"

Copied!
19
0
0

Loading.... (view fulltext now)

Full text

(1)

1. C++ was originally developed by

Nicolas Wirth Donald Knuth Bjarne Stroustrup Ken Thompson Ans : 3

2. The standard c++ comment

/ // /* and */ None of these

Ans : 2

3. The preprocessor directive #include is required if Console output is

used used Console input is and output is used Both console input None of these Ans : 3

4. The operator << is called an insertion

operator put to operator either a or b None of these Ans : 3

5. The operator >> is called an extraction

operator operator a get from either a or b get to operator Ans : 3

6. When a language has the capability to produce new data type, it is called

Extensible Overloaded Encapsulated Reprehensible Ans : 1

7. The C++ symbol << perform the action of sending the value of expression listed as its right to the outputs strewn as the left.

is used to indicate the action from right to left

is adopted to

resemble an arrow All the above

Ans : 4

8. C++ name was suggested by

Rrick Mascitti Bjarne Stroustrup Donald Knuth Ken Thompson Ans : 1

9. What is a reference?

(2)

alias for an object an object Ans : 2

10. A constructor is called whenever a object is

declared an object is used a class is declared a class is used Ans : 1

11. State the object oriented languages

C++ Java Eiffel All of the above

Ans : 4

12. Overload function in C++

a group function with the same name

all have the same number and type of arguments

functions with same name and same number and type of arguments

All of the above

Ans : 1

13. Operator overloading is making c++

operators works with objects

giving new meaning to existing c++ operators

making new c++

operator both a& b above Ans : 4

14. A constructor is called whenever a object is

declared an object is used a class is declared a class is used Ans : 1

15. A class having no name

is not allowed can't have a constructor can't have a destructor can't be passed as an argument Ans : 3

16. The differences between constructors and destructor are

constructors can take arguments but destructor can't

constructors can be overloaded but destructors can't be overloaded

both a & b None of these

Ans : 3

(3)

one argument two arguments three arguments Zero arguments Ans : 4

18. Constructors are used to initialize the

objects

construct the data

members both a & b None of these Ans : 1

19. In C++ a function contained with in a class is called a member

function an operator a class function a method Ans : 1

20. The fields in a class of a c++ program are by default

protected public private None of these

Ans : 3

1. The meaning of conversion character for data input is

Data item is a long integer Data item is an unsigned decimal integer Data item is a

short integer None of the above Ans : 3

2. The conversion characters for data input means that the data item is An unsigned

decimal integer A short integer

A hexadecimal integer

A string followed by white space Ans : 4

3. An expression contains relational, assign. ment and arithmetic operators. If Parenthesis are not present, the order will be

Assignment, arithmetic, relational Relational, arithmetic, assignment Assignment,

relational, arithmetic relational, assignment Arithmetic, Ans : 4

4. Which of the following is a key word is used for a storage class

printf external auto scanf

Ans : 3

5. In the C language 'a’ represents

a digit an integer a character a word Ans : 3

(4)

6. The number of the relational operators in the C language is

Four Six Three One

Ans : 2

7. A compound statement is a group of statements included between a pair of

double quote curly braces parenthesis a pair of /’s Ans : 2

8. A Link is

a compiler debugger an active a C interpreter C a analyzing tool in Ans : 4

9. The continue command cannot be used with

for switch do while

Ans : 2

10. In C, a Union is

memory location memory store memory screen None of these Ans : 1

11. When the main function is called, it is called with the arguments

argc argv None of these both a & b

Ans : 4

12. A multidimensional array can be expressed in terms of array of pointers

rather than as

pointers to a group of contiguous array

array without the group of contiguous

array data type arrays None of these Ans : 1

13. C allows arrays of greater than two dimensions, who will determined this

programmer compiler parameter None of these Ans : 2

14. A pointer to a pointer in a form of multiple

indirection a chain of pointers both a and b None of these Ans : 3

(5)

15. Pointers are of

integer data type character data type

unsigned integer

data types None of these Ans : 4

16. Maximum number of elements in the array declaration int a[5][8] is

28 32 35 40

Ans : 4

17. If the size of the array is less than the number of initializers then, Extra values are

being ignored Generates an error message Size of Array is increased Size is neglected when values are given Ans : 2

18. Array subscripts in C always start at

-1 1 0 user Value provided by

Ans : 2

19. A Structure

can be read as a

single entity a single entity cannot be read as as a single entity can be displayed

has member variables that cannot be read individually Ans : 2

20. Identify the invalid pointer arithmetic

Addition of float value to a pointer

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

Subtracting an integer from a pointer

Assigning the value 0 to a pointer variable

Ans : 1

1. The meaning of conversion character for data input is

Data item is a long integer Data item is an unsigned decimal integer Data item is a

short integer None of the above Ans : 3

2. The conversion characters for data input means that the data item is An unsigned

decimal integer A short integer

A hexadecimal integer

A string followed by white space Ans : 4

(6)

3. An expression contains relational, assign. ment and arithmetic operators. If Parenthesis are not present, the order will be

Assignment, arithmetic, relational Relational, arithmetic, assignment Assignment,

relational, arithmetic relational, assignment Arithmetic, Ans : 4

4. Which of the following is a key word is used for a storage class

printf external auto scanf

Ans : 3

5. In the C language 'a’ represents

a digit an integer a character a word Ans : 3

6. The number of the relational operators in the C language is

Four Six Three One

Ans : 2

7. A compound statement is a group of statements included between a pair of

double quote curly braces parenthesis a pair of /’s Ans : 2 8. A Link is a compiler an active debugger a C interpreter a analyzing tool in C Ans : 4

9. The continue command cannot be used with

for switch do while

Ans : 2

10. In C, a Union is

memory location memory store memory screen None of these Ans : 1

11. When the main function is called, it is called with the arguments

argc argv None of these both a & b

Ans : 4

(7)

array of pointers rather than as

pointers to a group of contiguous array

array without the group of contiguous

array data type arrays None of these Ans : 1

13. C allows arrays of greater than two dimensions, who will determined this

programmer compiler parameter None of these Ans : 2

14. A pointer to a pointer in a form of multiple

indirection a chain of pointers both a and b None of these Ans : 3

15. Pointers are of

integer data type type character data data types unsigned integer None of these Ans : 4

16. Maximum number of elements in the array declaration int a[5][8] is

28 32 35 40

Ans : 4

17. If the size of the array is less than the number of initializers then, Extra values are

being ignored error message Generates an increased Size of Array is when values are given Size is neglected Ans : 2

18. Array subscripts in C always start at

-1 1 0 user Value provided by

Ans : 2

19. A Structure

can be read as a

single entity a single entity cannot be read as as a single entity can be displayed

has member variables that cannot be read individually Ans : 2

20. Identify the invalid pointer arithmetic

(8)

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

(9)

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

(10)

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

(11)

: ; !

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

(12)

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

(13)

delete

Both A and B

None of the Above Ans c

Which of the following is allowed for the value of subscript variable? Positive Integer

Negative Integer Both A and B Float

Ans a

The isolation of data from direct access by a C+ program is called as Data Hiding

Data Isolation Data Encapsulation None of the Above Ans a

Which of the following is used to store data of different types? Arrays

Structures Both A and B

None of the Above Ans b

The operator that denotes address 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

(14)

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

(15)

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

(16)

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

(17)

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

(18)

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

(19)

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

References

Related documents

The northern fur seal (NFS) population on the Pribilof Islands (PI) is currently declining while the population on the Commander Islands (CI which includes Bering and Medny

For years, wheat-related weight loss has been observed in patients with celiac disease, who must eliminate all foods containing gluten from their diets to halt an immune response

While we cannot differentiate between these factors, data limitations notably imply that this picture of the ownership distribution likely constitutes a lower bound for the degree

Despite the fact that there is a number of significant gaps in the international legislation with the purpose of protection of the Arctic marine environment

D = demand rate for an item (quantity/unit time) y = the order quantity = maximum inventory level K = the setup cost every time an order is placed h = the holding cost per item

d) Coefficient estimates used to compute the counterfactual are taken from the model specification involving only country years without participation in IMF loan programs... Table

the total variance observed in the study, internet experience consists of 3 statements: With my experience using the internet, buying herbal products online would be easy (0.815),