volume-2 object technology 2015-16 chap-1 object … · 12/09/2015  · volume-2 object technology...

22
VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? தா வி ரதி வறி இைல R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts Using C++ 1.What is an Object? A group of data and the operations are termed as object.The operations represent the behavior of the object. 2.What is encapsulation? The mechanism by which the data and functions are bound together within an object definition is called encapsulation. 3.What is polymorphism? The ability of an object to respond differently to different messages is called as polymorphism. Eg. draw(side) – draws a square draw(length,breath) – draws a rectangle 3.What is the significance of an object? a) An object is a group of related functions and data that serves those functions. b) An object is a kind of self-sufficient “subprogram” with a specific functional area. 4.What is the difference between polymorphism and inheritance? Polymorphism Inheritance Reduces software complexity, as multiple definitions are permitted to an operator or functions Allows a class to be derived from a existing class, reusability of code and also promote insertion of updated modules 6.How object oriented programming solve a problem given? Object Oriented programming facilitates the way of problem solving by combining “data” and “operations” that are to be performed on the data. 7.What is inheritance? The process of acquiring Base class properties by a derived class is called inheritance. 8.What are the advantages of OOPS. a)Encapsulation -Allows programs to organize as objects that contain both data and functions. b)Data hiding or Abstraction of Data provides security to data as unrelated member functions cannot access its data c)Polymorphism reduces software complexity d) Inheritance allows a class to be derived from a existing class thus promoting reusability of code. 9.What is data hiding. Data hiding or Abstraction of Data provides security to data as unrelated member functions cannot access its

Upload: others

Post on 27-Apr-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

1

Chap-1 Object Oriented Concepts Using C++

1.What is an Object?

A group of data and the operations are termed as object.The operations represent the behavior of the

object.

2.What is encapsulation?

The mechanism by which the data and functions are bound together within an object definition is called

encapsulation.

3.What is polymorphism?

The ability of an object to respond differently to different messages is called as polymorphism.

Eg. draw(side) – draws a square

draw(length,breath) – draws a rectangle

3.What is the significance of an object?

a) An object is a group of related functions and data that serves those functions.

b) An object is a kind of self-sufficient “subprogram” with a specific functional area.

4.What is the difference between polymorphism and inheritance?

Polymorphism Inheritance

Reduces software complexity, as multiple

definitions are permitted to an operator or

functions

Allows a class to be derived from a existing class,

reusability of code and also promote insertion of

updated modules

6.How object oriented programming solve a problem given?

Object Oriented programming facilitates the way of problem solving by combining “data” and

“operations” that are to be performed on the data.

7.What is inheritance?

The process of acquiring Base class properties by a derived class is called inheritance.

8.What are the advantages of OOPS.

a)Encapsulation -Allows programs to organize as objects that contain both data and functions.

b)Data hiding or Abstraction of Data provides security to data as unrelated member functions cannot

access its data

c)Polymorphism reduces software complexity

d) Inheritance allows a class to be derived from a existing class thus promoting reusability of code.

9.What is data hiding.

Data hiding or Abstraction of Data provides security to data as unrelated member functions cannot

access its

Page 2: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

2

Chap-2 OverView of C++

1.What are tokens?

A token is the smallest individual unit in a program.

Tokens are the basic types of elements essential for program coding

2.What are the classifications of tokens?

Keywords, identifiers, constants, Operators and Punctuators

3.What are the keywords in C++? List a few of them.

If, for, do, while, case, break, class, switch, public, private,protected

4.What is a keyword?

a) Keyword has a special meaning to the language compilier

b) Keywords are reserved words for special purpose.

c)Keywords cannot be used as identifiers

5.Define String Literal?

a) It is a sequence of characters by double spaces

b)These are treated as array of characters

c) Each string literal is by default with special character ‘\0’ which marks the end of string.

6.What are the different types of operators?

Arithmetic, Assignment, Conditional, Logical, Manipulator, Relational, Scope Resolution,

Shift, Type Cast

7.What are conditional operators? Give its syntax?

A ternary operator ?: is also called as conditional operator.

