BT0074 Trash



Subject : OOPS with Java (BT0074 )



PART A

Q.1

Given-char str [256];
how many characters at most can be actually
stored in the array?

 

A)

256

 

B)

255

 

C)

0

 

D)

None of these

 

Q.2

What is the output of the following
expression when executed? int y--5; int x = y >
= 2 ? y < 10 ? I : 0 1 cout < < X ;

 

A)

10

 

B)

I

 

C)

0

 

D)

#NAME?

 

Q.3

The syntax for multiple inheritance is

 

A)

de name (): be name1()+be name2() {}

 

B)

de name1 ()+dename2(): be name1()+be name2(){}

 

C)

de name () : be name1 () be name2 () {}

 

D)

de name1 (),de anme2(): be name1(), bename2() {}

 

Q.4

Out of the following choose the correct
statement.

 

A)

String constant can be split

 

B)

# include are written in multiple line

 

C)

/ / is used to indicate white spaces

 

D)

Escape sequences are denoted by\operator

 

Q.5

____ decribes the data and its behaviour or
functionality

 

A)

Object

 

B)

Function

 

C)

Class

 

D)

Member

 

Q.6

If a data item in a class is defined as ____,
then only one such item is created for the
entire class, no matter how many objects there
are

 

A)

Public

 

B)

Private

 

C)

Protected

 

D)

Static

 

Q.7

An event that causes suspension of normal
application execution is called

 

A)

Exception

 

B)

Abnormality

 

C)

Template

 

D)

None of these

 

Q.8

Name the function that is used to clear the
screen and position the cursor at 0, 0 in the
graphics mode

 

A)

clearscreen

 

B)

clrscr ( )

 

C)

cleardevice

 

D)

None of these

 

Q.9

An abstract class is useful when

 

A)

no objects should be instantiated from it

 

B)

no classes should be derived from it

 

C)

there are multiple paths from one derived class to another

 

D)

You want to defer the declaration of the class

 

Q.10

Deriving new class

 

A)

Does not allow to redefine member functions

 

B)

Can not add new member functions

 

C)

Allow to use all member function of base class

 

D)

Not supported in c++

 

Q.11

____ is a data type, which is used to define
a heterogeneous set of data types or a set of
data items belonging to different data types

 

A)

void

 

B)

char

 

C)

structure

 

D)

array

 

Q.12

Items declared as _ are private within a
class and are available for access in the derived
class to.

 

A)

private

 

B)

public

 

C)

protected

 

D)

None of the above

 

Q.13

If y = 2, what is the value of x after
executing the expression x = ++y ?

 

A)

2

 

B)

3

 

C)

1

 

D)

None of these

 

Q.14

____ is a self contained unit or module of
data and code

 

A)

Object

 

B)

Class

 

C)

Function

 

D)

Member

 

Q.15

____ is a class whose instances themselves
are classes

 

A)

Parametrized class

 

B)

Monolithic class

 

C)

Metaclass

 

D)

None of these

 

Q.16

The command line parameters used by a
C++ program is

 

A)

argc

 

B)

argv

 

C)

Both A) and B)

 

D)

Neither A) nor B)

 

Q.17

___ parameter receives the argument
passed to it and works on it directly

 

A)

Value parameter

 

B)

Default parameter

 

C)

Reference parameter

 

D)

None of these

 

Q.18

The function not use to concatenation of
two strings is

 

A)

strcpy

 

B)

strcat

 

C)

+

 

D)

get()

 

Q.19

The string.h file does not contain - function

 

A)

strcmp

 

B)

strcat

 

C)

gets

 

D)

None of these

 

Q.20

When overloading a function in the same
class, which of these has to be the same?

 

A)

the return type

 

B)

the types of the parameters

 

C)

the number of parameters

 

D)

the name of the function

 

Q.21

____ function operator is used to identify a
destructor

 

A)

~

 

B)

>> 

 

C)

&

 

D)

None of these

 

Q.22

The _ concept of OOP allows hiding of both
the data fields and the methods that act on the
data, inside the object

 

A)

Inheritance

 

B)

Polymorphism

 

C)

Encapsulation

 

D)

None of these

 

Q.23

____ members can be accessed by
members and objects of the class

 

A)

Public

 

B)

Protected

 

C)

Private

 

D)

Static

 

Q.24

The ____ statements can not be used
outside a loop

 

A)

break

 

B)

continue

 

C)

Both A) and B)

 

D)

None of these

 

Q.25

The most common bug with pointer is

 

A)

Invalid address in pointer address

 

B)

Encoding pointer within other loop

 

C)

