INDEX

S NO / TOPICS / PAGE NO
1 / Unit 1 : Programming in C++ / 4- 55
2 / Unit 2 : Data Structures / 56-66
3 / Unit 3 : Database and SQL / 67-70
4 / Unit 4 : Boolean Logic / 71-75
5 / Unit 5 : Communication and Open Source Concepts / 76 -81
6 / Marking Scheme / 82-96

UNIT 1 : PROGRAMMING IN C++

OBJECT ORIENTED CONCEPTS (OOPS)

1. / The mechanism that binds code and data together and keeps them secure from outside world is known as
  1. Abstraction
  2. Inheritance
  3. Encapsulation
  4. Polymorphism

2. / The term ______means the ability to take many forms.
  1. Abstraction
  2. Inheritance
  3. Encapsulation
  4. Polymorphism

3. / The members of a class by default are
  1. Public
  2. Protected
  3. Private
  4. Mandatory to specify

4. / It is possible to declare as a friend
  1. A member function
  2. A global function
  3. A class
  4. All of the above

5. / Which of the following statements is NOT valid about operator overloading?
  1. Only existing operators can be overloaded
  2. Overloaded operator must have at least one operand of its class type
  3. The overloaded operators follow the syntax rules of the original operator
  4. None of the above

6. / Polymorphism is implemented through ......
  1. Function Overlaoding
  2. Virtual Functions
  3. Operator Overloading
  4. All of these.

7. / An object is
  1. One instance of a class
  2. Another word for a class
  3. A class with static method
  4. A method that accesses class

8. / A class defined within another class is
  1. Nested class
  2. Inheritance
  3. Containership
  4. Encapsulation

9. / A blueprint of an object in C++ is called a
  1. Object
  2. Class
  3. Instance
  4. None of these

10. / At which point of time a variable comes into existence in memory is determined by its
  1. Scope
  2. Storage class
  3. Data type
  4. All of the above

11. / Which of the following is false for cin?
  1. It represents standard input
  2. It is an object of istream class.
  3. It is a class of which stream is an object
  4. Using cin the data can be read from user’s terminal

12. / Member functions, when defined within the class specification
  1. Are always inline
  2. Are not inline
  3. Are inline by default, unless they are too big or too complicated
  4. Are not inline by default.

13. / Access to private data
  1. Restricted to methods of the same class
  2. Restricted to methods of other classes
  3. Available to methods of the same class and other classes
  4. Not an issue because the program will not compile

14. / C++ was originally developed by
A.Clocksin and Melish
B.Donald E.Knuth
C.Sir Richard Hadlee
D.BjarneStroustrup
15. / Inheritance is done to
A.Implement real world.
B. Reusability
C. Both A &B.
D. None
16. / An instance of class is known as.....
  1. Entity
  2. Object
  3. Functions
  4. None

17. / Which can be passed as an argument to a function?
  1. Constant
  2. Expression
  3. Another function
  4. All of the above

18. / Act of representing essential features without including background details and explanations is known as ...
  1. Encapsulation
  2. Abstraction
  3. Inheritance
  4. Polymorphism

19. / Member of a class specified as ______are accessible only to method of the class.
  1. Private
  2. Public
  3. Protected
  4. Derive

20. / A class enforces data hiding through ...... and ...... members.
  1. Private
  2. Public
  3. Private and Protected
  4. Private and Public

21. / A struct is the same as a class except that
A.There are no member functions
B.All members are public
C.Cannot be used in inheritance hierarchy
D.It does have a this pointer
22. / Object is an identifiable ...... with some characteristics and behaviour.
  1. Class
  2. Instance
  3. Entity
  4. None

23. / A class which can use all the features of an established class,is
  1. A static class
  2. A super class
  3. A Super Class
  4. Overloaded

24. / The functions which are defined inside the class are known as ....
  1. Virtual Functions
  2. Static Functions
  3. Inline Functions
  4. None

25. / Which of the following cannot be legitimately passed to a function
  1. A constant
  2. A variable
  3. A structure
  4. A header file