Syntax: E1 ? E2 : E3 where E1 , E2 and E3 are operands

Eg. a = 10, b = 10, x = (a<b) ? a*a : b% a; Answer: x= 0

8.What is assignment operator?

Equal to ( = ) is the simple assignment operator. Used to assign the result of an expression on the right

hand side and variable to left hand side.

Ans: A = 15

9.What are the two important purposes of void type?

a) To indicate the function does not return a value

b) It indicates that it hold nothing

c) to declare a generic pointer

10.What are pointer variables?

a) It can store the address of other variables

Page 3: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

3

b) The address stored in pointer variable should be of the same data type a pointer variable

c) The asterisk( * ) is used to declare the pointer variable

d) It is used to display the contents stored at a location. It is an unary operator.

11.What is character constant?

a) It contains a single character enclosed within single quotes

b) It can be any character alphabet, numerical, mathematical and relational or any other special

character as part of the ASCII code.

12.What are the rules to be followed while writing variable name?

a) It should begin with an alphabet or underscore followed by alphabets or numbers

b) Variable Names are case sensitive

eg. test, sum_10, xyz

13.How operators are classified based on operand requirements?

Operators are classified as Unary, binary and Ternary operators

14.What is the used of User Defined Data type?

a) User defined data type enables a programmer to invent his own data type and define its values

b) This helps to improve credibility and readability of the program

15.Write a note on enumerated data type?

It is user defined data type. AS the name suggest, enumerated data type helps users in creating a list

of identifiers, also called symbolic numeric constancts of the type int.

16.Give the syntax and examples of enum data type?

Syntax : enum data type identifier (value1, value2…….)

Eg. enum holidays( Sunday, Saturday)

17. Define Type definition and syntax?

Users can define a variable that would represent an existing data type. It allows users to define such

user defined data type identifier.

Syntax: typedef data_type user_defined_data type identifier

18.Name four storage specifiers

The four storage specifiers are auto, static, extern, and register.

19.What is meant by garbage?

Auto variables are not initialized with appropriate values based on their data type. These variables

get undefined values known as garbage.

20.List out the user defined data types?

Ans type def, enum

Page 4: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

4

21.Define size of operator in c++?

Size of an operator returns the size (memory requirement) in terms of bytes, of the given expression

or data type.

Eg. sizeof(int) – returns the value 2

22.Define typecast?

It refers to the process of changing the data type of the value stored in a variable.

Chapter-3 Basic statements

1.What are the different types of statements?

Input/Output, Declaration, Assignment, Control Structures, Function call, Object, Return.

2.What is the use of cin object?

a) It is a standard input stream.

b) Input stream represents the flow of data from the input device – keyboard

c) It is available in a header file as iostream.h

3.What are the three sections in c++ programs?

a)Include files

b) Declaration of variables, data type, user defined functiosn

4. What are the control structures?

Program statements that cause a jump of control from one part of a program to another are called

Control Structures.

5.What is the purpose of break statement?

a)Break statement would exit the current loop only.

b)It accomplishes jump from the current loop

6.What is the use of cout object?

a) It is a standard output stream

b) Output stream normally flows to the screen display

c) It is available in a header file as iostream.h

7.How is a pointer variable different from ordinary variable?

A pointer variable holds a memory address where else an ordinary variable holds data. In pointer

memory location of a variable can be directly accessed. The symbols used in pointer type are

&( address of operator ) and the value of the operator(*)

8.What is the purpose of using main function?

a) When the program is executed the main functions will be automatically executed

b) It is from this block, that one needs to give call statements to the various modules that need to be

executed and the other executable statements.

Page 5: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

5

9.What is the purpose of continue statement?

This statement forces the next iteration of the loop to take place, skipping any code following the

continue statement in the loop body.

Five marks

1.What is loop? Explain the three kinds of loops?

Loops execute a set of instructions repeatedly for a certain number of times.

There are three kinds of loops, a) Do while loop 2) While do loop 3) for loop

a) Do while loop

example

int i=1, s = 0;

Syntax: do do

