· 5 years ago · Apr 25, 2020, 05:16 AM
1 QUESTIONS FROM MODULE 1------>
2
3SOJIN SAMUEL B.C.A ROLL NO::17
4*******************************
51) Give the evolution diagram of OOPS concept.
6Machine language
7Procedure language Assembly language OOPS
82) Draw the structure of Procedure Oriented Language or Typical organization of
9Procedure oriented language.
103) What is Procedure oriented language?
11Conventional programming using high-level language such as COBOL, FORTRAN and Care commonly known as Procedure oriented language (POP). In POP number of functions are written to accomplish the tasks such as reading, calculating and printing.
124) Give some characteristics of procedure-oriented language.
13• Emphasis is on doing things (algorithms).
14• Larger programs are divided into smaller programs known as functions.
15• Most of the functions share global data.
16• Data move openly around the system from function to function.
17• Employs top-down approach in program design.
18Function-1 Function-2 Function-3
19Function-4 Function-5
20Function-6 Function-7 Function-8
21Main program
225) Write any four features of OOPS.
23• Emphasis is on data rather than on procedure.
24• Programs are divided into objects.
25• Data is hidden and cannot be accessed by external functions.
26• Follows bottom -up approach in program design.
276) What are the basic concepts of OOS?
28• Objects.
29• Classes.
30• Data abstraction and Encapsulation.
31• Inheritance.
32• Polymorphism.
33• Dynamic binding.
34• Message passing.
357) What are objects?
36Objects 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.
378)What is a class?
38• The entire set of data and code of an object can be made a user-defined data type with the help of a class.
39• Once a class has been defined, we can create any number of objects belonging to the classes.
40
41
42
43• Classes are user-defined data types and behave like built-in types of the programming language.
449) what is encapsulation?
45Wrapping up of data and function within the structure is called as encapsulation.
4610)What is data abstraction?
47The insulation of data from direct access by the program is called as data hiding or information binding.
48The data is not accessible to the outside world and only those functions, which are wrapped in the class, can access it.
4911)What are data members and member functions?
50Classes 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.
51The 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.
52Eg: int a,b; // a,b are data members
53Void getdata ( ) ; // member function
5412)What is dynamic binding or late binding?
55Binding 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.
5613)Write the process of programming in an object-oriented language?
57
58
59
60• Create classes that define objects and their behavior.
61• Creating objects from class definition.
62• Establishing communication among objects.
6314)Give any four advantages of OOPS.
64• The principle of data hiding helps the programmer to build secure programs that cannot be invaded by code in other parts of the program.
65• It is possible to have multiple instances of an object to co-exist without any interference.
66
67
68
69• Object oriented programming can be easily upgraded from small to large systems.
70• Software complexity can be easily managed.
7115)What are the features required for object-based programming Language?
72• Data encapsulation.
73• Data hiding and access mechanisms.
74• Automatic initialization and clear up of objects.
75• Operator overloading.
7616)What are the features required for object oriented language?
77• Data encapsulation.
78• Data hiding and access mechanisms.
79• Automatic initialization and clear up of objects.
80• Operator overloading.
81• Inheritance.
82• Dynamic binding.
8317)Give any four applications of OOPS
84• • Real-time systems.
85• • Simulation and modeling.
86• • Object-oriented databases.
87• • AI and expert systems.
8818) Give any four applications of c++?
89• Since c++ allows us to create hierarchy-related objects, we can build special object-oriented libraries, which can be used later by many programmers.
90• C++ are easily maintainable and expandable.
91• C part of C++ gives the language the ability to get close to the machine-level details.
92• It is expected that C++ will replace C as a general-purpose language in the near future.
9319) What are tokens?
94The smallest individual units in a program are known as tokens. C++ has the following tokens,
95• Keyword
96• Identifiers
97• Constants
98• Strings
99• Operator
10020)What are keywords?
101The 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.
102Eg: go to, If, struct , else ,union etc.
10321) Rules for naming the identifiers in C++.
104• Only alphabetic characters, digits and underscore are permitted.
105• The name cannot start with a digit.
106• The upper case and lower case letters are distinct.
107• A declared keyword cannot be used as a variable name.
10822)What are the operators available in C++?
109All operators in C are also used in C++. In addition to insertion operator << and extraction operator >> the other new operators in C++ are,
110: Scope resolution operator
111: : * Pointer-to-member declarator
112->* Pointer-to-member operator
113.* Pointer-to-member operator
114delete Memory release operator
115endl Line feed operator
116new Memory allocation operator
117setw Field width operator
11823)What is a scope resolution operator?
119Scope resolution operator is used to uncover the hidden variables. It also allows access to global version of variables.
120Eg:
121#include<iostream. h>
122int m=10; // global variable m
123void main ( )
124{
125int m=20; // local variable m
126cout<<”m=”<<m<<”\n”;
127cout<<”: : m=”<<: : m<<”\n”;
128}
129output:
13020
13110 (: : m access global m)
132Scope resolution operator is used to define the function outside the class.
133Syntax:
134Return type <class name> : : <function name>
135Eg:
136Void x : : getdata()
13724) What are free store operators (or) Memory management operators?
138New and Delete operators are called as free store operators since they allocate the memory dynamically
139
14025) What are manipulators?
141Setw, endl are known as manipulators.
142Manipulators 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”.
143Eg:Cout<<setw(5)<<sum<<endl;
144
14526) What do you mean by enumerated datatype?
146An 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.
147Eg:
148enum shape{ circle, square, triangle}
149enum color{ red, blue, green, yellow}
150
15127) What are symbolic constants?
152There are two ways for creating symbolic constants in C++:
153• Using the qualifier constant.
154• Defining a set of integer constants using enum keyword.
155The program in any way cannot modify the value declared as constant in c++.
156Eg:
157Const int size =10;
158Char name [size];
159
16028)What do you mean by dynamic initialization of variables?
161C++ permits initialization of the variables at run-time. This is referred to as dynamic initialization of variables.
162In C++ ,a variable can be initialized at run-time using expressions at the place of declaration as,
163……..
164…......
165int n =strlen(string);
166……..
167float area=3.14*rad*rad;
168Thus declaration and initialization is done simultaneously at the place where the variable is used for the first time.
169
17029) What are reference variable?
171A reference variable provides an alias(alternative name) for a previously defined variable.
172sum total For example , if make the variable a reference to the variable , then sum and total can be used interchancheably to represent that variable.
173Syntax :
174Data-type &reference-name = variable-name
175Eg:
176float total = 100;
177float sum = total;
178
17930)What is member-dereferencing operator?
180C++ permits to access the class members through pointers. It provides three pointer-to-member operators for this purpose,
181: :* To declare a pointer to a member of a class.
182* To access a member using object name and a pointer to the member
183->* To access a member using a pointer to the object and a pointer to that member.
184
18531)what is function prototype ?
186The function prototype describes function interface to the compiler by giving details such as number ,type of arguments and type of return values
187Function prototype is a declaration statement in the calling program and is of the
188following
189Type function_name(argument list); Eg float volume(int x,float y);
19032)what is an inline function ?
191An 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.
192The inline functions are defined as Inline function-header
193{
194function body
195}
19633) Write some situations where inline expansion may not work
197• for functions returning values, if loop, a switch, or a goto exists
198
199
200
201• for functions not returning values ,if a return statement exists
202• if function contain static variables
203• if inline functions are recursive