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. 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: Paper By Mr. Ravi Kiran |