Pointer pointing to the object

 

D)

In the sorting operation

 

Q.26

Out of following choose the correct one

 

A)

Public items are not accessible from own class

 

B)

Protected items are accessible from objects out side the class

 

C)

Private items are accessible from derived class

 

D)

Protected items are accessible from derived class

 

Q.27

____ class cannot be instantiated, though
pointers can be declared to it

 

A)

virtual

 

B)

friend

 

C)

abstract

 

D)

superclass

 

Q.28

___ function is used as a limit to the
compiler to expand and substitute the body of
the function in place of the call

 

A)

Friend

 

B)

Virtual

 

C)

Inline

 

D)

Static

 

Q.29

Which of the following do you think is used to
separate the base classes in a base class list?

 

A)

Comma (,)

 

B)

Colon (:)

 

C)

C) Semi-colon (;)

 

D)

Tilde (~)

 

Q.30

_____ statement in C++ can be use to
accomplish multi-way branching

 

A)

goto construct

 

B)

Nested if -then-else construct

 

C)

switch-case construct

 

D)

All of these

 

Q.31

Which of these statements about the 'this'
pointer is false?

 

A)

It stores the address of the class instance to enable pointer access of' (lie members to the member functions of the class

 

B)

It is not accessible by static member functions

 

C)

It cannot be modified

 

D)

D)None of these

 

Q.32

Virtual functions which are declared with
the keyword virtual in the ____ class

 

A)

Derived

 

B)

Base

 

C)

Destination

 

D)

Source

 

Q.33

Which of these is not valid in ci-f?

 

A)

I+47 as integer value

 

B)

2000 as string constant

 

C)

12.5 as float constant

 

D)

None of these

 

Q.34

Separate code to handle the error is written
in which section?

 

A)

Exception

 

B)

Try

 

C)

Throw

 

D)

Catch

 

Q.35

____ implies a kind of " relationship”

 

A)

Aggregation

 

B)

Polymorphism

 

C)

Containership

 

D)

None of these

 

Q.36

Which of these is not a feature of C++?

 

A)

Multiple Inheritance

 

B)

Pointers to class members

 

C)

Data Extraction

 

D)

None of these

 

Q.37

Can be viewed as a "fill in the blanks"
version of a class

 

A)

Template

 

B)

Meta class

 

C)

Friend class

 

D)

None of these

 

Q.38

What is used to convert a class type to Basic
type?

 

A)

Constructor in source

 

B)

Constructor destination

 

C)

Conversion function in destination

 

D)

Conversion function in source

 

Q.39

The first operation to be done after
scanning source file is

 

A)

Run Linking

 

B)

Run compiling

 

C)

B) Run Run

 

D)

None of these

 

Q.40

____ variables -are automatically initialized
to zero

 

A)

Register

 

B)

Static

 

C)

Global

 

D)

Both B) and C)

 

Q.41

Which files are created by storing a block of
memory?

 

A)

ASCIL

 

B)

Text

 

C)

Binary

 

D)

Sequential

 

Q.42

Array is collection of

 

A)

Declared data

 

B)

Un declared data

 

C)

Homogeneous data

 

D)

Heterogeneous data

 

Q.43

Making a date object frorn a month object,
a day object and a year object is an example of

 

A)

Aggregation

 

B)

Specialization

 

C)

Instantiation

 

D)

None of these

 

Q.44

____ function appears to perform different
activities depending on the kind of data to be
sent to it.

 

A)

Virtual

 

B)

Static

 

C)

Overloaded

 

D)

None of the above

 

Q.45

____ is used in C++ to create a symbolic
constant

 

A)

const keyword

 

B)

# define directive

 

C)

typedef keyword

 

D)

None of these

 

Q.46

C++ uses binding of ______ functions by
default

 

A)

static

 

B)

virtual

 

C)

dynamic

 

D)

None of these

 

Q.47

To write data that contains variables of type
float to an object of type of stream, you should
use

 

A)

the insertion operator

 

B)

seekg ()

 

C)

write ()

 

D)

Put ()

 

Q.48

In multiple inheritance, when both base
class have function with same name

 

A)

You can not call the function

 

B)

You have to call the function indicating the derived class in the statement

 

C)

Indicate the base class name in the calling statement

 

D)

You can not derive such functions.

 

Q.49

Which operator obtains memory from the
operating system and returns a pointer to its
strating point?

 

A)

alloc

 

B)

malloc

 

C)

get

 

D)

new

 

Q.50

Which of the following is used to identify
the copy constructor?

 

A)

(X&)

 

B)

X(&X)

 

C)

X(X&)

 