{ {

Action block s = s + i;

} while (condition); i = i + 1;

} while ( i<=10);

Do while loop is called as EXIT-CHECK loop. The condition marks the last statement of the body of the

loop

While loop example

Syntax: int i = 1, s= 0;

while (condition) while(i<=10)

{ {

Action block s = s + i;

} i = i + 1;

}

a) The body of the while loop will be executed only the condition is true.

b) The control exits the loop once the condition is evaluated as false.

c) This loop is known as ENTRY-CHECK loop.

3. for loop

Syntax

for ( initial value; test condition; increment)

{

Action block

}

Example: for ( i=1;I < 6; i++ )

{

s = s + i;

Page 6: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

6

}

a) The control variable is initialized first

b) Test condition is evaluated

c) The body of the loop is executed only if the condition is True

d) The control variable is increment and the test condition will be evaluated again

e) The loop is terminated when the test condition is false

2. Explain the switch statement and give suitable examples?

It is multiple branching statement where based on a condition, the control is transferred to one of

the many possible points.

Syntax:

switch(expression)

{

case 1 : action block 1 ; break;

case 2 : action block 2 ; break;

case 3 : action block 3 ; break;

default : action block 4 ; break;

}

Example

switch ( n)

{

case 1 : cout<<”Number is One “; break;

case 2 : cout<<”Number is Two “; break;

case 3 : cout<<”Number is Three “; break;

default : cout<<”Invalid Number “; break;

}

Break Statement

1) Break statement would exit the current loop only

2) It accomplishes jump from the current loop

3. What are header files. How it can be used in c++?

a) A header file comprises of all standard declarations and definitions for predefined functions

b) One can include the header file in the program by using a preprocessor directive

c) A preprocessor directive starts with # which instructs the compiler to do the required job

d) #include<iostream.h> is a typical preprocessor directive that instructs the compiler to include the

header file iostream.h

e)The other header files are stdio.h, ctype.h, match.h

4.List some qualifiers or modifiers.

Long, short, signed and unsigned

Page 7: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

7

5.What is a modifier?

A modifier alters the base data type to yield new data type

6.What is impact of modifiers?

a) unsigned modifies the range of the integer values as the sign bit is also used to store data

b) long increases the bytes for a particular data type, thus increasing the range of values.

7.What are implicit conversions?

Implicit conversions refers to data type changes brought about in expressions by the compiler.

Eg. float f = 7.6;

int x = f;

8.What is typecast?

Type cast refers to the process of changing the data type of the value stored in a variable.

Eg. x = 8% (int) 7.7

Float constant 7.7 is converted to integer constant by type casting it.

4. FUNCTIONS

1.What are functions?

a) Functions are the building blocks of c++ programs

b) It is also the executable segments in a program

c) The starting points for the execution of a program is main()

2.What is function prototyping?

a) It should be declared before they are used in a program

b) Declaration of a function is made through a function prototype.

c) The main purpose of function prototype is to help the compiler to check the data requirement of

the function

3. What is the syntax of function prototype?

Syntax <type><function identifier > < arguments>

Eg. void max ( int a , int b)

3.What is calling a function?

a) A function can be called or invoked from another function by using its name

b) The function name may include a set of actual parameters, enclosed in parentheses separated by

commas

4.What are the rules for actual parameters?

It can be passed in the form of constants or variables or expressions to the formal parameters, which

Page 8: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

8

are of value type.

5.What are the two methods used in functions?

a) Call by value method

b) Call by reference method

6.What is the main purpose of function prototype?

a) It helps the compiler to check the data requirement of the function

b) With function prototyping, a template is always used when declaring and defining a function

c) When a function is called, the compiler uses the template to ensure that proper arguments are

passed, and the return value is treated correctly.

7.Differentiate call by value and call by reference?

Call by Value Call by reference

The flow of data is always from the call statement

to the function definition

Formal and actual parameters in referen ce type

point to the same storage area

Any change in the formal parameter is not

reflected back to the actual parameter

Any change in the formal parameter is reflected in

actual parameter

8.What is meant by actual and formal parameters?

