Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
A. Basic
B. Fortan
C. C++
D. Cobol
2. ---------------- allows you to create a derived class that inherits properties from more than one
base class.
A) Multilevel inheritance
B) Multiple inheritance
C)Hybrid Inheritance
D) Hierarchical Inheritance
B) Inheritance
C) Encapsulation
D) Data hiding
A) iostream.h
B) iomanip.h
C) string.h
D) fstream.h
A) static class
B) virtual function
C) friend function
D) inline function
B) this
C) Indirection
D) Address
8. ---------------- classes are used in cases where one class is tightly coupled to another
class
A) Abstract
B) friend
C) static
D) virtual
A) .txt
B) .doc
C) .c
D) .cpp
10. The ------------------ keyword/s do not apply to friend functions, as the class has no control
over the scope of friends.
A) public
B) protected
C) private
D) both A) and B)
B) .cpp
C) .ppt
D) .xls
12. --------------- do not break encapsulation, but rather enhance a class interface.
A) Static functions
B)Friend functions
C) Dynamic functions
D) none of these
13. The function-------------- will return the last read character and will move the inside pointer,
one with -1 char.
A) putback()
B) flush()
C) peek()
D) getline()
14. -------------- is an identifier that can be inserted into an output stream or extracted from
an input stream in order to produce a desired effect.
A)Stream
B) Manipulator
C) this
D) Flag
A) Syntax
B) Logical
C) Linker
D) Runtime
A) i only
B) ii only
C) both i and ii
D) all of these
A) endl
B) ends
C) unitbuf
D) setfill
18. Which of these file open mode you use to delete all previous content in the file.
A) ios :: ate
B) ios ::in
C) ios:: app
D) ios::trunc
A) 4.
B) 2
C) 1
D) 8
21. -------------- is very useful when templates of template come into usage.
A) friend function
B) static function
C) typedef
D) inheritance
22. Which of these c++ feature allow you to create classes that are dynamic in terms of the
types of data they can handle.
A) Inheritance
B) Templates
C) Polymorphism
D) information hiding
23. Create the required classes by plugging in the actual type for the type parameters, this
process is commonly known as ------------------------
A) Instantiating a class.
B) encapsulation of class
C) booting of class
D) none of these
24. What are the two basic models in the exception handling theory.
25. Which of these is/are the exception classes derived from logic_error
A) i),ii),iii) only
B) iv) only
D) iii) only
26. Each catch clause (exception handler) is like a little function that takes a ----------------
argument/s of one particular type.
A) many
B) two
C) single
D) either A) or B)
A) 10
B) 2
C) 4
D) 8
28. The exception specification is like a----------------, It tells the user to write exception
handling code and what exceptions to handle.
A) library file
B) function prototype
C) header file
D) built-in function
A) bad_cast
B) bad_typeid
C) length_error
D) none of these
A) LIFO
B) FIFO
C) SISO
D) LILO
31. The standard sequence containers include --------------
33. Iterators which can move freely any number of steps in one operation are called -------------
A) input iterators
B) forward iterators
D) output iterators
34. There are ------------- types of sequence containers in the STL.
A) two
B) four
C) eight
D) three
35. To destroy element at the end of vector which of these vector access function
is used.
A)pop_back()
B) push_back()
C) insert()
D) destroy()
A) Activity
B) State
C)Collaboration
D)Use case
37. Which of these link is used to avoid repetition of scenarios in multiple use cases.
A) Include
B) Generalization
C) Extends
D) None of these
38. Models in UML consist of ---------------- that interact by sending each other, messages.
A) Actor
B) objects
C) use case
D) none of these
39. Which one of the following symbols is used for indicating comments?
A) >>
B) <<
C) //
D)**
A) determining failure
B) communicating with clients
C) generating test cases
D) all of these
Part B (Two mark questions)
41. ------------------- is a master function required in all C++ program and execution begins from
the first statement of this function.
A) Virtual function
B) main()
C) inline()
D) getch()
42. ----------------- is the ability of objects belonging to different types to respond to method calls
of methods of the same name, each one according to an appropriate type-specific behavior.
A) Inheritance
B) Virtuality
C) polymorphism
D) None of these.
A) true, true
B) true, false
C) false , true
D) false , false
44. State true or false
1. Polymorphic functions are functions that cannot be applied to objects of more than one
type.
2. Overloaded functions are statically bound at run time.
A) false, true
B) false, false
C) true , true
D) true, false
A) break
B) const
C) continue
D) auto
46. The --------- and ------------------- keywords do not apply to friend functions, as the class has
no control over the scope of friends.
A) public, protected
B) Private, public
C) protected , private
D) private , protected
47. -------------- library function can be used to copy the contents of one string to another string.
A) strcp()
B)strcmp()
C) strcpy()
D) stringcopy()
48. The current reading position, which is the index of the next byte that will be read from
the file is called -----------------------.
A) set pointer
B) curr pointer
C) put pointer
D ) get pointer
49. Which of these function returns the ASCII code of the char, but not the char itself
A) peek()
B) asc()
C) tellg()
D) seekp()
50. To perform identical operations for each type of data compactly and conveniently, we use -
------------
A)Inline function
B) function templates.
C) this pointer
D) friend function
51. A static data member generated from a static data member template is called ------------------
----------- static data member
A) inherited
B) base
C) generated
D) derived
A) true, false
B) false, true
C) true, true
D) false, false
53. Default values for the arguments have to be specified during ----------------
A) Initialization
B) Declaration
C) instantiation
C ) flow of control
i. C++ provides syntax to allow you to politely tell the user what exceptions this
function throws, so the user may handle them.
ii. To use set_unexpected(), you must include the header file <exception>.
A) true , false
B) false, false
C) true, true
D) false, true
A) vector
B) set
C) deque
D) list
C) Both A )and B)
D) Neither A) nor B)
58. The operator [] allows you to access a single character in a string, but without any
bounds checking , if you want bounds checking which of these function do you use .
A) at()
B) ioc()
C) st()
D) ooc()
59. Member functions of a class can be defined outside the class using ---------- operator
along with the class name.
A) **
B) &&
C) ::
D) ->
A) true ,false
B) true , true
C) false , false
D) false, true
Part C (Four mark questions)
void main()
{ int x=1;
switch (x)
case 0 : cout<<”zero”;
break;
case 2: cout<<”two”;
A) zero
B) one
C) onetwo
D) syntax error
#include <iostream>
using namespace std;
class Base {
public:
char* name;
void display() {
cout << name << endl;
}
};
int main() {
Derived d;
d.name = "Derived Class";
d.Base::name = "Base Class";
// call Base::display()
bptr->display();
}
A) syntax error
B) Base Class
C) Derived Class
D) name
A) 1-ii,2-I,3-iv,4-iii
C) 1-iv,2-iii,3-I,4-ii
D) 1-iii,2-iv,3-I,4-ii
1. A static member function cannot be declared with the keywords virtual, const, volatile,
or const volatile.
2. A static member function can have access to the 'this' pointer of the class.
3. Friend classes are used in cases where one class is tightly coupled to another class.
4. Static data types can be accessed without instantiation of the class in C++.
i. When you are reading a file, if you want to ignore certain amount of characters use flush()
function .
ii. Manipulators are global functions designed to be used in conjunction with insertion (<<) and
extraction (>>) operators.
iii. The essential characteristic of stream processing is that data elements must be sent to or
received from a stream one at a time, i.e. in serial fashion.
iv. The Input/Output system in C++ holds information about the result of every I/O operation.
67. ------------------------ are very useful when implementing generic constructs like vectors,
stacks, lists, queues which can be used with any arbitrary type.
A) Templates
B) constructor
C ) destructor
D) status Flag
//virtual.cpp
# include <iostream.h>
class base
{ public:
{cout<<“base”<<endl;}};
{ public:
void show()
{cout<<“derv1”<<endl;}};
{ public:
void show()
{cout<<“derv2”<<endl;}};
void main()
derv1 dv1;
derv2 dv2;
base *ptr;
ptr=&dv1;
ptr->show();
ptr=&dv2;
ptr->show();
A) derv 1
derv2
B) derv2
derv2
C)derv1
derv1
D) syntax error
a. The class diagrams describes the types of objects in the system and the static
relationship between them.
b. If the attribute is declared final its value can be changed.