D)

X(X)

 

Q.51

To write date directly in to an ASCII file,
using the insertion operator (<
<), we need an >object of class

 

A)

istrearn

 

B)

ostream

 

C)

ios

 

D)

ofstream

 

Q.52

To solve the problem of ambiguity when
inheriting from a common base class, the ____
keyword is applied before its name in the
derived class header

 

A)

abstract

 

B)

virtual

 

C)

static

 

D)

None of these

 

Q.53

Base classes are ___ while derived classes
are ____

 

A)

specializations, sub classes

 

B)

generalizations, specializations

 

C)

generalizations, super classes

 

D)

None of these

 

Q.54

The default access for members of a class is
____

 

A)

Public

 

B)

Private

 

C)

C) Global

 

D)

Protected

 

Q.55

Object oriented programming

 

A)

Software development technique

 

B)

Set of operations

 

C)

Set of instructions

 

D)

Set of blocks

 

Q.56

____ function sets the fill pattern and color

 

A)

floodfill ()

 

B)

setcolor ()

 

C)

setfillstyle ()

 

D)

fillstyle ()

 

Q.57

The short cut keys used to run the C++
program is

 

A)

CTRL + F8

 

B)

CTRL + F9

 

C)

B) CTRL + F5

 

D)

ALT + F5

 

Q.58

Dynamic memory can be deallocated using

 

A)

destructor function

 

B)

delete keyword

 

C)

a heap

 

D)

None of these

 

Q.59

_____occupies 4 bytes storage space

 

A)

Int

 

B)

Long int

 

C)

Unsigned Int

 

D)

Float

 

Q.60

The max permissible characters in a
variable name is

 

A)

16

 

B)

32

 

C)

64

 

D)

None of these

 

Q.61

The user define header file can be included

 

A)

Any where in the program code

 

B)

Before use of functions in the program code

 

C)

In the first few line of program code

 

D)

As first few line before main function of program code

 

Q.62

If "sum 10 20 30" is typed at the command
prompt what is the value of*argv [3] in the
main ( )?

 

A)

30

 

B)

20

 

C)

undefined

 

D)

None of these

 

Q.63

class used to derive other class are

 

A)

Base class

 

B)

Derived class

 

C)

Abstract class

 

D)

Inherit class

 

Q.64

To handle exceptions, the keyword to b e
used is

 

A)

throw

 

B)

catch

 

C)

DETECT

 

D)

D)None of these

 

Q.65

The highest address for 640k memory is

 

A)

65535

 

B)

131040

 

C)

125535

 

D)

None of these

 

Q.66

The first graphic library function to be
executed is

 

A)

detectgraph ()

 

B)

initgraph ()

 

C)

window ()

 

D)

None of these

 

Q.67

Which of these interfaces of an object must
be defined when creating an instance of a
template?

 

A)

The "public" interface

 

B)

The "inheritance" intert'acc

 

C)

The "parameter" interface

 

D)

All of these

 

Q.68

is the base class in the 1/0 stream class
hierarchy of C++

 

A)

istream

 

B)

ostream

 

C)

ios

 

D)

ofstream

 

Q.69

If a is an object of class A and b is a pointer
to the object a, which of these is an incorrect
way to access the static display function defined
in class A?

 

A)

a.display ( );

 

B)

(*b).display

 

C)

A:display( )

 

D)

None of these

 

Q.70

Function is used to draw a circle in graphics
mode

 

A)

arc ( ... )

 

B)

circle ( ... )

 

C)

ellipse ( ... )

 

D)

None of these

 

Q.71

The default access permission for a class
member is

 

A)

private

 

B)

protected

 

C)

public

 

D)

None of these

 

Q.72

Which of these is an example of an
assignment operator?

 

A)

&&

 

B)

||

 

C)

= =

 

D)

=

 

Q.73

The base class for stream class is

 

A)

ios

 

B)

istream

 

C)

ostream

 

D)

None of these

 

Q.74

An array element is accessed using

 

A)

a first-in first-out approach

 

B)

the dot operator

 

C)

the member name

 

D)

an index number

 

Q.75

Redirection of files is implemented by using
____ operator

 

A)

A)>>

 

B)

 

C)

 

D)

None of these

 

Q.76

Is to used to change a sentence str into
upper case

 

A)

toUpperCase (str)

 

B)

strupr (str)

 

C)

stmcat (str)

 

D)

All of these

 

Q.77

Which statement is used to declare
templates?

 

A)

template

 

B)

template

 

C)

template class

 

D)

template T

 

Q.78

The && and // operators

 

A)

compares two numeric values

 