The parameter associated wih call statement is called actual parameters and the parameter

associated with function header is called formal parameters

9.What is the use of scope resolution operator?

a) :: is the scope resolution operator.

b) It is used to refer variables declared at file level

c) This is helpful only under situations where the local and file scope variables have the same name.

10.What are the advantage of functions?

a) Reduce the size of the program

b) Induce resusability of code

c) A function can be shared by other programs by compiling it separately and loading them together.

Five Marks

1.Explain the different scopes of variables in c++?

There are four types of scopes in c++.

They are a) local scope b) function scope c)file scope d)Class scope

a) Local Scope

a) It is defined within a block

b) It is block in which it is defined

c) It cannot be accessed from outside the block of its declaration

d) A block of code begins and ends with curly braces{ }

e) It exists only while the block of code in which they are declared is executing

Page 9: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

9

b) Function Scope

a) It is declared within a function is extended to function block, and all sub-blocks

b) It is accessible in all the sub-blocks

c) It is lifetime of a function scope variable is the lifetime of the function block

d) The scope of formal parameters is block function scope.

c) File Scope

a) A variable declared above all blocks and functions have the scope of a file

b) The file scope variable is the entire program

c) The lifetime of a file scope variable is the lifetime of a program

d) Class Scope

a)A class is a way to bind the data and its associated functions together

b)Classes provide a method for packing together

2.Explain Inline Functions?

When the functions are small, the compiler replaces the function call statement by its definition

ie. Its code during program execution. This feature is called as inline function.

a) An inline looks like a normal function in the source file but inserts the functions’s code

directly into the calling program

b) Inline functions execute faster but require more memory space

c) Reusability of code and reduction in code size

3.Explain the call by value method in function with example?

In this method, the called function creates new variable to store the value of the arguments passed

to it. This method copies the value of actual parameters into the formal parameters. The function

creates its own copy of arguments and then uses them. The flow of data is always from the call

statement to the function definition.

// demo Call by Value

#include<iostream.h>

#include<conio.h>

#include<conio.h>

void swap(int n1, int n2)

{

int temp;

temp = n1;

n1= n2;

n2= temp;

cout<<'\n'<<n1<<'\t'<<n2<<'\n';

}

void main()

Page 10: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

10

{

int m1=10, m2=20;

clrscr();

cout<<"\n Value before invoking swap"<<m1<<'\t'<<m2;

cout<<"\n Calling Swap,,,";

swap(m1,m2);

cout<<"\n Back to main.. Values are.."<<m1<<'\t'<<m2;

getch();

}

In call by value method, any change in the formal parameter is not reflected back to the actual

parameter

4.Explain the call by reference method in function with example?

In this method, the called function arguments- formal parameters become alias to the actual

parameters in the calling functions. The function is working with its own arguments. It is actually

working on the original data. Any change in the formal parameters is reflected back in the actual

parameter.

// demo Call by reference

#include<iostream.h>

#include<conio.h>

void swap(int &n1, int &n2)

{

int temp;

temp=n1;

n1=n2;

n2=temp;

cout<<'\n'<<n1<<'\t'<<n2<<'\n';

}

void main()

{

int m1=10, m2=20;

clrscr();

cout<<"\n Values before swap call.."<<'\t'<<m1<<'\t'<<m2;

swap(m1,m2);

cout<<"\n Calling Swap..";

cout<<"\n Back to main Values are "<<'\t'<<m1<<'\t'<<m2;

getch();

}

In call by reference method, any change made in the formal parameter is reflected back in the actual

parameter

Page 11: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

11

Chapter-5 Structured Data Type –Arrays

1.What is an array? What are the types of arrays?

An array is a collection of variables of the same type that are referenced by a common name. Arrays

are of two types- One dimensional Array eg. a[10]

Two dimensional Array eg. a[5][5]

2.What is sorting?

One can rearrange the data in a given array either in ascending or descending order. This process is

called sorting .

3.Give the syntax for gets() get getline?

gets(char * )

getline cin.getline(char*, no.of characters,delimiter)

4.What is matrix?