26. / A function call mechanism that passes arguments to a function by passing a copy of the values of the arguments is ______
A.Call by name
B.Call by value
C.Call by reference
D.Call by value result
27. / A variable defined within a block is visible
A.From the point of definition onward in the program
B.From the point of definition onward in the function
C.From the point of definition onward in the block
D.Throughout the function
28. / The process of building new classes from existing one is called ______.
A.Polymorphism
B.Structure
C.Inheritance
D.Cascading
29. / What term is used to describe the internal representation of an object that is hidden from view outside the object's definition?
A.Polymorphism
B.Structure
C.Inheritance
D.Data Abstraction
30. / Which of the following concepts means wrapping up of data and functions together?
A.Polymorphism
B.Structure
C.Inheritance
D.Encapsulation

CLASS and OBJECT

1. / The members of a class, by default, are
  1. public
  2. protected
  3. private
  4. mandatory to specify

2. / Which of the following statements are true in c++?
  1. Classes can not have data as public members.
  2. Structures can not have functions as members.
  3. Class members are private by default.
  4. None of these.

3. / Member functions, when defined within the class specification:
  1. are always inline.
  2. are not inline.
  3. are inline by default, unless they are too big or too complicated.
  4. are not inline by default.

4. / Which of the following concept of oops allows compiler to insert arguments in a function call if it is not specified?
  1. Call by value
  2. Call by reference
  3. Default arguments
  4. Call by pointer

5. / Which of the following term is used for a function declared inside a class?
  1. Member Variable

  1. Member function

  1. Class function

  1. Classic function

6. / Which of the following is an abstract data type?
A.intB.Double
C.stringD.Class
7. / Which of the following is correct about class and structure?
A. / class can have member functions while structure cannot.
B. / class data members are public by default while that of structure are private.
C. / Pointer to structure or classes cannot be declared.
D. / class data members are private by default while that of structure are public by default.
8. / Which of the following two entities (reading from Left to Right) can be connected by the dot operator?
A. / A class member and a class object.
B. / A class object and a class.
C. / A class and a member of that class.
D. / A class object and a member of that class.
9 / Which of the following keywords is used to control access to a class member?
A. / Default / B. / Break
C. / protected / D. / Asm
10. / Which of the following can access private data members or member functions of a class?
  1. Any function in the program.
  2. All global functions in the program.
  3. Any member function of that class.
  4. Only public member functions of that class.

11. /
Which of the following also known as an instance of a class?
A. / Friend Functions
B. / Object
C. / Member Functions
D. / Member Variables
12. /
Scope resolution operator is represented by
A. / ~
B. / ::
C. / :
D. / ;
13. / Constructor is executed when _____.
A. / an object is created
B. / an object is used
C. / a class is declared
D. / an object goes out of scope.
14. / Use of ______protects data from inadvertent modifications.
  1. private access specifier
  2. class protection operator, @
  3. none of these
  4. public access specifier

15. / Which of the following statements is correct?
A. / Data items in a class must be private.
B. / Both data and functions can be either private or public.
C. / Member functions of a class must be private.
D. / Constructor of a class cannot be private.
16. / Which of the following is the only technical difference between structures and classes in C++?
A. / Member function and data are by default protected in structures but private in classes.
B. / Member function and data are by default private in structures but public in classes.
C. / Member function and data are by default public in structures but private in classes.
D. / Member function and data are by default public in structures but protected in classes.
17. / Which of the following is user defined data type?
  1. int
  2. Private
  3. Class
  4. A & B Both

18. / The Object is not declared for which class?
  1. Parent
  2. Base
  3. Abstract
  4. Derived

19. / Data member is also called?
  1. Attribute
  2. Method
  3. Class
  4. Object

20. / A Class can have how many destructors?
  1. 1
  2. 2
  3. 3
  4. 4

21. / State true of false.
i) We cannot make the function inline by defining a function outside the class.
ii) A member function can be called by using its name inside another member function of the same class, this is known as nesting of member function.
A) True, True
B) True, False
C) False, True
D) False, False
22. / …………… is a way to bind the data and its associated functions together which allows the data and functions to be hidden.
A) Structure
B) Class
C) Enum
D) Both A and B
23. / What happens when we try to compile the class definition in following code snippet?
#include<iostream.h
void main()
{
class Birds {};
class Peacock : protected Birds {};
}
A. / It will not compile because class body of Eagle is not defined.
B. / It will not compile because a class cannot be protectedly inherited from other class.
C. / It will compile successfully.
D. / It will not compile because class body of Birds is not defined.
24. / Which of the following can access private data members or member functions of a class?
A. / Any function in the program.
B. / All global functions in the program.
C. / Any member function of that class.
D. / Only public member functions of that class.
25. / Which of the following type of data member can be shared by all instances of its class?
A. / Public
B. / Inherited
C. / protected
D. / Private
26. / How many specifiers are present in access specifiers in class?
A.1
B.2
C.3
D.4
27. / Which is used to define the member of a class externally?
A. :
B. ::
C. #
D. none of the above
28. / What is the output of this program?
#include <iostream.h
classrect
{
int x, y;
public:
voidval(int, int);
int area ()
{
return(x * y);
}
};
voidrect::val(int a, int b)
{
x = a;
y = b;
}
int main ()
{
rectrect;
rect.val(3, 4);
cout<"rect area: "<rect.area();
return0;
}
  1. rect area:12
  2. rect area: 12
  3. rect area:24
  4. rect area:42

