Friday 03rd May 2024
REGISTRATION
Online Fashion Store

CBSE Important Questions

CBSE Guess > Papers > Important Questions > Class XI > 2010 >Computer Science >Computer Science By Mr. Ravi Kiran

CBSE CLASS XI

Q.4. Differentiate between object oriented programming and procedural oriented programming with the help of examples of each.

Procedure Oriented Programming:
A program in a procedural language is a list of instructions where each statement tells the computer to do something. The focus is on the processing. There is no much security for the data.

Object Oriented Programming :
The object oriented approach views a problem in terms of objects involved rather than procedure for doing it. In object oriented programming, object represents an entity that can store data and has its interface through functions.

All data is openly available to all Data and functions enclosed within objects. functions in the program New objects communicate with one another.

OOP is so closer to the real life. And also it consists many features like

1.Data Abstraction 2.Data Encapsulation 3.Modularity 4.Inheritance 5.Polymorphism 6. Data hiding.

Q.5. Distinguish between if and switch statement.

a)The if-else and switch both are selection statements and they both let you select an alternative out of given many alternatives by testing an expression. But there are some differences in their operations.

(i) The switch statement differs from the if statement in that switch can only test for equality whereas if can evaluate a relational or logical expression. Ie multiple conditions.

(ii) The switch statement selects its branches by testing the value of same variable whereas the if else construction lets you use a series of expressions that may involve unrelated variables and complex expressions.

(iii) The if-else can handle ranges whereas switch cannot. Each switch case label Must be a single value.

(iv) The if-else statement can handle floating point tests also where as switch cannot handle floating point tests.

(v) The switch case label value must be a constant. So, if two or more variables are to be compared, use if-else.

Q.6. Differentiate between call by value and call by reference with help of an example.

a) (i) In call by value, actual arguments will be copied into the formal perameters. In call by reference, formal perameters are references to the actual arguments.

(ii) In call by value, if any modification is occurred to the formal perameter, that change will not reflect back to the actual argument. In call by reference, if any modification is occurred to the formal perameter (reference to the actual argument), the actual argument value will be changed.

(iii) We should go for call by value when we don’t want to modify the original value. We should go for call by value when we want to modify the original value.

(iv) Example:
void Change(int a, int &b)
{ a= 2*a;
b=20;
}
Here a is called by “call by value” method and b is called by “call by reference” So as the value of a is changed, actual argument for a will not be changed, as the value of b is changed, actual argument for b will be changed

Paper By Mr. Ravi Kiran
Email Id :[email protected]