It is a set of mn numbers arranged in the form of a rectangular array of m rows and n columns. It can

be represented through 2-D arrays.

5.Give the syntax for strlen() and its uses?

strlen(char *)

It returns the number of characters stored in the array.

Ex. name = “Chennai”

p = strlen(name); Ans: The given string length is 7

6.Give the syntax for strcpy and its uses.

strcpy(char *)

Copies the source string to a target string.

Ex. a = “Chennai”

strcpy(b,a);

7.Give the syntax for strcmp and its uses.

strcmp(string1, string2)

It compares the two given strings.

It returns 0 if strings are equal, returns >0 if string1 > string 2

Ex. Strcmp(“Abc”, “Abc”) returns as 0

8.Give the syntax for single dimensional array?

Syntax : Datatype [space ] array identifier [size ];

Ex. Int mark[5];

9.Give the syntax for two dimensional array?

Syntax : Datatype [space ] array identifier [row size ][column size];

Page 12: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

12

Ex int marks [5][5];

10.What are the two methods to display the contents of character array?

a) cout <<name- this is similar to any other variable

b) cout.write(pincode, 7);

11.How the strings are treated? Give example?

a) Strings are called as literals, which are treated as single dimension of characters

b) The declaration of strings is same as numeric array.

Ex. char name[10];

Char vowels[] = { ‘a’,’e’,’I’,’o’,’u’ };

12.Write a note on write()?

a) It is a member function of standard output stream

b) All member functions of a class should be accessed through an object/instance of class

c) The two parameters required for write function are identifier string characters and number of

characters to be displayed.

13.How is the size of a 2D array calculated?

Number of elements * memory requirement for one element

Eg.int sales[2] [4]

Number of elements = Rows x Columns x memory req. for one element

= 2 x 4 x 2 =16

Chapter 6 Classes and Objects

1.Define a class?

A class is a new way of creating and implementing a user defined data type. Classes provide a method

for packing together. {OR}

A Class is a way to bind the data and its associated functions together.

2.What is specification of a class?

a) Class Declaration b) Class Function definition

3.What are the three access specifiers?

Private, Public and Protected

4.Give general form of class declaration?

Class classname

{

private:

variable declaration;

function declaration;

protected:

Page 13: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

13

variable declaration;

function declaration;

Private:

variable declaration;

function declaration;

};

5.What is encapsulation?

The binding of data and functions together into single entity is referred to as encapsulation

6.What is data hiding?

The members and functions declared under private are not accessible by members outside the class,

this is referred to as data abstraction.

7.What is Abstraction?

Instruments allowing only selected access of components to objects and to members of other classes

is called data abstraction.

8.Difference between Data members and Member function?

Data Members Member functions

1. It is data variables that represent the

features or properties of a class

It is the function that perform specific tasks in a

class

2. It is also called a attributes It is called as methods

9.What are Static Data Members?

a) It is initialized to zero only when the first object of its class is created

b) Only one copy of the member variable is created

c) Its scope or visibility is within the class

10.Define friend functions?

Accessibility by only its own members and certain special functions called as friend functions

11.What is the use of dot operator?

The members of a class are accessed using the dot operator. The call statement to the function

execute() of the class. Ex. stud.execute()

12.What is meant by methods in c++?

a) The class data type can be further extended by defining its associated functions

b) These functions are also called methods, as they define the various operations that can be

performed on the data.

13. Write a short note on a member of a class?

a) Class comprised of members. Members are further classified as data members and member

function

Page 14: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

14

b)Member function are the functions that perform specific tasks in a class

c) Member functions are called methods and data members are also called attributes.

14.What is meant by objects in c++?

a) In c++ the class variable are known as objects

b) The declaration of an object is similar to that of a variable of any basic type

c) Objects can also be created by placing their names immediately after the closing brace of the class

declaration

15.Write short notes on memory allocation of objects?

a) No separate memory space is allocated for member function when the object is created

b) Only required memory space for the member variables is allocated separately for each object

Chapter – 7 Polymorphism 1.Define Polymorphism?