29. / Which of the following is a valid class declaration?
A. class A { int x; };
B. class B { }
C. public class A { }
D. object A { int x; };
30. / When struct is used instead of the keyword class means, what will happen in the program?
A. access is public by default
  1. access is private by default
  2. access is protected by default
  3. none of the mentioned

31. / How to access the members through class object?
A. scope resolution operator
B. ternary operator
C. direct member access operator (.)
D. none of the mentioned
32. / Which of these following members are not accessed by using direct member access operator(.)?
A. public
B. private
C. protected
D. Both b & c
33. / What is the output of the following program?
#include <iostream.h
class Box
{
public:
double length;
double breadth;
double height;
};
void main()
{
Box Box1;
double volume;
Box1.height=5;
Box1.length=6;
Box1.breadth=7.1;
volume = Box1.height* Box1.length* Box1.breadth;
cout<"Volume of Box1 : "< volume <endl;
}
A. 210
B. 213
C. 215
D. 217
34. / What is the output of the program?
#include <iostream.h
classRect
{
int x, y;
public:
voidset_values(int,int);
int area ()
{
return(x * y);
}
};
voidRect::set_values(int a, int b){
x = a;
y = b;
}
int main ()
{
Rect recta, rectb;
recta.set_values(5, 6);
rectb.set_values(7, 6);
cout<"recta area: "<recta.area();
cout<"rectb area: "<rectb.area();
return0;
}
  1. recta area: 30 rectb area: 42
  2. recta area: 20 rectb area: 34
  3. recta area: 30 rectb area: 21
  4. none of the mentioned

35. / How many objects can created of a class?
  1. 1
  2. 2
  3. 3
  4. as many as possible

36. / Pick out the other definition of objects.
  1. member of the class
  2. associate of the class
  3. attribute of the class
  4. instance of the class

37. / What is the output of this program?
#include <iostream.h
class sample
{
private:
intvar;
public:
void input()
{
coutvar;
}
void output()
{
cout<"Variable entered is ";
coutvar<"\n";
}
};
void main()
{
sample object;
object.var=5;
object.input();
object.output();
}
  1. Variable entered is 5
  2. runtime error
  3. private member access by object
  4. none of the mentioned

38. / Which special character is used to mark the end of class?
A. ;
B. :
C. #
D. $
39. / What is the output of this program?
#include <iostream.h
class number
{
inti;
public:
intgeti();
voidputi(int j);
};
int number::geti()
{
returni;
}
void number::puti(int j)
{
i= j;
}
void main()
{
number s;
s.puti(10);
couts.geti();
}
  1. 10
  2. 11
  3. 20
  4. 22

40. / Which is true for this keyword
  1. this.member
  2. this->member
  3. this*.member
  4. *this.member

CONSTRUCTORS & DESTRUCTORS

1. / Which of the following is not a type of constructor?
  1. Copy constructor
  2. Friend constructor
  3. Default constructor
  4. Parameterized constructor

2. / Which of the following statement is correct?
  1. A constructor is called at the time of declaration of an object.
  2. A constructor is called at the time of use of an object.
  3. A constructor is called at the time of declaration of a class.
  4. A constructor is called at the time of use of a class.

3. / Which of the following is correct about function overloading?
  1. The types of arguments are different.
  2. The order of argument is different.
  3. The number of argument is same.
  4. Both A and B.

4. / Given a class named Book, which of the following is not a valid constructor?
A.Book ( ) { }
B.Book ( Book b) { }
C.Book ( Book &b) { }
D.Book (char* author, char* title) { }
5. / How many constructors can a class have?
  1. 0
  2. 1
  3. 2
  4. any number