B)

combines two numeric values

 

C)

compares two Boolean values

 

D)

combines two Boolean values

 

Q.79

____ function writes string of text to the
window

 

A)

cputs ()

 

B)

putch

 

C)

window cputs ()

 

D)

window putch ()

 

Q.80

What is the use of the following statement?
Seekg (-5,ios::end);

 

A)

moves the get pointer 5 bytes backward from the end of the file

 

B)

moves the get pointer 5 bytes forward from the beginning of the file

 

C)

moves the put pointer 5 bytes backward from the end of the file

 

D)

moves the put pointer 5 bytes forward from the beginning of the file



PART B

Q.1

Which of these gives the correct
hierarchy of C++ operators from highest to
lowest precedence ?

 

A)

+, < =, &&

 

B)

++, + =, &&

 

C)

&&1 ++1 < =1 =

 

D)

++, < =, &&, +

 

Q.2

What does the following code represent?
Class A
{};
class B
{A a;}

 

A)

Inheritance

 

B)

Derived class

 

C)

Containership

 

D)

Polymorphism

 

Q.3

Identify the valid modes for opening files
in C++.
i) app
ii) binary
iii) ate
iv) out

 

A)

i) and iii)

 

B)

ii) and iv)

 

C)

i) and iv)

 

D)

All of i) to iv)

 

Q.4

Match the flollowing terms in Set A with
their definitions in Set B Set-A i) Static variable
ii) Register variable iii) Extern variable Set-B a.
global variable defined in a file and referred to
in other files b. a local ly-access ib le va

 

A)

i) - d, ii) - b, iii) - a

 

B)

i) ~ a, ii) - d, iii) - c

 

C)

i) - b, ii) - c, iii) - a

 

D)

None of these

 

Q.5

The base class of flow of data is
1. iostream
2. ios
3. istream
4. Ostream

 

A)

Only 1 and 2

 

B)

Only 2

 

C)

Only 2, 3 and 4

 

D)

Only 1

 

Q.6

The output of the following code if input is
32767 #include
void main()
{
int union;
cout<
<”Enter the integer”; >cin>union;
cout>> “The next number in the series is”<<
**union;
}

 

A)

23768

 

B)

Run time error

 

C)

Compilation error

 

D)

32767

 

Q.7

Fill in the blanks from the given set of
words.
"Run-time polymorphism is implemented by
using
i) Operator overloading
ii) Inheritance
iii) Virtual functions
iv) Function overloading

 

A)

ii) and iii)

 

B)

i) and iv)

 

C)

iii) and iv)

 

D)

None of these

 

Q.8

in C++
1. A member function in base class can be used
by objects if derived class
2. The protection can be decreased in derived
classes
3. Base class can not use any data members of
derived class

 

A)

Only 1 and 3 are correct

 

B)

Only 1 and 2 are correct

 

C)

Only 2 and 3 are correct

 

D)

All 1, 2 and 3 are correct

 

Q.9

In the following code segment, locate the
errors and correct them this code is written to
calculate area of a triangle using the formula
A =1/2 * base * height // upto two digits of
precision
class Shape ( int base, int height) // Line

 

A)

Computation at line 3 will always result in zero; type-casting is required

 

B)

Line 2 has to be modified to allow compute to return a real number upto 2 digits of precision

 

C)

Both A) and B)

 

D)

There are no errors ; now the function is required that will call compute ( ) and get the result

 

Q.10

What is the output of the following code
fragment when executed? int n = 1; for ( ; n ; )
if (n > 2)
continue;
else
cout << n +;

 

A)

Compilation errors

 

B)

Runtime errors

 

C)

output of I and 2 & then terminates

 

D)

output of I and 2 and then infinite loop

 

Q.11

Fill in the blanks
i) When an object of a _____ is created, the
base class constructor is executed followed by
its own constructor
ii) ___ are applied in the reverse order in a
class hierarchy

 

A)

friend class, templates

 

B)

derived class, destructors

 

C)

base class, constructors

 

D)

abstract class, inline function

 

Q.12

dentify the situations where inline
expansion may not work
1) If a loop, a switch or goto exists in functions
returning values
2) If a return statement exists, for functions not
returning valves
3. If functions contain static varia

 

A)

1), 2), 3)

 

B)

2), 3), 4)

 

C)

1), 3), 4)

 

D)

1), 2), 3), 4)

 

Q.13

The life time of static storages are for ____
and storage is done in _____

 

A)

A). Program; stack segment

 

B)

Function; data segment

 

C)

Program; data segment

 

D)

Function; stack segment

 

Q.14

