Practice TestsISCClass 11Computer Science

ISC practice test for class XI: Best questions

ISC practice test for Class 11: ISC Class 11 Computer Science practice test with important questions to revise before the computer exam.

Updated
Practice Tests

Watch java videos

ISC practice test is specially prepared for the students to revise the subject before the examination.

Download free Sample papers

Download the paper

ISC Class 11 Practice Test

PDF · 59 KB

Download PDF
Read the questions as text
Q A. Dry run the following code and write the output also. [2X5=10] 1. T​ he following function Fun( ) is a part of some class. What will the function Mystery( ) return when the value of num=43629, x=3 and y=4 respectively? Show the dry run/working. [5] int F​ un​(int num, int x, int y) { if(num<10) return num; else { int z = num % 10; if(z%2 == 0) return z*x + ​Fun​(num/10, x, y); else return z*y + F​ un​(num/10, x, y); } } 2. T​ he following function is a part of some class. Assume ‘x’ and ‘y’ are positive integers, greater than 0. Answer the given questions along with dry run/working. void Recur(int x, int y) { if(x>1) { if(x%y == 0) { System.out.print(y+ ""); Recur(x/y, y); } else Recur(x, y+1); } } What will be the output for Recur(8,2). Q B. Design a class ArmNum to check if a given number is an Armstrong number or not. [A number is said to be Armstrong if sum of its digits raised to the power of length of the number is equal to the number] [10] Example​: 371 = 33​ ​ + 73​ ​ + 1​3 1634 = 1​4​ + 6​4​ + 34​ ​ + 44​ 54748 = 55​ ​ + 4​5​ + 7​5​ + 4​5​ + 85​ T​ hus, 371, 1634 and 54748 are all examples of Armstrong numbers. Some of the members of the class are given below: Class name: ArmNum Data members/instance variables: n: to store the number 1: to store the length of the number Methods/Member functions: ArmNum (int nn): parameterized constructor to initialize the data member n = nn int sum_pow(int i): returns the sum of each digit raised to the power of the length of the number using recursive technique eg., 34 will return 32 + 42 (as the length of the number is 2) void isArmstrong(): checks whether the given number is an Armstrong number by invoking the function sum_pow () and displays the result with an appropriate message. Specify the class ArmNum giving details of the constructor( ), int sum_pow(int) and void isArmstrong( ). Define a main() function to create an object and call the functions accordingly to enable the task.