The polymorphism means many forms. Poly – many morph- Shapes)

2.Define overloading?

The term overloading means a name having two or more distinct meanings

3.Define Function Overloading?

The ability of the function to process the message or data in more than one form is called as function

Overloading.

Eg. area_circle() – calculate the area of a circle

area_triangle - calculate the area of a triangle

4.What is operator overloading?

The mechanism of giving special meaning to an operator is called as operator overloading

5.List out the operators that cannot be overloaded?

1.Membership operator

2. Scope resolution operator

3.Size of operator

4. Conditional operator

6.How are functions invoked in function overloading?

a) Look for the exact match of a function prototype with that of a function call statement

b) In case a exact match is not available, it looks for the next nearest match.

Five marks

1.What is the advantage of operator overloading? Or List he rules for overloading operators?

a) Only existing operators can be overloaded. New operators cannot be created

b) The overloaded operator must have atleast one operand of user defined type.

Page 15: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

15

c) The basic definition of an operator cannot be replaced

d) Overloaded operators behave in the same way as the basic operators in terms of their operands

e)When binary operators are overloaded, left hand object must be an object of relevant class

f) Binary operators overloaded through a member function take one explicit argument.

2.Rules for function overloading?

a) Each overloaded function must differ either by the number of its formal parameters

b) The return type of overloaded functions may or may not be the same data type.

c)The default arguments of overloaded functions are not considered by the x++ compiler as part of the

parameter list.

d)Do not use the same function name for two unrelated functions.

3.What does the operator overloading provides?

a) The basic c++ operators like + * - + < etc. One cannot overload c++ specific operators like

membership operator, scope resolution operator, size of operator, and conditional operator.

b)The overloaded function definitions are permitted for user defined data type.

c) Operator functions must be either member functions or friend functions

d) The new definition that is provided to an operator does not overrule the original definition of the

operator

4.List out the steps involved In defining an overloaded operator?

a) Create a class that defines the data type that is to be used in the overloading operations

b) Declare the operator functions operator() in the public part of the class

c) Define the operator functions to implement the required operatorions

Chapter – 8 Constructors and Destructors

Two marks

1.Difference between constructors and destructors.

Constructors Destructors

1.When an instance of class comes into a

scope, a Special function called the

constructors gets executed

When a class object goes out of a scope, a special

function called the destructor gets executed.

2.Same name as class Same name of a class but prefixed with tilde symbol

3.Have parameter list Cannot have parameter list

4.Constructors can be overloaded Destructors cannot be overloaded

2.What are the functions of constructor?

a) The constructor function initializes the class object

b) The memory space is allocated to an object

Page 16: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

16

3.How is copy constructor executed?

a) When an object is passed as a parameter to any of the member functions.

Ex. void add :: putdata(add x )

b)When a member function returns an object. Ex. add getdata();

c)When an object is passed by reference to constructor . Ex. add a, b(a)

4.Define Destructor?

It is a function that removes the memory of an object, which was allocated by the constructor at the

time of creating an object. It carries the same name as the class tag, but with a tilde(~) as prefix.

Ex. ~ simple()

5. What is default constructor?

The constructor add() is a constructor without parameters. It is called a default constructor.

6.What is a constructor?

When an instance of a class comes into scope, a special function called the constructor gets executed.

The constructor function initializes the class object. Name of the constructor is the same as the class

name.

Five marks

1.What is the rule for constructor?

a) The name of the constructor must be the same as that of the class

b) The constructor can have parameter list

c) The constructor function can be overloaded

d)The compiler generates a constructor in the absence of a user defined constructor

e)The constructor is executed automatically

2.What is the rule for destructor?

a) The destructor has the same name as that of the class prefixed by the tilde character (~).

b)The destructor cannot be arguments

c)It has no return type

d)Destructors cannot be overloaded

e)In the absence of user defined destructor. It is generated by the compiler

f)The destructor is executed automatically when the control reaches the end of class scope.

Chapter 9. INHERITANCE

1.Define inheritance?

Inheritance is the most powerful feature of an object oriented programming language. It is a process