What is the result in the variable len after
execution of the following statements?
int len;
char strl[] = {“39 March Road”};
len=strlen( strl);

 

A)

11

 

B)

12

 

C)

13

 

D)

14

 

Q.15

Assuming the Nbr variable has to be
declared as a reference variable, which of the
following is a valid way to do it?

 

A)

int &Nbr;

 

B)

int& Nbr;

 

C)

int & Nbr:

 

D)

All of above

 

Q.16

A home ___ house that ____ a family &
pets

 

A)

has a, is a

 

B)

is part of, is a

 

C)

is a, has a '

 

D)

None of these

 

Q.17

Which of the following are legal C++
variable names?
1) Counter 1
2) 123
3) register
4) tor_sal

 

A)

1), 3)

 

B)

2), 3), 4)

 

C)

1), 3)

 

D)

1), 2), 3), 4)

 

Q.18

The different modes for opening files are
1) in
2) out
3) inout
4) ate
5) app

 

A)

1), 2), 4) and 5)

 

B)

1), 2), 3) and 4)

 

C)

2), 3), 4) and 5)

 

D)

1), 2) and 3)

 

Q.19

What is the value of a and x?
int i=5;
a=i++;
x=++i;

 

A)

a=5, x=6

 

B)

a=5, x=7

 

C)

a=6, x=7

 

D)

a=5, x=5

 

Q.20

Which of these is not a correct way to
initialize arrays in C++?

 

A)

char n(5); For (int i=1; i<=5; i++) Cin >> n[i];

 

B)

char name [5] = "0011";

 

C)

static int n[2] [31 = 1 1 2, 4, 1 1, 2, 3

 

D)

None of the above

 

Q.21

Which of these is true?
i) Private members can be accessed only by the
class in which they are declared and by any
friend classes & functions
ii) Protected members are private within the
class in which they are declared & are availabl

 

A)

i) only

 

B)

ii) only

 

C)

Both i) and ii)

 

D)

None of these

 

Q.22

Consider the following c++ program
segment
char p[20]; char *s = "string": int length =
strlen (s);
for (i =0; i< length ; i++) P[i] stlength - il cout
<< P;
what is the output of the above code?

 

A)

gnirts

 

B)

string

 

C)

grurt

 

D)

No output is printed

 

Q.23

Which of these declarations of functions
that use default arguments is wrong'?

 

A)

void Error (char*msg, int severity = 0);

 

B)

void Error (char*msg = "Bomb", int severity);

 

C)

Both A) and B)

 

D)

None of these

 

Q.24

The ____ can be used to declared structure
variable and ____ within the template.

 

A)

tag-name; can not be initialized

 

B)

tag-name; can be initialized

 

C)

key word; can not be initialized

 

D)

key word; can be initialized

 

Q.25

Which of the following is a valid signature
for overloading the preincrement operator?
i) void operator ++ ( )
ii) void operator ++ (float)

 

A)

i) only

 

B)

ii) only

 

C)

Both A) and B)

 

D)

None of these

 

Q.26

Which of the following operators can be
overloaded in C++ ?

 

A)

 

B)

=

 

C)

C)? :

 

D)

None of these

 

Q.27

Which statement are true with respect to
static data members?
1) It id initialized to zero when the first object
of its class is created
2) Only one copy of that member is created for
the entire class
3) It is visible and its lifet

 

A)

1), 3)

 

B)

1), 2)

 

C)

2), 3)

 

D)

1), 2), 3)

 

Q.28

____ describes data and its functionality
and its member are called____

 

A)

functions; object

 

B)

class; object

 

C)

class; functions

 

D)

objects; class

 

Q.29

The ostream class includes
1) Put()
2) get()
3) putline()
4) getline()
5) write()
6) read()

 

A)

1), 3) and 5)

 

B)

2), 4) and 6)

 

C)

1), 2), 3) and 4)

 

D)

3), 4), and 5)

 

Q.30

Identify the statements that have error
1) cout << “x=” x;
2) cin>>x;>>y;
3) /9Addition */z = x+y;
4) cout<<<name;

 

A)

2), 3), 4)

 

B)

1), 3)

 

C)

1), 2), 4)

 

D)

1), 2), 3), 4)

 

Q.31

Which of these is the correct way to accept
a sentence of 25 characters maximum, from
the user into char str [25] in C ++?

 

A)

scatift"%s", str),

 

B)

cin.getLine (str, 25, '\n');

 

C)

cin.getline (str, '\'n'),

 

D)

None of these

 

Q.32

In C++ ___ denotes escape characters and
___ denotes single line comment

 

A)

