Sie sind auf Seite 1von 40

Question1

Marks: 1

Identify the built in data types Choose one answer. a. All the options b. char c. int d. float Correct Marks for this submission: 1/1.

Question2
Marks: 1

The fol5ing program fragment int i=10; void main() int i=20; { int i=30; cout<<i<<::I; } } Choose one answer. a. none of the above b. prints 3010 c. will result in a run time error d. prints 3020 Incorrect Marks for this submission: 0/1.

Question3
Marks: 1

the fol5ing c++ code results in #include<stdio.h> void main()

cout<<(int i=5)<<int j=6); } Choose one answer. a. none of the above b. link error c. run time error d. compilation error Incorrect Marks for this submission: 0/1.

Question4
Marks: 1

#include<iostream> int x=10; int main() { int x=20; std::cout<<x; return 0; } Choose one answer. a. error b. 20 c. 10 d. none Correct Marks for this submission: 1/1.

Question5
Marks: 1

Which of the following can force an inline function outline? Choose one answer.

a. Looping statement b. Execution error c. Data declaration d. Program bug Incorrect Marks for this submission: 0/1.

Question6
Marks: 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 Correct Marks for this submission: 1/1.

Question7
Marks: 1

the statements int a=5; cout<<"FIRST" <<(a<<2) <<"SECOND"; outputs.. Choose one answer. a. FIRST20SECOND b. FIRST52 SECONDS c. FIRST52 SECOND d. none of the above Correct Marks for this submission: 1/1.

Question8
Marks: 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. Incorrect Marks for this submission: 0/1.

Question9
Marks: 1

#include<iostream> class Base { protected: int x; public: Base(int a) : x(a) {} void showBase() { std::cout<<x; } }; class Derived { int x; public: Derived(int a,int b) : Base(a),x(b) {} void showDerived() { std::cout<<x; } }; int main() { Derived d1(101,202); Base *b=&d1; b->showBase(); b++; b->showBase(); }

Choose one answer. a. 101 , 202 b. None c. Error d. 101 , Garbage Value Correct Marks for this submission: 1/1.

Question10
Marks: 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 Incorrect Marks for this submission: 0/1.

Question11
Marks: 1

Let's say that you want to define a member function called walk in a class called transport. 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);

d. void walk(transport) (void); Incorrect Marks 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 Incorrect Marks for this submission: 0/1.

Question13
Marks: 1

inline functions defined in one file cannot be used in another file Choose one answer. a. FALSE b. True Correct Marks for this submission: 1/1.

Question14
Marks: 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 Incorrect Marks for this submission: 0/1.

Question15
Marks: 1

Which of the following decides, if a function that is declared inline is indeed going to be treated inline in the executable code? Choose one answer. a. Loader b. Compiler c. Linker d. Preprocessor Incorrect Marks for this submission: 0/1.

Question16
Marks: 1

Which keyword is used to over load an operator? Choose one answer. a. operator b. class c. static d. public Correct Marks for this submission: 1/1.

Question17
Marks: 1

Which of the fol5ing mode parameters moves to the end of a file when the file is opened? Choose one answer. a. ios::ate b. ios::eof

c. ios::trunc d. ios::end Incorrect Marks for this submission: 0/1.

Question18
Marks: 1

Which operator can you use to access public static class members through any object of 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 (->) Correct Marks for this submission: 1/1.

Question19
Marks: 1

Assume there is a function named SetValue() that has a void return value and accepts an 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) Incorrect Marks for this submission: 0/1.

Question20
Marks: 1

Generic Programing is also a kind of code reusability

Choose one answer. a. TRUE b. FALSE Incorrect Marks for this submission: 0/1.

Question21
Marks: 1

What can you use with exceptions to enable an exception handler to catch related errors with a concise notation? Choose one answer. a. Inheritance b. Polymorphism c. Pointers d. None of the options Incorrect Marks for this submission: 0/1.

Question22
Marks: 1

A member function that takes no arguments sets the current link pointer to NULL and returns the memory address that had been stored in the link pointer. Which option describes 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 Correct Marks for this submission: 1/1.

Question23
Marks: 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 Incorrect Marks for this submission: 0/1.