6. / Which of the following is not the characteristic of constructor.
  1. They should be declared in the public section.
  2. They do not have return type.
  3. They can not be inherited.
  4. They can’t be of same name as that of a class.

7. / A copy constructor takes
  1. no argument
  2. one argument
  3. two arguments
  4. arbitrary no. of arguments

8. / A constructor that accepts ______parameters is called the default constructor.
A. / one / B. / two
C. / no / D. / five
9. / What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object with no-arguments?
A. / Compile-time error.
B. / Preprocessing error.
C. / Runtime error.
D. / Runtime exception.
10. / Destructor has the same name as the constructor and it is preceded by ______.
A. / ! / B. / ?
C. / ~ / D.
11. / Constructors and destructors are called implicitly when the objects of the class is .....
A. / Created and releases memory
B. / inherit parent class
C. / are constructed
D. / are destroyed
12. / Which constructor function is designed to copy objects of the same class type?
A. / Create constructor
B. / Object constructor
C. / Dynamic constructor
D. / Copy constructor
13. / Which of the following statement is correct?
A. / Constructor has the same name as that of the class.
B. / Destructor has the same name as that of the class with a tilde symbol at the beginning.
C. / Both A and B.
D. / Destructor has the same name as the first member function of the class.
14. / Which of the following statement is incorrect?
A. / Constructor is a member function of the class.
B. / The compiler always provides a zero argument constructor.
C. / It is necessary that a constructor in a class should always be public.
D. / Both B and C.
15. / When are the Global objects destroyed?
A. / When the control comes out of the block in which they are being used.
B. / When the program terminates.
C. / When the control comes out of the function in which they are being used.
D. / As soon as local objects die.
16. / Copy constructor must receive its arguments by ______.
A. / either pass-by-value or pass-by-reference
B. / only pass-by-value
C. / only pass-by-reference
D. / only pass by address
17. / A function with the same name as the class, but preceded with a tilde character (~) is called ______of that class.
A. / constructor / B. / destructor
C. / function / D. / object
18. / Which of the following gets called when an object goes out of scope?
A. / constructor
B. / destructor
C. / main
D. / virtual function
19. /
Which of the following statement is correct?
A. / Destructor destroys only integer data members of the object.
B. / Destructor destroys only float data members of the object.
C. / Destructor destroys only pointer data members of the object.
D. / Destructor destroys the complete object.
20. / ______is used to make a copy of one object to another object of the same class type.
A. / constructor
B. / copy constructor
C. / destructor
D. / default constructor
21. / Constructors ______to create objects in different ways.
A. / cannot overloaded
B. / can be overloaded
C. / can be called
D. / can be nested
22. / Which of the following statement is correct?
A. / A destructor has the same name as the class in which it is present.
B. / A destructor has a different name than the class in which it is present.
C. / A destructor always returns an integer.
D. / A destructor can be overloaded.
23. / Which of the following are NOT provided by the compiler by default?
A. / Zero-argument Constructor
B. / Destructor
C. / Copy Constructor
D. / A & B
24. / It is a ______error to pass arguments to a destructor.
A. / logical / B. / virtual
C. / syntax / D. / linker
25. / If the programmer does not explicitly provide a destructor, then which of the following creates an empty destructor?
A. / Preprocessor
B. / Compiler
C. / Linker
D. / main()function
26. / A constructor having parameters with default values is known as ......
A. / default constructor
B. / copy constructor
C. / Constructor with default values.
D. / None of these
27. / How many default constructors per class are possible?
A. / Only one
B. / Two
C. / Three
D. / Unlimited
28. / Which of the following statement is correct about destructors?
A. / A destructor has void return type.
B. / A destructor has integer return type.
C. / A destructor has no return type.
D. / A destructors return type is always same as that of main().
29. / Which of the following statement is correct?
A. / A constructor has the same name as the class in which it is present.
B. / A constructor has a different name than the class in which it is present.
C. / A constructor always returns an integer.
D. / A constructor cannot be overloaded.
30. / Which of the following implicitly creates a default constructor when the programmer does not explicitly define at least one constructor for a class?
A. / Preprocessor / B. / Linker
C. / Loader / D. / Compiler

