0 ratings0% found this document useful (0 votes) 41 views4 pagesComputer Application
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
DUBAI MODERN HIGH SCHOOL
Preliminary Examination, 2013
COMPUTER APPLICATION
Grade: 10 Time: 2 hours
Date: 14/01/13 ‘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 J
Answer ALL questions in Part 4 (compulsory) and FOUR questions from Part Il
All working, including rough work must be on the same sheet as the rest of the
The intended marks for questions are given in [] brackets
PARTI
Answer All Questions
‘While answering this Section, indicate briefly the working and reasoning
QUESTION 1
a) State the rules for nesting of a loop 2
») Differentiate giving example:
indexOf( ) and lastindexOf{) (2
il) equals( ) anc compareTo{ ) 2]
¢) Name the keyword that 2)
i) is used for allocating memory to an array,
ii) causes the control to transfer back to the method call
4d) What is meant by exit controlied loop. Expiain with example, 2]
QUESTION 2
2) Write a java statement to print the following: Q
To find the absolute value of a number x
To find out e to the power of the number 2
b) Explain the term data hiding in java. 1
©) Differentiate between:
i) type casting and type conversion, 2)
i) class variable, local variable and instance variable 3)
) Rewrite the program segment using nested if-construct: 2]
if n%2==088 n>35 &B n<67)
Page ofQUESTION 3
@) Determine the output
i) int(]a= (533.96) (al
intx
for (x=0:x<=3:x+4)
{alx+ 1] = ( alx]%2==0 ? ++afx): ~aly] )
System out print(alx+"",}
ji) switeh(num) 2]
{
case 5: num++; [Link] printin(aum);
case 6: System out printin('SIX");
case 7: System out printin(num)
case 0: num=+; [Link] printin('ZERO"+num); break;
case ~1: num++; num*=2; System. out printin(num);
default ‘System out printin("Case is not matching’), }
| assume num as -1
|. assume num as 6
b) How many times does the loop iterate? Aso give the output for the following
forint x=1:x<=20;x=x+3) (4)
fot:
System outprintin(x+);
}
©) Consider the following data type and answer the following: 2)
String str = “Mahatma’;
() Write @ code to print the word atma 7
(il) Write a code to print Mahatmaji using literal str?
¢
Give the output after the execution of the following statement
i) functionx(25,30) 2]
public boolean functionxint aint 9)
{boolean c=false;
wnile(a>5 && b>5)
Page 2 of 42) Give the output of the following program segment
i. double x=2.9, y=2.5 ca)
‘System cut printin(Math min(Math floor(x),y))
‘[Link] printin([Link]([Link](x),y))
) Write a program code segment that prints all the elements of the 3rd row of a
two dimensional array named matrix of order 10 x § containing integer
data ny
9) Write a program segment to print all the words of a sentences’ that start with
a vowel and end with a consonant 3]
Part Il
Ani uestions
Each program should be written in such a way that it clearly depicts logic of
program and supported by sufficient comments and declaration of variables
used.
The program must be written in JAVA
QUESTION 4 115)
Design A class amicable with a default constructor, a parameterized constructor and
the following function
Data Members: a and b
boolean checkAmicable(intint) ~ this function returns true if the two arguments are
amicable otherwise it returns false.
Create an object in the main to accept two numbers and check whether numbers are
amicable or not using above class.
Hint : a pair of numbers are amicable if the sum of the factors of one number
(excluding itself) is equal to the second number and vice-versa.
[e.g. For example, the smallest pair of amicable numbers is (220,284); for the proper
factors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110, of which the sum is 264
and the proper factors of 284 are 1, 2, 4, 71 and 142, of which the sum is 220,
‘The first few amicable pairs are: (220, 284), (1184, 1210), (2620, 2924) etc]
Page 301 4QUESTION 5 15)
‘Accompany produces 25 items. Accept the quantity and unit price in two different
arrays. Find the amount for each item and store them in another array. Display the
following
a) Total amount of all items produced by the company.
b) Quantity of the most expensive item,
QUESTION 6 13)
Write a program which inputs a positive natural no N and output all combinations of
consecutive naturals which add up to give N.
Example if N
5 then output should be
12345
456
78
QUESTION 7 15)
Write @ program to input a name and display name in following format.
e.g. Input name = “Amit Kumar Verma” Output “Verma, AK”
name = “Ajay Yadav" Output “Yadav, A”
QUESTION 8 115)
Write @ program using function overloading to perform the following
void pattern(int char)- To print the accepted character in the following format for
Nines.
void computetint) — To print the following format for N lines
'
qs
as gto
srs eee
QUESTION 8 13)
Accept an array of characters and sort the array in the descending order using the
bubble sort technique.
KRERE
Page 4 of 4