// and /

 

B)

/ and */

 

C)

/ and //

 

D)

* and /n

 

Q.33

The advantages of OOP are
1) increased programming productivity
2) increased maintenance cost
3) decreased programming productivity
4) Decreased maintenance cost

 

A)

Only 1)

 

B)

2) and 3)

 

C)

Only 2)

 

D)

1) and 4)

 

Q.34

Match the following
Set – A
1) ::
2) ::
3)
Set – B
a) Pointer – to member declarator
b) Pointer – to member operator
c) Scope resolution operator

 

A)

1) – c), 2) – a), 3) – b)

 

B)

1) – a), 2) – b), 3) – c)

 

C)

1) – c), 2) – b), 3) – a)

 

D)

1) – b), 2) – c), 3) – a)

 

Q.35

How would you make use of the class
defined in Q.46 above and get-breadth of a
triangle computed if base and height are equal
to 10

 

A)

main() f Shapes (10, 10); cout << s.compute

 

B)

main shape s1 * s2; s2 & sl; s1.getdata //H 10, 10 should be entered by H user cout << * s2.compute

 

C)

main shape tri; tri. getdata //Huser enters 10, 10 cout << tri.compute

 

D)

D)None of the above

 

Q.36

Which of these code fragments gives the
correct way to declare an array of pointers to
object of class 'person' and initialize them using
a predefined function 'getdata ( ) ?

 

A)

person *p ~ new person [10], for (int i = 0 ; i < 10 ; i + +) p[i]->getdata ( );

 

B)

person *P [10] = new person; for (int i = 0 ; i < 10; i++) p[i]->getdata

 

C)

Both A) and B)

 

D)

None of these

 

Q.37

Consider the following command given at
the DOS prompt _ CA> multiply 10 20 30 Here
"multiply" is _
i) the name of the function performing
multiplication
ii) the name of the file containing the program
for multiplication

 

A)

i) only

 

B)

ii) only

 

C)

Both A) and B)

 

D)

None of these

 

Q.38

In C++
1. User define header files are specified as #
include “abc.h”
2. User defined header files are defined as #
include ‘abc.h’
3. The template written for a base class can be
used in derived class

 

A)

Only 1and 2 are correct

 

B)

Only 1 and 3 are correct

 

C)

Only 2 and 3 are correct

 

D)

Only 3 are correct

 

Q.39

____ and____ operators can not be over
loaded

 

A)

:: : +

 

B)

*; ::

 

C)

C).:*

 

D)

D)-;.

 

Q.40

What is the Output of the following
function
int f;
int n =5;
static int i =1;
if(n>=5)
return i;
else
return n;

 

A)

5

 

B)

6

 

C)

7

 

D)

8



PART C

Q.1

Using tile precedence of' operators, predict
the Output of the following code segment
main()
int i = 1, j=2 ;
if ( i =--j >2)
cout<< i<
<1l% >else
cout<<"Bye<<"\n";
cout<<”value of i is”><<I;

 

A)

1 Value of i is 0

 

B)

Bye Value of i is1

 

C)

1 Value of

 

D)

None of these

 

Q.2

Which of these is not a category of
suffered operations?
i) Primitive operations
ii) Selectors
iii) Selective operators
iv) Constructors
v) Exceptions

 

A)

ii) and iii)

 

B)

i) and v)

 

C)

iii), iv) and

 

D)

None of these

 

Q.3

What is the output after executing the
code below'?
class A
int a ;
public : void showA
cout << a;
class B
int b;
public: void showB;
cout << b;
class C :public A, public B
void main ()
b.showB //Hline 1 <br

 

A)

i) only

 

B)

ii) only

 

C)

i) and ii)

 

D)

ii) and iii) catch

 

Q.4

Carefully go through the following program
1. # include
2. class myclass{
3. private
4. int num
5. public
6. myclass() {num = 0;}
7. myclass(int n) { num = n;}
8. –myclass();
9. void getdata()
10. { cin>

 

A)

1, 6, 8, 15, 18, 20

 

B)

3, 8, 11, 15, 18

 

C)

2, 5, 10, 12, 16, 19

 

D)

3, 10, 14, 17, 20

 

Q.5

Which of these statements are true?
i) The tellp ( ) function returns the current class
hierarchy
ii) To create an output text file, we need an
object of the ofstream class
iii)The cin object and the position of the put
pointer in

 

A)

i) and iii)

 

B)

ii) and iv)

 

C)

All of i) to iv)

 

D)

None of these

 

Q.6