Question24
Marks: 1

consider the declarations const char cc='h'; char * cp; const char *const ccpc=&cc; char *const *cpcp; which of the fol5ing statements statement 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 illegal Correct Marks for this submission: 1/1.

Question25
Marks: 1

What is the return type of write() function

Choose one answer. a. ofstream& b. int c. ostream& d. char Correct Marks for this submission: 1/1.

Question26
Marks: 1

Identify which of the following defines a function template that does not return a value and has a pointer of type T Choose one answer. a. T SortArray(T *pArray) b. void SortArray(T *pArray) c. void SortArray(T pArray) d. void T SortArray(T *pArray) Correct Marks for this submission: 1/1.

Question27
Marks: 1

A class that is designed only to act as a base class but not used to create objects is called ? Choose one answer. a. Local classes b. Abstract class c. Derived class d. Intermediate derived class. Correct

Marks for this submission: 1/1.

Question28
Marks: 1

Virtual methods are linked dynamically Choose one answer. a. FALSE b. TRUE Correct Marks for this submission: 1/1.

Question29
Marks: 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 Incorrect Marks for this submission: 0/1.

Question30
Marks: 1

which of the fol5ing operations are true for : Choose one answer.

scope resolution operator)?

a. For accessing global variables b. It is used to call static members of class c. Both d. None Correct

Marks for this submission: 1/1.

Question31
Marks: 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 Incorrect Marks for this submission: 0/1.

Question32
Marks: 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 Correct Marks for this submission: 1/1.

Question33
Marks: 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

instead c. The while statements in a program are skipped d. Leading whitespace characters are discarded when performing input on a stream Correct Marks for this submission: 1/1.

Question34
Marks: 1

Insertion and extraction operators cannot be overloaded as friend functions Choose one answer. a. FALSE b. TRUE Incorrect Marks for this submission: 0/1.

Question35
Marks: 1

Static variables of a class are also called Class Variables. Choose one answer. a. FALSE b. TRUE Correct Marks for this submission: 1/1.

Question36
Marks: 1

which the fol5ing is not astorage class supported by C++ Choose one answer. a. register b. auto c. mutable

d. dynamic Incorrect Marks 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 Incorrect Marks for this submission: 0/1.

Question38
Marks: 1

#include<iostream> class Test { const int num; public:Test(int n=0) { num=n; } void show() { std::cout<<num; }

}; int main() { Test t1(101); t1.show(); } Choose one answer. a. Garbage value b. error c. none d. 101 Incorrect Marks for this submission: 0/1.

Question39
Marks: 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

Marks for this submission: 0/1.

Question40
Marks: 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 Incorrect Marks for this submission: 0/1.

Question41
Marks: 1

A Template class should be inherited as a Template Choose one answer. a. FALSE b. TRUE Correct Marks for this submission: 1/1.

Question42
Marks: 1

#include<stdio.h> void 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 Incorrect Marks for this submission: 0/1.

Question43
Marks: 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 inherits the data members and member functions of a previously defined base class Incorrect Marks for this submission: 0/1.

Question44
Marks: 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 Correct Marks for this submission: 1/1.

Question45
Marks: 1

Assume that a class contains a head pointer that can be accessed through public functions. How could you ensure that the entire program has consistent access to the head 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 Correct Marks for this submission: 1/1.

Question46
Marks: 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 Correct Marks for this submission: 1/1.

Question47
Marks: 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

c. 1 , 0 d. 1 , 4 Correct Marks for this submission: 1/1.

Question48
Marks: 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. Incorrect Marks for this submission: 0/1.

Question49
Marks: 1

#include<iostream> int main() { const int i=printf(hello); int *p=&i; *p=999; std::cout<<i; } Choose one answer. a. 999 b. 100 c. none of these d. Error Incorrect Marks for this submission: 0/1.

Question50
Marks: 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 Incorrect Marks for this submission: 0/1.

Question51
With which keyword do you precede the function prototypes, to tell a compiler that one or several functions have been compiled in C? Choose one answer. a. inline b. extern "C" c. operator d. auto Incorrect Marks for this submission: 0/1.

