Admin Welcomes U Anna University Questions Bank for cse -oops ~ ANNA UNIVERSITY QUESTION BANKS PAPERS WITH SOLUTIONS

JOIN WITH US :)

If any add appear like this please click skip add

Category

INFO

CLICK HERE
FOR LATEST RESULTS
LATEST NEW TIME TABLE/EXAM DATES FOR ALL LINK1 LINK2
ANNA UNIVERSITY COLLEGES RANK LIST 2012 CHECK SOON
LATEST FREE PLACEMENT PAPERS FOR ALL COMPANIES CHECK SOON
GET FREE MINI PROJECTS AND FINAL YEAR PROJECTS CLICK HERE
LATEST HOT HACKING TRICKS CLICK HERE

LATEST QUESTION BANKS /PAPERS/entrance FOR ALL EXAMS CLICK HERE link1 link2




our sites
www.tricksnew.blogspot.com www.questionbank.tk
www.freeminiproject.blogspot.com and
www.onlineinfocity.
blogspot.com


NOTE:

FEEL FREE TO CONTACT US click on me
DONT FORGET TO SUBSCRIBE YOUR MAIL ID ----->>>TO GET DAILY question banks IN YOUR INBOX::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: SEE RIGHT SIDE CORNER

Friday, October 21, 2011

Anna University Questions Bank for cse -oops

Anna University OOPS Questions Bank Unit-1

Hello ,
This post is about anna university oops questions bank  . Here I am updating some of the important questions got from my friends for the OOPS Subject of Anna University .Object Oriented Programming subject is a basic subject for the Computer Science , Information Technology department students also other departments like ECE , EEE  also having this subject as a part of their curriculum.
The questions i am updating here are based on the following syllabus . And I am updating all the Question Banks as a Series of 5 posts and each post covers one unit of the syllabus .
Let we take a look at the syllabus of the Anna University Coimbatore
(As all you know that this year (2011) Anna University Coimbatore is working as a subsidiary of Anna University .)
 