What call you correctly infer about the
following two statements?
time T2 (T1); //line 1
time T2 = T1 ; //line 2
i) time is a class and TI andT2 are its objects
ii) line 2 is an example of operator overloading
functions used for <b

 

A)

i), ii) and iii)

 

B)

i), iii) and iv)

 

C)

i) and ii)

 

D)

None of these

 

Q.7

What would be output by the following
segment of C++?
int fact I;
fact = 1
i = 2
while(i < =6)
fact *= i;
i++;
cout << fact;

 

A)

2, 6, 24, 120, 720

 

B)

1, 2, 6, 24, 120

 

C)

2, 2, 6, 24, 120

 

D)

1, 1, 1, 6, 24

 

Q.8

Select one of the following functions to
replace the comment 4,1/here" so that the
display of Base class is overridden to give
output after execution as b =1
class Base int i;
public: Base i=5;
void display ( ) ~ cout <<"i = "<< i;

 

A)

void display ( ) 1 cout << -b="<< + + b ; )

 

B)

display ( ) b = - cout << b = "<< b; return b;)

 

C)

void display cout << "b= << b + +

 

D)

None of these

 

Q.9

Given the following code
struct std
{
char name[20], grade;
int rollno; int mark[2]
};
What are the valid ways to access the
members?

 

A)

std.name std.grade, std.rollno, std.mark[0]

 

B)

std.name[0], std.grade, std.rollno, std.mark[0]

 

C)

std.name, std.grade, * std.rollno, std.mark

 

D)

* std.name, * std.grade, * std.rollno, * std.mark

 

Q.10

Which of the following statements is true
about friend functions?
i) Friend functions cannot use member names
directly; it has to use an object to access any
member of the class
ii) Friend functions can have objects as
arguments <b

 

A)

i) and iii)

 

B)

ii) and iv)

 

C)

ii) and iii)

 

D)

All of i) to iv)

 

Q.11

Out of the following statements
1. Register is a C++ key word
2. Constant is one which has fixed value only
through out the class
3. Int sample[3] [5] indicates a table of 5 rows and 3
columns
4. The first member of an enum gets va

 

A)

1, 3 and 6 are correct

 

B)

1 and 6 are correct

 

C)

2, 3, 5 are correct

 

D)

2, 4 and 6 are correct

 

Q.12

What would be the output from the
following program when the input is -1?
void change(void)
{
int x;
x = 1;
}
void main()
{
int x, z;
x = 0
cout>> “Enter a number” ;
cin<
change();
cout<< x << end

 

A)

0

 

B)

1

 

C)

-1

 

D)

2

 

Q.13

Consider this class definition:
class quiz
{
public;
quiz;
int f();
int g() const;
private;
double score;
}
Which functions can carry out an assignment
score=1.0; to the private member variable score?

 

A)

Both f and g can carry out the assignment

 

B)

f can carry out the assignment, but not g

 

C)

g can carry out the assignment, but not f

 

D)

Neither f nor g can carry out the assignment

 

Q.14

Given the skeleton C++ code below, which
of the following statements is false?
abstract class A; //line 1
class B private A //line 2
class C :class A ; //line 3
void main ( ) ~ A //line 4

 

A)

In line 4, compiler error is caused as class A is abstract and hence it can't be instantiated

 

B)

In line 2, class B is private derivation of class A and hence public members of class A remain private in class B and can be accessed by the member functions of B only

 

C)

In line 3, class C is public derivation of class A and so class A's public member are accessible to the objects of class C

 

D)

All of the above

 

Q.15

Which of the following would be a valid
class declaration header for a derived class m,
with base classes n and o
1)class m: n, o
2) class m: class n, class o
3) class m: public n, public o
4) class m: public n, o

 

A)

All of the above

 

B)

1), 3), 4)

 

C)

2), 3), 4)

 

D)

3), 4)

 

Q.16

What does the following code segment do?
main()
{
int x, m, n, y;
cin >> m >>n;
if m>0 and n>0
x=m; y=n;
while ( x ! = y)
if (X>Y) x = x – y;
cout << y;
else v = v - x
}

 

A)

The program computes tile quotient of min using repeated subtraction

 

B)

The program computer the least common multiple (LCM) of ni and n

 

C)

The program finds the remainder after dividing m by n using repeated subtraction

 

D)

None of these

 

Q.17

Identify which of the following function
calls are allowed given the prototype
declaration
int sum(int a, int b-1, int c=o);

 

A)

cout<<sum(1);

 

B)

cout<

 

C)

cout<<sum();

 

D)

cout<

 

Q.18