Question52
new operator writes debugging information Choose one answer. a. FALSE b. TRUE Incorrect Marks for this submission: 0/1.

Question53
Marks: 1

#include<iostream> class Base { protected: int x; public: Base(int a) : x(a) {} void showBase() { std::cout<<x; } }; class Derived { int x; public: Derived(int a,int b) : Base(a),x(b) {} void showDerived() { std::cout<<x; } }; int main() { Derived d1(101,202); Base *b=&d1; b->showBase(); b++; b->showBase(); } Choose one answer. a. None b. 101 , 202 c. 101 , Garbage Value d. Error Incorrect Marks for this submission: 0/1.

Question54
Marks: 1

Which of the fol5ing is the stream extraction operator? Choose one answer.

a. >> b. < c. > d. << Correct Marks for this submission: 1/1.

Question55
Marks: 1

Virtual constructor can be created Choose one answer. a. FALSE b. TRUE Incorrect Marks for this submission: 0/1.

Question56
Marks: 1

A Template Function cab be overloaded Choose one answer. a. TRUE b. FALSE Correct Marks for this submission: 1/1.

Question57
Marks: 1

which of the fol5ing operations are true for : Choose one answer.

scope resolution operator)?

a. It is used to call static members of class b. For accessing global variables

c. None d. Both Correct Marks for this submission: 1/1.

Question58
Marks: 1

Array of references can be created Choose one answer. a. FALSE b. TRUE Incorrect Marks for this submission: 0/1.

Question59
Marks: 1

Function Template and a Template Function Both are Different Choose one answer. a. TRUE b. FALSE Correct Marks for this submission: 1/1.

Question60
Marks: 1

#include<iostream> int main() { int x=300; std::cout<<char(x); } Choose one answer. a. ,

b. Error c. none d. Segmentation Fault Incorrect Marks for this submission: 0/1.

Question61
Marks: 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 Incorrect Marks for this submission: 0/1.

Question62
Marks: 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 assignment =0 in the function prototype c. The inclusion of the keyword pure in the function prototype d. None of the options Incorrect Marks for this submission: 0/1.

Question63
Marks: 1

What can you use with exceptions to enable an exception handler to catch related errors with a concise notation? Choose one answer. a. Inheritance b. Polymorphism c. None of the options d. Pointers Incorrect Marks for this submission: 0/1.

Question64
Marks: 1

Static variables of a class are also called Class Variables. Choose one answer. a. FALSE b. TRUE Correct Marks for this submission: 1/1.

Question65
Marks: 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 Incorrect Marks for this submission: 0/1.

Question66
Marks: 1

C++ is a pure Object Oriented Language Choose one answer. a. TRUE b. FALSE Incorrect Marks for this submission: 0/1.

Question67
Marks: 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 Correct Marks for this submission: 1/1.

Question68
Marks: 1

One of the disadvantages of pass-by reference is that the called function may corrupt the 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 Incorrect Marks for this submission: 0/1.

Question69
Marks: 1

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 not 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 among several people or across time Correct Marks for this submission: 1/1.

Question70
Marks: 1

Space allocated by new can also be deallocated by free() Choose one answer. a. FALSE b. TRUE Incorrect Marks for this submission: 0/1.

Question71
Marks: 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) Correct Marks for this submission: 1/1.

Question72
Marks: 1

consider the fol5ing program segment static char x[3]="1234"; cout<<x; a complete C++ program with these two statements Choose one answer. a. will give a compilation error b. prints 1234 c. prints 123 d. prints 1234 fol5ed by some junk Incorrect Marks for this submission: 0/1.

Question73
Marks: 1

inline functions defined in one file cannot be used in another file Choose one answer. a. FALSE b. True Correct Marks for this submission: 1/1.

Question74
Marks: 1

#include<iostream> namespace First { class Test {}; } int main() { std::cout<<sizeof(Test); } Choose one answer.

a. Error b. 1 c. 0 d. GarbageValue Correct Marks for this submission: 1/1.

Question75
Marks: 1

Select the correct segments of code Choose one answer. a. cout >> Please enter employee name;cin << "eName"; b. cout << Please enter employee name;cin >> "eName"; c. cout >> "Please enter employee name";cin << eName; d. cout << "Please enter employee name";cin >> eName; Correct Marks for this submission: 1/1.