This is the syllabus referred from the Anna University Coimbatore Official Website .
Download Anna University Coimbatore CSE Syllabus 3rd and 4th sem
Let move on to the question bank  of Unit – 1.
Anna University OOPS Questions Bank
UNIT I               9
Object oriented programming concepts – objects – classes – methods and messages – abstraction and encapsulation – inheritance – abstract classes – polymorphism.
Introduction to C++ – classes – access specifiers – function and data members – default arguments – function overloading – friend functions – const and volatile functions – static members – Objects – pointers and objects – constant objects – nested classes – local classes
2 Marks
1) Give the evolution diagram of OOPS concept.
Machine language
Procedure language
Assembly language
OOPS
2) What is Procedure oriented language?
Conventional programming, using high-level language such as COBOL, FORTRAN and C are commonly known as Procedure oriented language (POP). In POP number of functions are written to accomplish the tasks such as reading, calculating and printing.
3) Give some characteristics of procedure-oriented language.
• Emphasis is on doing things (algorithms).
• Larger programs are divided into smaller programs known as functions.
• Most of the functions share global data.
• Data move openly around the system from function to function.
• Employs top-down approach in program design.
Function-1 Function-2 Function-3
Function-4 Function-5
Function-6 Function-7 Function-8
Main program
4) Write any four features of OOPS.
• Emphasis is on data rather than on procedure.
• Programs are divided into objects.
• Data is hidden and cannot be accessed by external functions.
• Follows bottom -up approach in program design.
5) What are the basic concepts of OOS?
• Objects.
• Classes.
• Data abstraction and Encapsulation.
• Inheritance.
• Polymorphism.
• Dynamic binding.
• Message passing.
6) What are objects?
Objects are basic run-time entities in an object-oriented system. They may represent a person, a place, a bank account, a table of data or any item that the program has to handle. Each object has the data and code to manipulate the data and theses objects interact with each other.
7)What is a class?
• The entire set of data and code of an object can be made a user-defined data type with the help of a class.
• Once a class has been defined, we can create any number of objects belonging to the classes.
• Classes are user-defined data types and behave like built-in types of the programming language.
8) what is encapsulation?
Wrapping up of data and function within the structure is called as encapsulation.
9)What is data abstraction?
The insulation of data from direct access by the program is called as data hiding or information binding.
The data is not accessible to the outside world and only those functions, which are wrapped in the class, can access it.
10)What are data members and member functions?
Classes use the concept of abstraction and are defined as a list of abstract attributes such as size, weight, and cost and uses functions to operate on these attributes.
The attributes are sometimes called as data members because they hold information. The functions that operate on these data are called as methods or member functions.
Eg: int a,b; // a,b are data members
Void getdata ( ) ; // member function
11)What is dynamic binding or late binding?
Binding refers to the linking of a procedure to the code to be executed in response to the call. Dynamic binding means that the code associated with a given procedure call is not known until the time of the call at the run-time.
12)Write the process of programming in an object-oriented language?
• Create classes that define objects and their behavior.
• Creating objects from class definition.
• Establishing communication among objects.
13)Give any four advantages of OOPS.
• The principle of data hiding helps the programmer to build secure programs that cannot be invaded by code in other parts of the program.
• It is possible to have multiple instances of an object to co-exist without any interference.
• Object oriented programming can be easily upgraded from small to large systems.
• Software complexity can be easily managed.
14)What are the features required for object-based programming Language?
• Data encapsulation.
• Data hiding and access mechanisms.
• Automatic initialization and clear up of objects.
• Operator overloading.
15)What are the features required for object oriented language?
• Data encapsulation.
• Data hiding and access mechanisms.
• Automatic initialization and clear up of objects.
• Operator overloading.
• Inheritance.
• Dynamic binding.
16)Give any four applications of OOPS
•  Real-time systems.
•  Simulation and modeling.
•  Object-oriented databases.
•  AI and expert systems.
17) Give any four applications of c++?
• Since c++ allows us to create hierarchy-related objects, we can build special object-oriented libraries, which can be used later by many programmers.
• C++ are easily maintainable and expandable.
• C part of C++ gives the language the ability to get close to the machine-level details.
• It is expected that C++ will replace C as a general-purpose language in the near future.
18) What are tokens?
The smallest individual units in a program are known as tokens. C++ has the following tokens,
• Keyword
• Identifiers
• Constants
• Strings
• Operator
19)What are keywords?
The keywords implement specific C++ language features. They are explicitly reserved identifiers and cannot be used as names fro the program variables or other user defined program elements.
Eg: go to, If, struct , else ,union etc.
20) Rules for naming the identifiers in C++.
• Only alphabetic characters, digits and underscore are permitted.
• The name cannot start with a digit.
• The upper case and lower case letters are distinct.
• A declared keyword cannot be used as a variable name.
21)What are the operators available in C++?
All operators in C are also used in C++. In addition to insertion operator << and extraction operator >> the other new operators in C++ are,
: Scope resolution operator
: : * Pointer-to-member declarator
->* Pointer-to-member operator
.* Pointer-to-member operator
delete Memory release operator
endl Line feed operator
new Memory allocation operator
setw Field width operator
22)What is a scope resolution operator?
Scope resolution operator is used to uncover the hidden variables. It also allows access to global version of variables.
Eg:
#include<iostream. h>
int m=10; // global variable m
void main ( )
{
int m=20; // local variable m
cout<<”m=”<<m<<”\n”;
cout<<”: : m=”<<: : m<<”\n”;
}
output:
20
10 (: : m access global m)
Scope resolution operator is used to define the function outside the class.
Syntax:
Return type <class name> : : <function name>
Eg:
Void x : : getdata()
23) What are free store operators (or) Memory management operators?
New and Delete operators are called as free store operators since they allocate the memory dynamically.
New operator can be used to create objects of any data type.
Pointer-variable = new data type;
Initialization of the memory using new operator can be done. This can be done as,
Pointer-variable = new data-type(value)
Delete operator is used to release the memory space for reuse. The general form of its use is
Delete pointer-variable;
24) What are manipulators?
Setw, endl are known as manipulators.
Manipulators are operators that are used to format the display. The endl manipulator when used in an output statement causes a linefeed to be inserted and its effect is similar to that of the newline character”\n”.
Eg:Cout<<setw(5)<<sum<<endl;
25) What do you mean by enumerated datatype?
An enumerated datatype is another user-defined datatype, which provides a way for attaching names to numbers, thereby increasing comprehensibility of the code.The syntax of an enum statement is similar to that of the struct statesmen.
Eg:
enum shape{ circle, square, triangle}
enum color{ red, blue, green, yellow}
26) What are symbolic constants?
There are two ways for creating symbolic constants in C++:
• Using the qualifier constant.
• Defining a set of integer constants using enum keyword.
The program in any way cannot modify the value declared as constant in c++.
Eg:
Const int size =10;
Char name [size];
27)What do you mean by dynamic initialization of variables?
C++ permits initialization of the variables at run-time. This is referred to as dynamic initialization of variables.
In C++ ,a variable can be initialized at run-time using expressions at the place of declaration as,
……..
………
int n =strlen(string);
……..
float area=3.14*rad*rad;
Thus declaration and initialization is done simultaneously at the place where the variable is used for the first time.
28) What are reference variable?
A reference variable provides an alias(alternative name) for a previously defined variable.
sum total For example , if make the variable a reference to the variable , then sum and total can be used interchancheably to represent that variable.
Syntax :
Data-type &reference-name = variable-name
Eg:
float total = 100;
float sum = total;
29)What is member-dereferencing operator?
C++ permits to access the class members through pointers. It provides three pointer-to-member operators for this purpose,
: :* To declare a pointer to a member of a class.
* To access a member using object name and a pointer to the member
->* To access a member using a pointer to the object and a pointer to that member.
30)what is function prototype ?
The function prototype describes function interface to the compiler by giving details such as number ,type of arguments and type of return values
Function prototype is a declaration statement in the calling program and is of the
following
Type function_name(argument list); Eg float volume(int x,float y);
31)what is an inline function ?
An inline function is a function that is expanded in line when it is invoked. That is compiler replaces the function call with the corresponding function code.
The inline functions are defined as Inline function-header
{
function body
}
32) Write some situations where inline expansion may not work
• for functions returning values, if loop, a switch, or a goto exists
• for functions not returning values ,if a return statement exists
• if function contain static variables
• if inline functions are recursive
33)what is a default argument ?
Default arguments assign a default value to the parameter, which does not have matching argument in the function call. Default values are specified when the f unction is declared.
Eg : float amount(float principle,int period,float rate=0. 15)
Function call is
Value=amount(5000,7);
Here it takes principle=5000& period=7
And default value for rate=0.15
Value=amount(5000,7,0.34)
Passes an explicit value 0f 0.34 to rate
We must add default value from right to left
34) What are constant arguments ?
keyword is const. The qualifier const tells the compiler that the function should not modify the argument. The compiler will generate an error when this condition is violated. This type of declaration is significant only when we pass arguments by reference or pointers
eg: int strlen( const char *p);
35) How the class is specified ?
Generally class specification has two parts
• class declaration
It describes the type and scope of its member
• class function definition
It describes how the class functions are implemented
The general form is
Class class_name
{
private:
variable declarations;
function declaration;
public:
variable declaration;
function declaration;
};
36) How to create an object ?
Once the class has been declared, we can create variables of that type by using the classname
Eg:classname x; //memory for x is created
37) How to access a class member ?
object-name. function-name(actual arguments)
eg:x.getdata(100,75.5);
38) How the member functions are defined ?
Member functions can be defined in two ways
• outside the class definition
Member function can be defined by using scope resolution operator::
General format is
Return type class_ name::function-name(argument declaration)
{
}
• Inside the class definition
This method of defining member function is to replace the function declaration by the actual function definition inside the class. It is treated as inline function
Eg:class item
{
int a,b ;
void getdata(int x,int y)
{
a=x;
b=y;
};
39) What is static data member?
Static variable are normally used to maintain values common to the entire class.
Feature:
• It is initialized to zero when the first object is created. No other initialization is permitted
• only one copy of that member is created for the entire class and is shared by all the objects
• It is only visible within the class, but its life time is the entire class type and scope of each static member variable must be defined outside the class
• It is stored separately rather than objects
Eg: static int count//count is initialized to zero when an object is created.
int classname::count;//definition of static data member
40) What is static member function?
A member function that is declared as static has the following properties
• A static function can have access to only other static member declared in the same class
• A static member function can be called using the classname as follows
classname ::function_name;
41) How the objects are used as function argument?
This can be done in two ways
• A copy of the entire object is passed to the argument
• Only address of the objects is transferred to the f unction
42) What is called pass by reference?
In this method address of an object is passed, the called function works directly on the actual arguments.
43) Define const member
If a member function does not alter any data in the class, then we may declare it as const member function as
Void mul(int ,int)const;
44) Define pointers to member
It is possible to take the address of a member of a class and assign it to a pointer. The address of a member can be obtained by applying the operator &to a “fully qualified” class member name. A class member pointer can be declared using the operator::*with the class name.
Eg: class A
{
int m;
public:
void show( );
};
pointer to member m is defined as
int A::*ip=&A::m;
A::*->pointer to member of A class
&A::m->address of the m member of A class
45) When the deferencing operator ->* is used?
It is used to access a member when we use pointer to both the object and the member.
47) When the deferencing operator .* is used?
It is used to access a member when the object itself is used as pointers.
48) Define local classes.
Classes can be defined and used inside a function or a block. such classes are called local classes. It can use global variables and static variables declared inside the function but cannot use automatic local variables.
Eg;
void test(int a)
{
…….
}
class student
{
………
};
student s1(a);
}
46) What are Friend functions? Write the syntax
A function that has access to the private member of the class but is not itself a member of the class is called friend functions.
The general form is
friend data_type function_name( );
Friend function is preceded by the keyword ‘friend’.
47)Write some properties of friend functions.
• Friend function is not in the scope of the class to which it has been declared as friend. Hence it cannot be called using the object of that class.
• Usually it has object as arguments.
• It can be declared either in the public or private part of a class.
• It cannot access member names directly. It has to use an object name and dot membership operator with each member name. eg: ( A . x )
48) What is function overloading? Give an example.
Function overloading means we can use the same function name to create functions that perform a variety of different tasks.
Eg: An overloaded add ( ) function handles different data types as shown below.
// Declarations
i. int add( int a, int b); //add function with 2 arguments of same type
ii. int add( int a, int b, int c); //add function with 3 arguments of same type
iii. double add( int p, double q); //add function with 2 arguments of
different type
//Function calls
add (3 , 4); //uses prototype ( i. )
add (3, 4, 5); //uses prototype ( ii. )
add (3 , 10.0); //uses prototype ( iii. )
48) Define local classes.
Classes can be defined and used inside a function or a block. such classes are called
local classes. It can use global variables and static variables declared inside the function
but cannot use automatic local variables.
Eg;
void test(int a)
{
…….
}
class student
{
………
};
student s1(a);}
PART-B
  1. Describe the advantages of OOP(8)
  2. What are the differences between pointers to constants and constant
    pointers?(8)
  3. Describe the applications of OOP technology.
  4. Explain object-oriented paradigm with al1 its essential elements
  5. State the merits and demerits of object oriented methodology
6)   Explain the following concepts of object oriented programming in detail
with an example.
(i) Data abstraction
(ii) Inheritance
(iii) Polymorphism
(iv) Objects
7)Write short notes on access specifiers
8)Explain default arguments with example
9)Explain about friend function with suitable example
10)What is a static member and what are common characteristics
11)Explain about pointers and pointers to member of a class with an example.
12) write short notes on the following and explain with an example:
a) volatile function b)constant function c)local class d)nested class
13) Define function overloading and explain each of the types of function overloading with an  example?
Download The Question Bank For Unit – 1
OOPS Question Bank – Anna University – Unit – I
Ok .Upto Now i had the above questions . If you need more than this just leave  a reply in the comment box . I will update more question bank for the OOPS subject in Future .The series of Anna University OOPS Questions Bank  will continues ….

0 comments:

chitika