of creating new classes called derived classes, from the existing or base classes.

Page 17: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

17

2.What are the advantages of inheritance?

a.Reusability of code: Many application are developed in an organization. Code developed for one

application can be reused in another application. This saves a lot of development time.

b)Code sharing: The method of base class can be shared by the derived class

c)Consistency of interface- The inherited attributes and methods provide a similar interface to the

calling methods

3.Define a base class?

It is a class from which other classes are derived. A derived class can inherit members of a base class.

4.What are the points to be observed while defining a derived class?

a) The keyword class has to be used

b) The derived class is used after the keyword class

c) A single colon

d) The type of declaration private, public or protected

e) The name of base class or parent class

f) The remainder of the derived class definition

5.How to declare a derived class?

Class derived name: visibility mode base class_id

{

Data members of the derived class

Functions members of derived class

}

6.What is accessibility?

An important feature in heritance is to know as to when a number of a base class can be used by the

object or the members of derived class. This is called as accessibility.

7.What is abstract class?

Classes used only for deriving other classes are called abstract classes. Ie Objects for these classes are

not declared.

8.Name the different types of inheritance?

Single inheritance

Multiple inheritance

Multilevel inheritance

Hybrid inheritance

Hierarchical inheritance

9.What is single inheritance?

When a sub class inherits only from the one base class is known as single inheritance.

Ex. Base Class �Employee

Page 18: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

18

Derived Class -� Manager

10.Write a note on access specifiers of inheritance?

a) The three access specifiers are private, protected and public.

b) Access specifier is also referred to as visibility mode

c) the default visibility mode is private

11.How constructors and destructors are executed in inheritance?

a) the constructors are executed in the order of inherited class ie from base constructor to derived

b) the destructors are executed in the reverse order

Five marks

1.Explain the different types of inheritance.

Classes can be derived from classes that are themselves derived. There are different types of

inheritance .

Single inheritance

Multiple inheritance

Multilevel inheritance

Hybrid inheritance

Hierarchical inheritance

1.Single Inheritance

When a derived class inherits only from one base class. It is known as single inheritance.

Base Class – Employee

Derived Class - Manager

2.Multiple Inheritance

When a derived class inherits from multiple base classes it is known as multiple inheritance

Base Class – Address Base Class – Office

Derived Class – Manager

3.Multilevel Inheritance

The transitive nature of inheritance is reflected by this form of inheritance. When a class is derived

from a class which is a derived class well , then this is referred to as multilevel inheritance

Base Class – Grand Father

Page 19: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

19

Derived – Father

Derived – Child

Chapter 10 IMPACT OF COMPUTERS ON SOCIETY

1.How are the computer for personal life?

a) Word processing, Databases, Spreadsheets and multimedia presentations packages have increased

the efficiency at work.

b)Desktop publishing and other impressive packages for graphics are adding value to the work

c) Browsing , email and chat have changed lifestyle

2.What is e-banking?

e-banking permits banking from the comfort of the home by using internet facilities. It has improved

the reach and services of banks.

3.How computer are used in education?

a) Purchase of educations CD

b) computer based tutorial

c)use of e-learning

4,What is e-learning?

e-learning enables online educational programs leading to degrees and certifications.

5.How the computers are used in entertainment?

You can update your knowledge in fine arts like painting, music, dance, yoga,games , science,

Nature and latest news and events. Know more places of worship and of tourist interest

6.How computer are used in areas of healthcare?

a) Hospital management system

b) Patient tracking system

c)Exchange of diagnostics records between healthcare units

d)Decision support system with highly advanced computing techniques

7.How computer are used in agriculture?

Farming and agriculture might seem like low technology enterprises, but these industries have

benefited from computerization more than the casual observer might think. Farmers, both

professional and hobbyists benefit from online resources such as seed estimators and pest

information sites. Professiional farmers can user revenue estimators to help them plan which crops

will produce the highest profits based on whether patterns, soil types and current market values8.

Page 20: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

20

8.Mention the areas where software has been developed?

a) Agricultual Finances and Accounting

b) Alternative farming techniques