Question76
Marks: 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 Incorrect Marks for this submission: 0/1.

Question77
Marks: 1

#include<iostream> #include<string.h> int main() { char *p; p=new char[20]; strcpy(p,welcome); delete [] p; std::cout<<p; } Choose one answer. a. Unpredicted b. error c. welcome d. Segmentation Fault Incorrect Marks for this submission: 0/1.

Question78
Marks: 1

Which options about public members are true? Choose one answer. a. Public members are always accessible b. A class can declare another class as a friend c. A class must name all its friends in advance d. All the options Correct Marks for this submission: 1/1.

Question79
Marks: 1

What is the return type of typeid operator

Choose one answer. a. Object b. String c. type_info& d. char* Correct Marks for this submission: 1/1.

Question80
Marks: 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 Correct Marks for this submission: 1/1.

Question81
Marks: 1

Elements of STL containers can be accessed through Choose one answer.

a. all of the above b. pointers c. iterators d. references Incorrect Marks for this submission: 0/1.

Question82
Marks: 1

Let's say that you want to define a member function called walk in a class called transport. 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); Incorrect Marks for this submission: 0/1.

Question83
Marks: 1

Which operator can you use to access public static class members through any object of 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 (.) Correct Marks for this submission: 1/1.

Question84
Marks: 1

Constructor can throw an Exception Choose one answer. a. TRUE b. FALSE Correct Marks for this submission: 1/1.

Question85
Marks: 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 Correct Marks for this submission: 1/1.

Question86
Marks: 1

Mandatory and Default arguments can be Mingled Choose one answer. a. FALSE b. TRUE Correct Marks for this submission: 1/1.

Question87
Marks: 1

By default when a class is declared what are the mebers provided by the compilers

Choose one answer. a. All the options b. constructor c. copy constructor d. destructor Correct Marks for this submission: 1/1.

Question88
Marks: 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 different variables, at the same time c. A memory location shared by two or more different variables, at different times d. A collection of related variables under different names Incorrect Marks for this submission: 0/1.

Question89
Marks: 1

const_cast operator is used for Choose one answer. a. removing constness b. adding constness c. to create a constant d. none Incorrect

Marks for this submission: 0/1.

Question90
Marks: 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 Incorrect Marks for this submission: 0/1.

Question91
Marks: 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 Incorrect Marks for this submission: 0/1.

Question92
Marks: 1

Which of the fol5ing is the default argument for the clear() function? Choose one answer. a. ios::clearbit b. ios::defbit

c. ios::goodbit d. ios::setbit Incorrect Marks for this submission: 0/1.

Question93
Marks: 1

What is the size of the class having normal function, and size of the class having virtual function . Choose one answer. a. 1 , 4 b. 1 , 0 c. 0,0 d. 1,1 Incorrect Marks for this submission: 0/1.

Question94
Marks: 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 Incorrect Marks for this submission: 0/1.

Question95
Marks: 1

void transport(walk) (void);

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 Correct Marks for this submission: 1/1.

Question96
Marks: 1

#include<iostream> int main() { int x=100; int const *p=&x; p++; std::cout<<*p; } Choose one answer. a. 100 b. Garbage Value c. 101 d. Error (Cant increment const ptr) Incorrect Marks for this submission: 0/1.

Question97
Marks: 1

#include<cstdio> int main() { const int i=10; int &j=i; printf("%u %u",&I,&j); }

Choose one answer. a. Depends on Compiler b. Prints Same Addresses c. Error d. Prints Different Addresses Incorrect Marks for this submission: 0/1.

Question98
Marks: 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) Incorrect Marks for this submission: 0/1.

Question99
Marks: 1

Which of the following options are true about inheritance? Choose one answer. a. When deriving from a private base class, protected, private, and public members become private members of the derived class b. When deriving from a protected base class, public members become protected members of the derived class c. All the options

d. When deriving from a public base class, the public members become public members of the derived class Correct Marks for this submission: 1/1.

Question100
Marks: 1

#include<stdio.h> void 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

Das könnte Ihnen auch gefallen