Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

CLASS 10 COMPUTER PRACTICE PAPER

Section A
1. A) __________ is known as composite datatype.
i) Class
ii) Object
iii) float
iv) byte
B) Find out the value of x.
int c[]={78,23,45,12,16};
x=c[1]*10+5;
i) 785
ii) 235
iii) 455
iv) 28
C) Identify the access modifier which is accessible only within the
same class where it is declared.
i) class
ii) private
iii) Character
iv) Public

D) __________ variable is shared by all the objects of the class.


i) Static variable
ii) Instance variable
iii) Local Variable
iv) Non static variable

E) If s=“123”, which among the following will convert it to an integer?


i) int a=Integer(s);
ii) int a=(int)s;
iii) int a=parseInt(s);
iv) int a=Integer.parseInt(a)

F) Byte code is generated from Source code by –


i) Java Compiler
ii) Interpreter
iii) JVM
iv) none of the these
G) Choose the correct output for the following code if x=8 and
y=6:
a= (x>10) ? 50 : (y<5) ? 40 : 80 ;
System.out.println(a);
i) 40
ii) 50
iii) 10
iv) 80
H) How many times will the loop be continued in the following code?
int x=5,s=0;
do{
s=s+x;
x=x*2;
}while(x<=50);
i) 3
ii) 4
iii) 5
iv) 6
I) Choose the correct output for the following code:
double s=1,p=1,sum=0;
for (int
i=2;i<=5;i=i+1){
s=s+i;
p=p*i;
}
System.out.println(s+p);
i) 120
ii) 124
iii) 135
iv) 140
2. Answer the following questions.
A) Differentiate between Entry Controlled loop and Exit Controlled
loop.
3𝑐
B) Write the java expression for 𝑥 = √5𝑏 + 2𝑏
C) What will be the output of the following code:
System.out.print(Math.max(-17, -19));
System.out.println(Math.ceil(8.9));
D) Write the output of the following:
System.out.println(4+2+”Four”);
System.out.println(“Four”+4+2);
E) Evaluate the following expression , if the values of the variables are
a=2, b=3, and c=9 c%=a*++b%c;
F) Specify the type of conversion and the resultant data type for the
following expression.(Show working using flowline)
int a, d; float b; char c;
(int)((double) a * d / c + (int) b)
G) Name and explain the feature of OOP which is implemented in
method overloading.
Section B
3. Write a Java program to accept a character array to store 10
characters and find the frequency of uppercase and lowercase
characters separately.
For example: Input: A, b, c, d, E, F, G, H, I, j
Output : Uppercase Frequency: 6
Lowecase Frequency: 4
4. Write a program to input 10 numbers into an integer array. Display
the average of all the elements and also display those numbers which
are less than its average.

5. Write a program to initialize the seven Wonders of the World along


with their locations in two different arrays. Search for a name of the
country input by the user. If found, display the name of the country
along with its Wonder, otherwise display “Sorry Not Found!”

6. A class SimpleInterest is created to calculate the compound interest.


The member of the class are given below:
Class name: SimpleInterest
Data members
pamt : to store the Principal amount
rate : to store the rate of interest
time : to store the time period in year
Member functions
void input() : to input the principal, rate and time from the user.
double findInterest() : to find and return Simple Interest.
void printData() : to print the principal, rate, time, interest amount
and final amount.
Write the main() method to create object and call the method

7. Write a program to overload the function series() to print the sum of


following series:
𝑥 𝑥3 𝑥5 𝑥7 𝑥𝑛
S= − + − +⋯ (Where x and n are input by the user)
1! 3! 5! 7! 𝑛!

1+2 1+2+3 1+2+3+ ..…+𝑛


S=1×2 + 1×2×3 + … … . . . + 1×2×3×…..×𝑛 (Where n is user input)

8. Write a Java program to accept a number and check the number is an


Amicable pair or not. [Amicable numbers are two
different numbers so related that the sum of the proper divisors of
each is equal to the other number. Example 220,284. Sum of divisor
of 220=1+2+4+5+10+11+20+22+44+55+110=284. Sum of divisor of
284=1+2+4+71+142=220]

You might also like