c) Animal husbandry

d) Buildings and Irrigation

e) Farmland Assessment

f) Land Management

g)Livestock

h) Milk Production

9.What is ATM?

a) ATM – Automatic Teller Machine

b) It enables withdrawal of money from the account in a particular bank anytime and anywhere

c) It helps the user in emergency situations where money is needed during the nights and holidays

10.What is e-shopping?

You can purchase any product, any brand, any quantity from anywhere through e-shopping. The

pictures and other details are available on the website of the shop. Credit cards and prior registration

with shop are popular methods. Items purchased will be delivered at your home.

Chapter 11 IT ENABLED SERVICES

1.What is meant by ITES?

Information Technology that helps in improving the quality of service to the users is called IT Enabled

Service. ITES are human intensive services that are delivered over telecommunications networks

2.Mention the IT Enabled Servies?

a) e-governance

b) Call Centers

c) Data Management

d) Medical

e) Data Digitization

f)Website Services

3.In what way e-governance helps us?

The various websites provided by the government give the details about the departments, specific

functions, special schemes, documents, contacts, links, IAS intranet, site map, search, press releases,

Feedback. These websites are both in English and Tamil

4.What is Call Centres?

A call center is something defined as a telephone based shared service center for specific customer

activities and used for number of customer related functions like marketing, selling, information

Page 21: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

21

transfer, advice and technical support. It operates to provide round the clock and year round service

ie 24x 365 service

5.Write a short note on Medical Transcription?

It is a permanent , legal document that formally states the result of a medical investigation. It

facilitates communication and supports the insurance claim. There are three main steps in medical

transcription

6.What is meant by Digitization?

It refers to the conversion of non-digital material to digital form. A wide variety of materials as

diverse as maps, manuscripts, moving images and sound may be digitized.

7.Write the key benefits of digitization?

* Long term preservation of documents

* Storage of important documents at one place.

* Easy to use and access to the information

* Easy transfer of information in terms of images and text

* Easy transfer of information through CDROM, Internet and other electronic media

8.In what way web based services helps us?

* Agriculture Marketing Network

* Career Guidance

* Employment Online

* General Provident Fund

* Results of various Examination

Chapter – 12 COMPUTER ETHICS

1.What is meant by ethics?

It is a set for determining moral standards. Some general guidelines on ethics are useful responsibility

in their application of information technology

2.What are general guidelines on computer ethics are needed?

* Protection of personal data

* Computer Crime

* Cracking

3.What is meant by Computer Crime?

A computer crime is any legal activity using computer software, data or access as the object, subject or

instrument of the crime.

4.What are the different types of data?

Page 22: VOLUME-2 OBJECT TECHNOLOGY 2015-16 Chap-1 Object … · 12/09/2015  · VOLUME-2 OBJECT TECHNOLOGY 2015-16 , , ? R.Sreenivasan, Santhome HSS, Chennai-4 1 Chap-1 Object Oriented Concepts

VOLUME-2 OBJECT TECHNOLOGY 2015-16

�� வைர உற�, �தி வைர ந�ப�க� �ய�சிக� தவறலா� கா� வைர யாேரா, கைடசி வைர க�வி �ய�சி�க� தவறலாமா? ெதா�� வி�� ர�தி� ெவ றி இ�ைல

R.Sreenivasan, Santhome HSS, Chennai-4

22

Data Security, Physical Security, Personal Security and Personnel Security

5.What are the common crimes included?

1) Stealing Hardware

2) Virus

3) Cracking

4) Theft of Computer Time

5) Hardware and Software Piracy

6) Illegal access to confidential files

6.What is meant by Piracy?

Making and using duplicate hardware and software is called piracy.

7.Write a note on Virus

* A virus is a self sufficient programs that can cause damage to data and files stored in computer

* These programs are written by programmers with great programming skills are motivated by the

need for a challenge.

*57000 known virus programs are in existence. 6 new virus are found each day.

8.What is cracking?

It is the illegal access to the network or computer system. Illegal use of special resources in the

system is the key reason for cracking.

WISHING YOU ALL THE BEST