0% found this document useful (0 votes)
30 views

Computer App - Question Paper

Uploaded by

meetu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Computer App - Question Paper

Uploaded by

meetu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

MOCK EXAMINATION MAY – 2020

COMPUTER APPLICATION
Grade: 10 Duration: 2
Hours
Date: 12/5/2020 Max. Marks:
100
[The time stated above is the time allowed for writing the examination. In addition, the first 15
minutes will be the time given for reading the question paper.]
All working, including rough work should be done on the same sheet as rest of the answer. The
intended marks for questions or parts of questions are given in brackets.
Section A
Answer all questions
Give examples and briefly indicate the working or reasoning.

Question 1
a. Why is a class known as a composite data type? [2]

b. Differentiate Instance variable and Class variable. [2]

c. State the purpose of the “final” keyword. [2]

d. What are suffixes? Give an example [2]

e. What is a Package in Java? Name the package that contains Java’s Wrapper classes. [2]

Question 2
a. State two unary operators, which also come under the category of binary operators.
[1]

b. Given a String variable s1 that contains a value s110J. Write a java statement that would
store the numeric part in an integral data type. [1]

c. Differentiate charAt() and substring methods in the String class. Give example.
[2]

d. Given an array int B[ ]={4,6,9,3,8,13,17,35,46,1,18], what would happen when the following
statements are executed? [1]
int x=10;
System.out.println(B[++x]);

e. Correct the errors in the following snippet that has to store the first 10 multiples of 5 in the
array. [2]
int g[ ]= new int(10);
for(int i=0;i<=10;i+1)
g[i]=i+1*5;

PAGE 1 of 5
f. int x=5,y=3,n=8,z; [2]
z=++x + y++ * n++ / y;
What will be the values in x, y, z and n after the execution of this statement? Show the
working.
e. What will be the output? [1]
String x="xyz";
System.out.println(x.toUpperCase());
String y=x.replace('Y','y');
System.out.println(y);

Question 3

a.Differentiate Call by Value and Call by reference. [2]

b.Declare an array tmp of appropriate data type and initialize it with the following values:
[1]
33.23, 25.56. 24.68, 28.95, 29.3, 29.43

c. What will be the value of x? [1]


int x=(int)Math.random();
(i) 0 (ii) 1 (iii) results in a compilation error (iv) value of x is undetermined

d.State two differences between constructors and member functions in a class [2]

e. State the concept that is implemented through [2]


(i) a super class and a sub class
(ii) the act of representing essential features without including background details

f. Write a java expression for [1]


n
(a + b)
———
√3 + b
g. Give any two escape sequence characters. [1]

Question 4

a. Give the output. Show the dry run. [2]


int x3=892, r=0;
char ch1[ ]={'a','b','c','d','e','f','g','h','i','j'};
do {
r=x3%10;
System.out.print(Character.toUpperCase(ch1[r]));
x3/=10;
}while(x3!=0);

b. Give the output. Show the dry run. [2]


int x=110101, cnt=0, k=0,r=0;
while(x!=0) {
r=x%10;
PAGE 2 of 5
if(r!=0)
cnt=(int)(cnt+Math.pow(2,k)*r);
x=x/10;
k++; }
System.out.println("cnt :"+cnt);
c. What will be the output ? (Show the working) [2]
Given an array int A[ ]={5,6,7,8,9,3};
int x=2;
System.out.println(Math.max(A[x++],A[x+2]));
System.out.println(x);

d. int[ ][ ] items = { {0, 1, 3, 4}, {4, 3, 99, 0, 7 }, {3, 2, 5, 8} } ; [1]

Which of the following statements replaces 99 with 77?


(i) items[1][2] = 77; (ii) items[2][1] = 77; (iii) items[ 99 ] = 77; (iv) items[2][3] = 77;

e. Given the following: [1]


double[ ][ ] things = { {1.2, 9.0, 3.5, 3.8}, {9.2, 0.5, 2.7, 2.6}, {7.3, 7.9, 1.2, 3.9} } ;
What is the value of things.length?
A. 2 B. 3 C. 4 D. 9

f. Rewrite the following using the Ternary operator. [2]


String grade;
if(mark>=90)
grade = “A”;
else if(mark>=80)
grade = “B”;
else
grade = “C”;

SECTION B
Answer any Four
Variable description and appropriate comments needs to be included
Question 5 [15]
Write a program which displays the menu shown below, accepts a number and determines
whether the given number is a Disarium number or a Buzz number as per user’s choice. [Use
Switch case]
MENU
1. Disarium Number
2. Buzz Number
A number is called DISARIUM number if the sum of its digits powered with their respective
position is equal to the original number. For example,135 is a DISARIUM as 1 1+32+53 = 135.
Some other DISARIUM numbers are 89, 175, 518 etc.,

A Number is called Buzz number, if it ends with 7 or is divisible by 7.


Question 6 [15]
Write a program to accept a String, convert it to Uppercase and print each word on a separate
line as shown below. In each word interchange the first and the last letters, and retain the other

PAGE 3 of 5
characters in the String in the same position. You can assume that each word in the String is
separated by a single space.

Sample Input: Time and tide wait for none. So be Happy


Output:
EIMT DNA EIDT TAIW ROF EONN. OS EB YAPPH.

Question 7 [15]
Design a class Mark with the following specifications
Class name : Mark
Data Members : rollno, name, math, phy, chem

void input() : a method to accept the above details

int calcgrdpoint(int) : calculates the grade point achieved by the student in math, phy
and chemistry, as per the rubrics given below and returns it.
Marks Grade point
80 and above 1
60 and above 2
40 and above 3
Below 40 4
void display( ) : displays the roll number, name, marks obtained in math, phy, chem
and their corresponding grade points, total mark and the average
mark as shown below.

Roll No. : 10089


Name : TOM
Math : 79 Grade point : 2
Phy : 96 Grade point : 1
Chem : 55 Grade point : 3
Total : 230 Average : 77% (rounded off)
Create an object in main() and call the functions appropriately.

Question 8 [15]
Create class numbers with overloaded functions to generate the following series.
Class name : numbers
Overloaded member function name : series
(i) S = 1 / x2 + 4 / x5 + 7 / x8 + 10 / x11 + ……. to n terms
(ii) S=1/1! - 2/2! +3/3!. – 4/4!......upto n terms

Question 9 [15]
Write a program to accept the names and the Math marks of 30 students and store them in two
arrays. Sort the data in the descending order of Math marks using any sorting technique.
Display the names and the math marks of the top 5 students.

Question 10 [15]
Write a program to input values into an array of A[ ] of size n, which must be a positive integer.
Then accept another number from the user and reverse all the numbers in the array that are
lesser than the entered number. Display the array.
Example: A[ ]={38, 825, 16, 916, 578, 105, 122}

PAGE 4 of 5
If the number entered is 200, then after replacing all the numbers less than 200 with their
reverse, the final output would be
A[ ]= {83, 825, 61, 916, 578, 501, 221}

Note: The numbers entered in the array must be greater than 10 and must not have 0 in the
unit’s place. If the user enters a wrong number, then display error message and accept again.

PAGE 5 of 5

You might also like