Date post: | 14-Apr-2018 |
Category: |
Documents |
Upload: | deejay-sahir |
View: | 235 times |
Download: | 0 times |
of 40
7/30/2019 Modified Cpp
1/40
Question1Marks: 1
Identify the built in data types
Choose one answer.
a. All the options
b. char
c. int
d. float
CorrectMarks for this submission: 1/1.
Question2Marks: 1
The fol5ing program fragmentint i=10;void main()int i=20;{int i=30;cout
7/30/2019 Modified Cpp
2/40
cout
7/30/2019 Modified Cpp
3/40
a. Looping statement
b. Execution error
c. Data declaration
d. Program bug
IncorrectMarks for this submission: 0/1.
Question6Marks: 1
namespaces are used to
Choose one answer.
a. define new scope
b. declare variable
c. define classes and functions
d. use the variables which defined in other cpp files
CorrectMarks for this submission: 1/1.
Question7Marks: 1
the statementsint a=5;cout
7/30/2019 Modified Cpp
4/40
Question8Marks: 1
Which of the following statements are true with respect to the use of friend function?
Choose one answer.
a. a private data member can be declared as a friend.
b. friend function can be accessed with help of object.
c. friend function can access private data of one or more
classes.
d. friend function must be declared in public section.
IncorrectMarks for this submission: 0/1.
Question9Marks: 1
#includeclass Base{protected: int x;public: Base(int a) : x(a) {}void showBase(){std::cout
7/30/2019 Modified Cpp
5/40
Choose one answer.
a. 101 , 202
b. None
c. Error
d. 101 , Garbage Value
CorrectMarks for this submission: 1/1.
Question10Marks: 1
Which of the following options are true about inheritance?
Choose one answer.
a. When deriving from a public base class, the public members
become public members of the derived class
b. When deriving from a protected base class, public members
become protected members of the derived class
c. When deriving from a private base class, protected, private,and public members become private members of the derived
class
d. All the options
IncorrectMarks for this submission: 0/1.
Question11Marks: 1
Let's say that you want to define a member function called walk in a class calledtransport. Which line of code would you use to begin the definition?
Choose one answer.
a. void transport(walk) (void);
b. void walk :: transport (void);
c. void transport :: walk (void);
7/30/2019 Modified Cpp
6/40
d. void walk(transport) (void);
IncorrectMarks for this submission: 0/1.
Question12
Marks: 1
Space allocated by new can also be deallocated by free()
Choose one answer.
a. FALSE
b. TRUE
IncorrectMarks for this submission: 0/1.
Question13Marks: 1
inline functions defined in one file cannot be used in another file
Choose one answer.
a. FALSE
b. True
CorrectMarks for this submission: 1/1.
Question14Marks: 1
When a Class Will be Loaded in the Memory
Choose one answer.
a. On the first Use of the class
b. At Compile Time
c. At Linking Time
d. At Run Time
IncorrectMarks for this submission: 0/1.
7/30/2019 Modified Cpp
7/40
Question15Marks: 1
Which of the following decides, if a function that is declared inline is indeed going to betreated inline in the executable code?
Choose one answer.
a. Loader
b. Compiler
c. Linker
d. Preprocessor
Incorrect
Marks for this submission: 0/1.
Question16Marks: 1
Which keyword is used to over load an operator?
Choose one answer.
a. operator
b. class
c. static
d. public
CorrectMarks for this submission: 1/1.
Question17Marks: 1
Which of the fol5ing mode parameters moves to the end of a file when the file isopened?
Choose one answer.
a. ios::ate
b. ios::eof
7/30/2019 Modified Cpp
8/40
c. ios::trunc
d. ios::end
Incorrect
Marks for this submission: 0/1.
Question18Marks: 1
Which operator can you use to access public static class members through any objectof that class and through the class name?
Choose one answer.
a. The scope resolution operator (:
b. The dot operator (.)
c. None of the options
d. The pointer-to operator (->)
CorrectMarks for this submission: 1/1.
Question19Marks: 1
Assume there is a function named SetValue() that has a void return value and acceptsan integer as an argument. Identify the line of code that correctly calls SetValue().
Choose one answer.
a. SetValue(5)
b. VoidSetValue(int x)
c. SetValue(int x)
d. VoidSetValue(5)
IncorrectMarks for this submission: 0/1.
Question20Marks: 1
Generic Programing is also a kind of code reusability
7/30/2019 Modified Cpp
9/40
Choose one answer.
a. TRUE
b. FALSE
IncorrectMarks for this submission: 0/1.
Question21Marks: 1
What can you use with exceptions to enable an exception handler to catch relatederrors with a concise notation?
Choose one answer.
a. Inheritance
b. Polymorphism
c. Pointers
d. None of the options
IncorrectMarks for this submission: 0/1.
Question22Marks: 1
A member function that takes no arguments sets the current link pointer to NULL andreturns the memory address that had been stored in the link pointer. Which optiondescribes what step should be taken first?
Choose one answer.
a. Return the value of the link pointer
b. Assign the current node's memory address to a second
pointer
c. Assign the value of the link pointer to a second pointer
d. Set the link pointer to NULL
CorrectMarks for this submission: 1/1.
7/30/2019 Modified Cpp
10/40
Question23Marks: 1
Which of the following type of functions is an ideal candidate for being declared inline ?
Choose one answer.
a. A function that is small and is called frequently
b. A function that is not small and is called frequently
c. A function that is not small and is not called frequently
d. A function that is small and is not called frequently
IncorrectMarks for this submission: 0/1.
Question24Marks: 1
consider the declarationsconst char cc='h';char * cp;const char *const ccpc=&cc;char *const *cpcp;which of the fol5ing statementsstatement I: cp=*cpcp;statement II: *8cpcp=*cp;
statement III: *cp=**cpcp;are legal?
Choose one answer.
a. only statement I is illegal
b. all are legal
c. all are illegal
d. statement I and II are illegalCorrectMarks for this submission: 1/1.
Question25Marks: 1
What is the return type of write() function
7/30/2019 Modified Cpp
11/40
Choose one answer.
a. ofstream&
b. int
c. ostream&
d. char
CorrectMarks for this submission: 1/1.
Question26Marks: 1
Identify which of the following defines a function template that does not return a value
and has a pointer of type TChoose one answer.
a. T SortArray(T *pArray)
b. void SortArray(T *pArray)
c. void SortArray(T pArray)
d. void T SortArray(T *pArray)
CorrectMarks for this submission: 1/1.
Question27Marks: 1
A class that is designed only to act as a base class but not used to create objects iscalled ?
Choose one answer.
a. Local classes
b. Abstract class
c. Derived class
d. Intermediate derived class.
Correct
7/30/2019 Modified Cpp
12/40
Marks for this submission: 1/1.
Question28Marks: 1
Virtual methods are linked dynamically
Choose one answer.
a. FALSE
b. TRUE
CorrectMarks for this submission: 1/1.
Question29Marks: 1
What is the use of dynamic_cast operator
Choose one answer.
a. for dynamic conversion
b. for static conversion
c. To check is a Relation
d. none
IncorrectMarks for this submission: 0/1.
Question30Marks: 1
which of the fol5ing operations are true for : scope resolution operator)?
Choose one answer.
a. For accessing global variables
b. It is used to call static members of class
c. Both
d. None
Correct
7/30/2019 Modified Cpp
13/40
Marks for this submission: 1/1.
Question31Marks: 1
What is a structure?
Choose one answer.
a. A memory location shared by two or more different variables,
at the same time
b. A memory location shared by two or more different variables,
at different times
c. A collection of related variables under one name
d. A collection of related variables under different names
IncorrectMarks for this submission: 0/1.
Question32Marks: 1
What can a variable which is an unsigned int hold?
Choose one answer.
a. None of the options
b. Negative and positive values
c. Only positive values
d. Only negative values
CorrectMarks for this submission: 1/1.
Question33Marks: 1
Which of the fol5ing operations occurs when the skipsws flag is set?
Choose one answer.
a. Wildcard settings are ignored when data is being input
b. The width settings are ignored and the default setting is used
7/30/2019 Modified Cpp
14/40
instead
c. The while statements in a program are skipped
d. Leading whitespace characters are discarded when performing
input on a stream
CorrectMarks for this submission: 1/1.
Question34Marks: 1
Insertion and extraction operators cannot be overloaded as friend functions
Choose one answer.
a. FALSE
b. TRUE
IncorrectMarks for this submission: 0/1.
Question35Marks: 1
Static variables of a class are also called Class Variables.
Choose one answer.
a. FALSE
b. TRUE
CorrectMarks for this submission: 1/1.
Question36Marks: 1
which the fol5ing is not astorage class supported by C++
Choose one answer.
a. register
b. auto
c. mutable
7/30/2019 Modified Cpp
15/40
d. dynamic
IncorrectMarks for this submission: 0/1.
Question37
Marks: 1
class Base{public:void display(){}};class Derived : public Base{public:void display() {}};int main(){Derived d1;
Base *b=&d1;b->display(); /*which method is called */}
Choose one answer.
a. Segmentation fault
b. Error(illegal Cast)
c. Base Method
d. Derived Method
IncorrectMarks for this submission: 0/1.
Question38Marks: 1
#includeclass Test{const int num;
public:Test(int n=0){num=n;}void show(){std::cout
7/30/2019 Modified Cpp
16/40
};int main(){Test t1(101);t1.show();
}
Choose one answer.
a. Garbage value
b. error
c. none
d. 101
IncorrectMarks for this submission: 0/1.
Question39Marks: 1
class A{public: void show(){}};class B{public:void show(){}
};class C : public A,public B{};int main(){C c1;c1.show();}
Choose one answer.
a. B's show method
b. Abiguity(Error)
c. Error(C doesn't have any method by name show())
d. A's show method
Incorrect
7/30/2019 Modified Cpp
17/40
Marks for this submission: 0/1.
Question40Marks: 1
cfront
Choose one answer.
a. none of the above
b. Is the pre-processor of a compiler
c. is a tool that translates a C++ code to its equivalent C code
d. Is the front end of a compiler
IncorrectMarks for this submission: 0/1.
Question41Marks: 1
A Template class should be inherited as a Template
Choose one answer.
a. FALSE
b. TRUE
CorrectMarks for this submission: 1/1.
Question42Marks: 1
#includevoid main(){const int i;const int &j=i;
printf("\n%u %u",&i,&j);}
Choose one answer.
a. Error
7/30/2019 Modified Cpp
18/40
b. Same address
c. Diff Address
d. Garbage Values
IncorrectMarks for this submission: 0/1.
Question43Marks: 1
Which statements about inheritance are true?
Choose one answer.
a. All the options
b. The class, which inherits data members and member functions of a
base class, is called a derived class
c. Inheritance al5s programmers to reuse reliable software
d. Inheritance is when a programmer specifies that a new class inheritsthe data members and member functions of a previously defined base
class
IncorrectMarks for this submission: 0/1.
Question44Marks: 1
Which options about public members are true?
Choose one answer.
a. A class can declare another class as a friend
b. A class must name all its friends in advance
c. All the options
d. Public members are always accessible
CorrectMarks for this submission: 1/1.
Question45Marks: 1
7/30/2019 Modified Cpp
19/40
Assume that a class contains a head pointer that can be accessed through publicfunctions. How could you ensure that the entire program has consistent access to thehead of the list?
Choose one answer.
a. Declare each instance of the class as a const
b. Create one instance of the class in main() and pass the object's
memory address to it
c. Make the class a friend of the node class
d. Instantiate the class in every function that needs to use the head
pointer
CorrectMarks for this submission: 1/1.
Question46Marks: 1
What advantages do linked lists have over fixed arrays?
Choose one answer.
a. Linked lists do not need to be stored in contiguous memory
b. All the options
c. You do not need to declare the size of a linked list before
compilation
d. A linked list reduces memory waste
CorrectMarks for this submission: 1/1.
Question47Marks: 1
What is the size of the class having normal function, and size of the class having virtual
function .
Choose one answer.
a. 1,1
b. 0,0
7/30/2019 Modified Cpp
20/40
c. 1 , 0
d. 1 , 4
Correct
Marks for this submission: 1/1.
Question48Marks: 1
Which of the fol5ing statements are true in c++?
Choose one answer.
a. Class members are public by default.
b. None of these.
c. classes can not have data as public members
d. Structures can have functions as members.
IncorrectMarks for this submission: 0/1.
Question49Marks: 1
#includeint main(){const int i=printf(hello);int *p=&i;*p=999;std::cout
7/30/2019 Modified Cpp
21/40
Question50Marks: 1
The major goal of inheritance in c++ is
Choose one answer.
a. It saves memory
b. To facilitate the reusability of code.
c. To help modular programming
d. To facilitate the conversion of data types
IncorrectMarks for this submission: 0/1.
Question51With which keyword do you precede the function prototypes, to tell a compiler that oneor several functions have been compiled in C?
Choose one answer.
a. inline
b. extern "C"
c. operator
d. auto
IncorrectMarks for this submission: 0/1.
Question52new operator writes debugging information
Choose one answer.
a. FALSE
b. TRUE
IncorrectMarks for this submission: 0/1.
Question53Marks: 1
7/30/2019 Modified Cpp
22/40
#includeclass Base{protected: int x;public: Base(int a) : x(a) {}
void showBase(){std::cout
7/30/2019 Modified Cpp
23/40
a. >>
b.
d.
7/30/2019 Modified Cpp
24/40
c. None
d. Both
Correct
Marks for this submission: 1/1.
Question58Marks: 1
Array of references can be created
Choose one answer.
a. FALSE
b. TRUE
IncorrectMarks for this submission: 0/1.
Question59Marks: 1
Function Template and a Template Function Both are Different
Choose one answer.
a. TRUE
b. FALSE
CorrectMarks for this submission: 1/1.
Question60Marks: 1
#includeint main(){int x=300;
std::cout
7/30/2019 Modified Cpp
25/40
b. Error
c. none
d. Segmentation Fault
IncorrectMarks for this submission: 0/1.
Question61Marks: 1
What is the use of dynamic_cast operator
Choose one answer.
a. To check is a Relation
b. none
c. for dynamic conversion
d. for static conversion
IncorrectMarks for this submission: 0/1.
Question62Marks: 1
Which of the following indicates that a function is a pure virtual function.
Choose one answer.
a. The inclusion of the keyword virtual in the function
prototype
b. The inclusion of the keyword virtual and the assignme
=0 in the function prototype
c. The inclusion of the keyword pure in the function
prototyped. None of the options
IncorrectMarks for this submission: 0/1.
Question63Marks: 1
7/30/2019 Modified Cpp
26/40
What can you use with exceptions to enable an exception handler to catch relatederrors with a concise notation?
Choose one answer.
a. Inheritance
b. Polymorphism
c. None of the options
d. Pointers
IncorrectMarks for this submission: 0/1.
Question64Marks: 1
Static variables of a class are also called Class Variables.
Choose one answer.
a. FALSE
b. TRUE
CorrectMarks for this submission: 1/1.
Question65Marks: 1
Which of the following type of functions is an ideal candidate for being declared inline ?
Choose one answer.
a. A function that is not small and is called frequently
b. A function that is small and is called frequently
c. A function that is not small and is not called frequently
d. A function that is small and is not called frequently
IncorrectMarks for this submission: 0/1.
Question66Marks: 1
7/30/2019 Modified Cpp
27/40
C++ is a pure Object Oriented Language
Choose one answer.
a. TRUE
b. FALSE
IncorrectMarks for this submission: 0/1.
Question67Marks: 1
What name is given to a constructor member function?
Choose one answer.
a. None of the options
b. The same name as the function it is initializing
c. A random choice by the programmer
d. The same name as the class in which it is being declared
CorrectMarks for this submission: 1/1.
Question68Marks: 1
One of the disadvantages of pass-by reference is that the called function may corruptthe caller's data. This can be avoided by
Choose one answer.
a. declaring the actual parameters const
b. passing pointers
c. declaring the formal parameters constants
d. all of the above
IncorrectMarks for this submission: 0/1.
Question69Marks: 1
7/30/2019 Modified Cpp
28/40
Identify the true statements about designing C++ programs for reusability
Choose one answer.
a. All the options
b. Creating a library of reusable components from scratch may be appropriate in many cases since the components lack
generalization
c. Global variables are accessible to any function defined in the
same file after the variable is declared
d. Modularity al5s you to divide the programming process amon
several people or across time
CorrectMarks for this submission: 1/1.
Question70Marks: 1
Space allocated by new can also be deallocated by free()
Choose one answer.
a. FALSE
b. TRUE
IncorrectMarks for this submission: 0/1.
Question71Marks: 1
Which of the fol5ing while statements correctly signals the end of a file?
Choose one answer.
a. while(pFile->eof()==0)
b. while pFile->eof()==0
c. while(pFile->eof()=0)
d. while(pFile->eof==0)
CorrectMarks for this submission: 1/1.
7/30/2019 Modified Cpp
29/40
Question72Marks: 1
consider the fol5ing program segmentstatic char x[3]="1234";cout
7/30/2019 Modified Cpp
30/40
a. Error
b. 1
c. 0
d. GarbageValue
CorrectMarks for this submission: 1/1.
Question75Marks: 1
Select the correct segments of code
Choose one answer.
a. cout >> Please enter employee name;cin
"eName";
c. cout >> "Please enter employee name";cin
eName;
CorrectMarks for this submission: 1/1.
Question76Marks: 1
Which of the fol5ing statements are true in c++?
Choose one answer.
a. Class members are public by default.
b. Structures can have functions as members.
c. None of these.
d. classes can not have data as public members
IncorrectMarks for this submission: 0/1.
7/30/2019 Modified Cpp
31/40
Question77Marks: 1
#include#includeint main()
{char *p;p=new char[20];strcpy(p,welcome);delete [] p;std::cout
7/30/2019 Modified Cpp
32/40
Choose one answer.
a. Object
b. String
c. type_info&
d. char*
CorrectMarks for this submission: 1/1.
Question80Marks: 1
class A
{public: void show(){}};class B{public:void show(){}};class C : public A,public B{};int main(){C c1;c1.show();
}Choose one answer.
a. B's show method
b. Abiguity(Error)
c. Error(C doesn't have any method by name show())
d. A's show method
CorrectMarks for this submission: 1/1.
Question81Marks: 1
Elements of STL containers can be accessed through
Choose one answer.
7/30/2019 Modified Cpp
33/40
a. all of the above
b. pointers
c. iterators
d. references
IncorrectMarks for this submission: 0/1.
Question82Marks: 1
Let's say that you want to define a member function called walk in a class calledtransport. Which line of code would you use to begin the definition?
Choose one answer.
a. void transport(walk) (void);
b. void walk(transport) (void);
c. void walk :: transport (void);
d. void transport :: walk (void);
IncorrectMarks for this submission: 0/1.
Question83Marks: 1
Which operator can you use to access public static class members through any objectof that class and through the class name?
Choose one answer.
a. The pointer-to operator (->)
b. None of the options
c. The scope resolution operator (:
d. The dot operator (.)
CorrectMarks for this submission: 1/1.
7/30/2019 Modified Cpp
34/40
Question84Marks: 1
Constructor can throw an Exception
Choose one answer.
a. TRUE
b. FALSE
CorrectMarks for this submission: 1/1.
Question85Marks: 1
A constructor is called when ever
Choose one answer.
a. an object is used
b. a class is declared
c. an object is declared
d. a class is used
CorrectMarks for this submission: 1/1.
Question86Marks: 1
Mandatory and Default arguments can be Mingled
Choose one answer.
a. FALSE
b. TRUE
CorrectMarks for this submission: 1/1.
Question87Marks: 1
By default when a class is declared what are the mebers provided by the compilers
7/30/2019 Modified Cpp
35/40
Choose one answer.
a. All the options
b. constructor
c. copy constructor
d. destructor
CorrectMarks for this submission: 1/1.
Question88Marks: 1
What is a structure?
Choose one answer.
a. A collection of related variables under one
name
b. A memory location shared by two or more diffe
variables, at the same time
c. A memory location shared by two or more diffe
variables, at different times
d. A collection of related variables under different
names
IncorrectMarks for this submission: 0/1.
Question89Marks: 1
const_cast operator is used for
Choose one answer.
a. removing constness
b. adding constness
c. to create a constant
d. none
Incorrect
7/30/2019 Modified Cpp
36/40
Marks for this submission: 0/1.
Question90Marks: 1
Identify the types of exceptions that can be caught using exception handling techniques.
Choose one answer.
a. All the options
b. All exceptions of related types
c. All types of exceptions
d. All exceptions of a certain type
IncorrectMarks for this submission: 0/1.
Question91Marks: 1
cfront
Choose one answer.
a. Is the pre-processor of a compiler
b. is a tool that translates a C++ code to its
equivalent C code
c. Is the front end of a compiler
d. none of the above
IncorrectMarks for this submission: 0/1.
Question92Marks: 1
Which of the fol5ing is the default argument for the clear() function?
Choose one answer.
a. ios::clearbit
b. ios::defbit
7/30/2019 Modified Cpp
37/40
c. ios::goodbit
d. ios::setbit
Incorrect
Marks for this submission: 0/1.
Question93Marks: 1
What is the size of the class having normal function, and size of the class having virtualfunction .
Choose one answer.
a. 1 , 4
b. 1 , 0
c. 0,0
d. 1,1
IncorrectMarks for this submission: 0/1.
Question94Marks: 1
Why is it necessary to expand an inline function before it is used?
Choose one answer.
a. The code body is needed to expand the inline
function
b. The inline function is needed to expand the code
body
c. The code body is needed to expand the inline
function
d. The inline function needs the outline to expand
IncorrectMarks for this submission: 0/1.
Question95Marks: 1
void transport(walk) (void);
7/30/2019 Modified Cpp
38/40
Choose one answer.
a. The object's memory address
b. A pointer to the object
c. A reference to the object
d. All the options
CorrectMarks for this submission: 1/1.
Question96Marks: 1
#include
int main(){int x=100;int const *p=&x;p++;std::cout
7/30/2019 Modified Cpp
39/40
Choose one answer.
a. Depends on Compiler
b. Prints Same Addresses
c. Error
d. Prints Different Addresses
IncorrectMarks for this submission: 0/1.
Question98Marks: 1
Which of the following lines of code opens the invoice file for output and binary
operations?Choose one answer.
a. open(ios::out, "invoice", ios::binary)
b. open("invoice", ios::out|ios::binary)
c. open("invoice", out::binary)
d. open("invoice", ios::binary, ios::out)
IncorrectMarks for this submission: 0/1.
Question99Marks: 1
Which of the following options are true about inheritance?
Choose one answer.
a. When deriving from a private base class, protecprivate, and public members become private mem
of the derived class
b. When deriving from a protected base class, pubmembers become protected members of the derive
class
c. All the options
7/30/2019 Modified Cpp
40/40
d. When deriving from a public base class, the pubmembers become public members of the derived
class
CorrectMarks for this submission: 1/1.
Question100Marks: 1
#includevoid main(){const int i;const int &j=i;printf("\n%u %u",&i,&j);}
Choose one answer.
a. Error
b. Same address
c. Diff Address
d. Garbage Values