Spot the errors in the following program
Hline 1Class test1 int m;
Hline 2public : void getdata cin >> m;
Hline 3 main ( ) ( test *p;
Hline 4void display ( ) cout << in;
Hline 5 p = new test;
Hline 6 p.getdata ( );
Hline 7 (*p)

 

A)

Compilation errors at line 1, 3, 4, 5, 6 and 7

 

B)

Compilation errors at line I and 6

 

C)

Compilation errors at line 5, 6 and 7

 

D)

None of these

 

Q.19

Select correct Syntaxes
1. for (initialization; test condition; modifier
expression;)
2. for (initialization1, initialization2; test
conditon1, test condition2; modifier1,
modifier2)
{ body of the loop};
3. while (test conditio

 

A)

1

 

B)

1 and 2

 

C)

2, 3

 

D)

All the above

 

Q.20

What is the correct sequence of exception
handling?
1) Controls enters the try block
2) The member function throws an exception
3) Control transfers to the exception handler
following the try block
4) Code is executing normally out

 

A)

3), 1), 2), 4), 5)

 

B)

1), 2), 3), 4), 5)

 

C)

5), 3), 1), 4), 2)

 

D)

4), 1), 5), 2), 3)

 

Q.21

Match the following pre-defined functions
with then parameters, if any
Set-A
i) initgraph
ii) closegraph
iii) window
iv) putch
Set-B
a. (char C)
b. (int *gd, int mode, char*c)
c. ( )
d. ( int L, int T, Int R, in

 

A)

i) - a, ii) - d, iii) - c, iv) - b

 

B)

i) - d, ii) - c, iii) - a, iv) - b

 

C)

i) - b, ii) - d, iii) - a, iv) - c

 

D)

None of these

 

Q.22

Which of the following statements is false?
i) Pointer of its base class can point to an
object of the derived class
ii) A base pointer pointing to the derived class
object can access base class variables
iii) A pointer of a derived c

 

A)

i) and iii)

 

B)

ii) and iv)

 

C)

iii) only

 

D)

None of these

 

Q.23

Class ABC
{
private:
public:
}
int main()
{
ABC a;
Cout<<’The size of class ABC is” ><
}
The output of the above program will be

 

A)

The size of class ABC is 0

 

B)

The size of class ABC is 1

 

C)

The size of class ABC is 100

 

D)

Indeterminate

 

Q.24

Match the categories of graphics function
in Set-
A with an example listed in Set-B
Set-A
i) Text-mode Graphics function
ii) Graphics-i-node Drawing function
iii) Graphics-mode Text output function
iv) Graphics-mode position fu

 

A)

i) - b, ii) - a, iii) - c, iv) d

 

B)

i) - d, ii) - c. in) - e, iv) b

 

C)

i) - c, ii) - d, iii) - b, iv) a

 

D)

None of these

 

Q.25

Consider the following section of code:
if (base < height )
cout << “Top heavy structure” << endl;
else
cout << “Stable structure” << endl;
Which of the following possible values for base
and height cause the message Stable structu

 

A)

Only 1

 

B)

Only 1 and 2

 

C)

Only 1 and 3

 

D)

All 1, 2 and 3

 

Q.26

A pure virtual function is a virtual function
that
1) causes its class to be abstract
2) returns nothing
3) is used in a base class
4) takes no arguments

 

A)

1), 3)

 

B)

2), 4)

 

C)

None of the above

 

D)

All of the above

 

Q.27

Which of these is a correct way to handle
exceptions

 

A)

throws "out of range" catch

 

B)

try throw " Allocation failure" catch (char) catch (int i)

 

C)

try i try catch i (int i) throw catch (char s)

 

D)

None of the above

 

Q.28

What are the advantages of linked list?
1) We can preserve the physical order through
we have a random logical order.
2) Optimum use of memory
3) New nodes can be inserted at any point
4) Nodes cannot be deleted

 

A)

1), 2), 3)

 

B)

2), 3)

 

C)

1), 3), 4)

 

D)

1), 2), 3), 4)

 

Q.29

Assume a class C with objects obj1, obj2
and obj3. For the statement obj3=obj1-obj2 to
work correctly, the overloaded operator must
1) take two arguments
2) return a value
3) create a named temporary object
4) use the object of whi

 

A)

1), 2)

 

B)

3), 4)

 

C)

2), 4)

 

D)

1), 4)

 

Q.30

Which of these statements is false?
i) A static member function call have access to
the 'this' pointer of the class
ii) A static member function can access only
static member data and functions of the class
as well as functions outsid

 

A)

i), ii) and iii)

 

B)

ii) and iii)

 

C)

i) and iv)

 

D)

All of these

 




Comments