31. / A destructor takes ______arguments.
A. / one / B. / two
C. / three / D. / no
32. / Destructor calls are made in which order of the corresponding constructor calls?
A. / Reverse order
B. / Forward order
C. / Depends on how the object is constructed
D. / Depends on how many objects are constructed
33. / Which of the following never requires any arguments?
A. / Member function
B. / Friend function
C. / Default constructor
D. / constfunction
34. / A class's ______is called when an object is destroyed.
A. / constructor
B. / destructor
C. / assignment function
D. / copy constructor
35. / Destructors ______automatically when the program terminates with a call to function exit or function abort.
A. / are called
B. / are inherited
C. / are not called
D. / are created
36. / Which of the following statement is correct?
A. / A constructor of a derived class can access any public and protected member of the base class.
B. / Constructor cannot be inherited but the derived class can call them.
C. / A constructor of a derived class cannot access any public and protected member of the base class.
D. / Both A and B
37. / Which of the following statements are correct?
A. / Constructor is always called explicitly.
B. / Constructor is called either implicitly or explicitly, whereas destructor is always called implicitly.
C. / Destructor is always called explicitly.
D. / Constructor and destructor functions are not called at all as they are always inline.
38. / How many times a constructor is called in the life-time of an object?
A. / Only once
B. / Twice
C. / Thrice
D. / Depends on the way of creation of object
39. / Which of the following statement is correct about constructors?
A. / A constructor has a return type.
B. / A constructor cannot contain a function call.
C. / A constructor has no return type.
D. / A constructor has a void return type.
40. / Which of the following statement is correct whenever an object goes out of scope?
A. / The default constructor of the object is called.
B. / The parameterized destructor is called.
C. / The default destructor of the object is called.
D. / None of the above.
41. / Answer the questions (i) and (ii) after going through the following program
#include<iostream.h
#include<string.h
class Bazar
{
char Type[20];
char Product[20];
intQty;
float Price;
Bazar()//Function 1
{
strcpy (Type,”Electronic”);
strcpy (Product,”Calculator”);
Qty = 10;
Price=225;
}
public:
void Disp( )//Function 2
{
cout<Type<”-“<Product<”:“<Qty<”@“<Price<endl;
}
};
void main( )
{
Bazar B;//Statement 1
B.Disp();//Statement 2
}
(i)Will Statement 1 initialize all the data members for object B with the values given in the Function 1? Justify your answer suggesting the correction(s) to be made in the above code.
  1. Yes
  2. No
(ii)What shall be the possible output when the program gets executed? (Assuming, if required – the suggested correction(s) are made in the program).
  1. Electronic-Calculator:10@225
  2. Electronic Calculator ::10@250
  3. Electronic Calculator :10@250
  4. Electronic-Calculator::10@225

42. / Answer the questions (i) and (ii) after going through the following class:
class Seminar
{
int Time;
public:
Seminar()//Function 1
{
Time=30;cout<”Seminar starts now”<end1;
}
void Lecture()//Function 2
{
cout<”Lectures in the seminar on”<end1;
}
Seminar(int Duration)//Function 3
{
Time=Duration;cout<”Seminar starts now”<end1;
}
~Seminar() //Function 4
{
cout<”Vote of thanks”<end1;
}
};
(i)In Object Oriented Programming, what is Function 4 referred as ?
  1. Copy Constructor
  2. Constructor
  3. Destructor
  4. Default Constructor
(ii)In Object Oriented Programming, when does Function 4 get invoked/called?
  1. When user calls it.
  2. It is invoked as soon as the scope of the object gets over.
  3. It can’be invoked.
  4. A & C
(iii)In Object Oriented Programming, which concept is illustrated by Function 1 and Function 3 together? Write an example illustrating the calls for these functions.
  1. Inheritance
  2. Encapsulation
  3. Constructor Overloading (Polymorphism)
  4. Data hiding
(iv)What is the correct code to call Function 1?
A.Seminar S1
B.Seminar S1;
C.S1;
D.A & C
(v)What is the correct code to call Function 3?
A. Seminar S2(90);
B.Seminar S2;
C.S2;
D.B & C
43. / In which case is it mandatory to provide a destructor in a class?
  1. Almost in every class
  2. Class for which two or more than two objects will be created
  3. Class for which copy constructor is defined
  4. Class whose objects will be created dynamically

44 / Constructor Overloading implements ...... feature of OOPs
  1. Polymorphism
  2. Inheritance
  3. Abstraction
  4. None

45 / What happens when following statements are executes assuming Book is a class
Book a,b;
------
a=b;
  1. Copy Constructor is called.
  2. Default Constructor
  3. Assignment Operation
  4. None

INHERITANCE