S.L.
BAJORIA FOUNDATION HIGH SCHOOL
FINAL TERM EXAMINATION 2021-22
CLASS : IX FULL MARKS : 100
SUBJECT : Computer Applications READING TIME : 15 mins
DATE : 07/03/2022 WRITING TIME : 2 hrs
Attempt all questions from section A and any four questions from section B.
The intended marks for questions or parts of questions are given in brackets [].
SCETION A (40 Marks)
Attempt all questions
Question 1:
Choose the correct answers. [1X5]=[5]
a) Which of the following is not an entry controlled loop?
i) for
ii) while
iii) do-while
iv) foreach loop
b) Which of the following statement terminates the complete execution of a program.
i) terminate
ii) break
iii) continue
iv) System.exit(0)
c) The parameters appearing in function call statement are called
i) Actual parameters
ii) Formal parameters
iii) Call parameters
iv) None of the above
d) Name the type of error in the given statement below:
Int m=90;
System.out.println(m);
i ) Logical error
ii) Syntax error
iii) Run time error
iv) None of the above
e) Intermediate code obtained after compilation
i) Source code
ii) Byte Code
iii) Object code
iv) Printing code
1
Question 2:
Name the following: [5×1]=[5]
a) An identifiable entity with some characteristics and behaviour.
i) Class
ii) Polymorphism
iii) Object
iv) Encapsulation
b) A function that changes or modifies the state of received argument.
i) Pure function
ii) Function overloading
iii) Impure function
iv) Local function
c) A looping construct that does not terminate the loop and executes the loop forever.
i) For loop
ii) While loop
iii) Do-while loop
iv) Infinite loop
d) A clause which is optional in the switch statement.
i) keyword
ii) operator
iii) default
iv) return
e) The keyword to make a variable as a class variable
i) static
ii) Static
iii) Return
iv) Final
Question 3:
Fill in the blanks with the correct option [5×1]=[5]
a) The number of bytes occupied by char data type is __________byte/s
i) 4
ii) 8
iii) 2
iv) None
b) Absence of ---------- statement causes a fall-through in switch statement.
i) fall
ii) break
iii) stop
iv) continue
c) Smallest Individual unit of a Java program is called-----.
i) File
ii) Token
iii) Class
2
iv) Keyword
d) -----statement is used to terminate from a loop.
i) Continue
ii) Break
iii) Class
iv) None of above
e) Math.abs(Math.sqrt(-81.0)) is--------
i) -9.0
ii) 9.0
iii) -9.5
iv) 9.5
Question 4:
Give the output of the following [5 × 1]
a) int i=1,n=7,s=0,p=1;
while (i<=n)
{
s=s+i;
p=p*I;
i+=2;
}
System.out.println(s+”,”+p);
What is the output?
i) 16,100
ii) 15,107
iii) 16,105
iv) 15,106
b) int a=3;
a=++a + a++ + ++a - a- - + a;
what will be the final value of a?
i) 10
ii) 11
iii) 13
iv) 12
c) int big = (a >b && a>c) ? a : (b >c && b>a) ? b : (c>b && c>a) ? c; when a = 90, b=60,c=100
i) 90
ii) 100
iii) 60
iv) None of the above
d) switch ( x )
{
case 1 : a++;
b++;
c++;
case 2 :
b++;
3
c++;
break;
case 3: c++;
default : a++;
b++;
c++;
}
System.out.println(a+”,”+b+”,”+c);
when x=1, a=1,b=2,c=3
i) 2,4,6
ii) 2,4,5
iii) 3,6,5
iv) 2,4,6
e) System.out.println(Math.ceil (4.2 ) + Math.floor (7.9));
i) 13.0
ii) 12
iii) 13
iv) 12.0
Question 5:
Write a program to input a number and display the new number after reversing the digits of the original number.
The program also displays the absolute difference between the original number and the reversed number.
Sample Input: 194
Sample Output: 491
Absolute Difference= 297
import java.util.Scanner;
public class DigitReverse
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.print("Enter Number: ");
int orgNum = in.nextInt();
int copyNum = (a) ,revNum = 0;
while( copyNum != 0 )
{
int digit = copyNum % 10;
revNum = (b) ;
copyNum = copyNum /10;
}
int diff = (c) ;
System.out.println("Reversed Number = " + revNum);
System.out.println("Absolute Difference = " + (d) );
}
}
4
Choose the correct options.
a) [1]
i) orgNum
ii) copyNum
iii) 0
iv) 1
b) [1]
i) revNum * 10 + digit
ii) digit * 10 + digit
iii) revNum +10 * digit
iv) copyNum * 10 + digit
c) [1]
i) revNum / orgNum
ii) revNum + orgNum
iii) revNum – orgNum
iv) revNum * orgNum
d) [1]
i) Math.abs(copyNum)
ii) Math.abs(revNum)
iii) Math.abs(diff)
iv) Math.abs(digit)
Question 6:
a) Write two differences between pure function and impure function. [2]
b) Define function prototype. Give example. [2]
c) Define fall through. Give example. [2]
d) What is Comment in java? Give example. [2]
e) Write two main features of object oriented programming. [2]
Question 7:
a) Write the main difference between formal argument and actual argument. [1]
b) What is the function of return keyword in java. [1]
c) Define Byte code in java. [2]
d) Write the size of char and double data type. [1]
e) Write the return type of ceil() and round() functions in java. [1]
SCETION B (60 Marks)
Attempt any four questions
Question 8: [15]
Write a program in java to accept a number from user and check if the number is Krishnamurthy number
or not.
A Krishnamurthy number is a number whose sum of the factorial of digits is equal to the number itself. For
example 145, sum of factorial of each digits:
1! + 4! + 5! = 1 + 24 + 120 = 145
Examples:
Input : 145
Output : YES
5
Explanation: 1! + 4! + 5! =
1 + 24 + 120 = 145, which is equal to input,
hence YES.
Input : 235
Output : NO
Explanation: 2! + 3! + 5! =
2 + 6 + 120 = 128, which is not equal to input,
hence NO.
Question 9: [15]
Write a program in java to accept a number from user and check if the number is Disarium number or not.
A number is called Disarium if sum of its digits powered with their respective positions is equal to the number
itself.
Examples:
Input : n = 135
Output : Yes
1^1 + 3^2 + 5^3 = 135
Therefore, 135 is a Disarium number
Input : n = 89
Output : Yes
8^1+9^2 = 89
Therefore, 89 is a Disarium number
Input : n = 80
Output : No
8^1 + 0^2 = 8
Question 10: [15]
Write a program in java to accept a number from user and check if the number is Automorphic number or
not.
A number is called Automorphic number if and only if its square ends in the same digits as the number itself.
Examples :
Input : N = 76
Output : Automorphic
Explanation: As 76*76 = 5776
Input : N = 25
Output : Automorphic
As 25*25 = 625
Input : N = 7
Output : Not Automorphic
As 7*7 = 49
Question 11: [15]
Write the following pattern programs:
i) 1
11
101
1001
10001
6
ii) *
*#
*#*
*#*#
*#*#*
Question 12: [15]
Write the following series programs :
i) Sum = 1 + (3/2!) + (5/3!) + (7/4!) + ....... to n
ii) Sum= (2/a) + (3/a 2) + (5/a3) + (7/a4) + ....... to n
Question 13: [15]
Write a program to input a number and check whether it is 'Magic Number' or not. Display the message
accordingly.
A number is said to be a magic number if the eventual sum of digits of the number is one.
Sample Input : 55
Then, 5 + 5 = 10, 1 + 0 = 1
Sample Output: Hence, 55 is a Magic Number.
Similarly, 289 is a Magic Number.