Friday, July 24, 2009

C++ Objective type

Previous Next

What function initializes variables in a class:
a) Constructor
b) Destructor
c) String
d) A and B are correct
Ans : A

To include code from the library in the program, such as iostream, a directive would be called up using this command.
a) #include <>; with iostream.h inside the brackets
b) include (iostreamh)
c) #include <> with iostream.h inside the brackets
d) include #iostream,h;
Ans : C

Single line comments explaining code would be preceded like in the following example
a) /**
b) //
c) *//
d) /*
Ans : B

Which line has all reserved words ?
a) char, int, float, doubled, short, long, unsigned, signed
b) sizeof, const, typedef, static, voided, enum, struct, union
c) if, else, for, while do, switch, continue, break
d) defaulted, goto, return, extern, private, public, protected
Ans : C

What punctuation must each command line have at the end of the line ?
a) :
b) ,
c) !
d) ;
Ans : D

The C++ language isa) case-sensitive.
b) Not case-sensitive.
c) It depends
d) None of these
Ans : A

The number 4.8471e15 must be stored in a(n):
a) int
b) long
c) double
d) float
Ans : C

Select the correct definition for a string variable.
a) string mystr;
b) string mystr[20];
c) string[20] mystr;
d) char mystr[20];
Ans : D

The sentence "Hello world!" uses _____ elements in a character array.
a) 9
b) 11
c) 13
d) 14
Ans : C


No comments:

Post a Comment