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

Computer Application

The document is an examination paper for a Computer Application course, dated January 2023, with a maximum score of 100 marks. It consists of two sections: Section A requires answering all questions, while Section B allows for the selection of four questions, focusing on programming tasks in Java. The paper includes multiple-choice questions, coding exercises, and theoretical questions related to Java programming concepts.

Uploaded by

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

Computer Application

The document is an examination paper for a Computer Application course, dated January 2023, with a maximum score of 100 marks. It consists of two sections: Section A requires answering all questions, while Section B allows for the selection of four questions, focusing on programming tasks in Java. The paper includes multiple-choice questions, coding exercises, and theoretical questions related to Java programming concepts.

Uploaded by

Abiya Sajid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Pre Hrard Kxaminatinn

IASSX
anuary, 2023 .OMPUTEK APPLICATION

Mazimum Marks: 10
Time Allowed: Tnu Hours
Anner y this Paper must be vritten on tne puper pry viiei epuruttiy
u vill nat he ulloved ta write during
thefir:: 5 minute
This tirns is to te npent in reading the questitn paper.
n e liie
2iven ut the head ef this Paper is the time ullowed fur uriting the er;er

This Paper ir divided intn tuo Sertion


tempt all questions from Section A and uny four question: from Section E.

n e n a e d markrfor questions orpart: of questions ure given in brucie].

SECTIONA (40 Marks)

Attempt all questions from this Section


Question 20
Choose the correct answer and write the
coTrect option.
(1)f the 1ame of a class is "Nurnber', what can be the possible nane for its constructor

(2) number (b) Nurnber c) No

ii) How many parameters does a default constructor require?


(a) 3 (b)0 (d)1
(o)2
ii) The default acces5 specifier for a method ofa class is
(a) private (b) public (c) protected (d) package
(iv) The function that modifies its parameters is calleda-
(a) Virtual function (byPure function (c) Impure function (d) Default function

(v) Which of the following is not applicable for a constructor function?


It has the samE name zs the ciass.
a)
(b) It has no return-type
(c) It is usually used for initialisation.
(d) Itcan be invoked using an object like any other member function.

(vi) The wrapping up of data and nsthods together as one unit is called:
(a) Inheritance (b) Polymorphism c) Encapsulation (d) None of the above

(viyThe method to convert a string to upper case is


(a)tolUpperCasefString) o(b) toUpperCasefchar) (c) to UPPERCASE(String)

(vii) The access modifier that gives most accessibility is:


(a) private by public (c) protected d) package
ix) Which function in Java removes the leading and trailing whitespaces from the string?

(a) proper (b) prim (c) remove (d) trim

This Paper consists of 4 printed pages. Turn Over


..tn

"State" is -

c o n s t r u c t o r
ofa class Question.

detault
invoke
the State()
to obj-
The
statement
(b) State State (10, 5)
(x) State
(d) State obj-new (i)W
obj=new
(a) State State()
State
obj=new initialisation? i)
(c) character
Character("c");
is valid c=new

among
the following
b)
Character (ii)
Which
(xi)
c=new
Character('c);
(d)
None ofthese
Character
(a) Wrapper class calleao
and b corresponding

(c) Both a object of


the
these
value into
(d) All of
an
primitive ( ) Type Casting
What is converting a
xin) (b) Unboxing
(a) Autoboxing

function can return are (d) 3


values that a
The number of
(xii) (c) 2
(b) 1
(b) 0

(xiv) Given the code:


int change (int p, int q)D

P=p*g
return ps

function will be:


The statement to call the above
above
int -change (10,20) '(d) none of the
(b) change (9.5,10.5) ()
(a) change (10,20)

(xv)Output of Math.ceil(46.6) is-


(d) 47.0
(a) 46.5 (b) 46.6 (c) 46.0

(xvi) What is the final value stored in variable c?

double a -6.52;
double b -14.74;
int c (int) Math.round(Math.max(a,b);

(a) -6 b) -6.0 (c) -7 (d)-7.0

(xvii) The output of the method "Computer Application". substring (2,8) is:

(a) Application (b) Computer (c) puter A (d) mputer


xvii) Math pow (625,1/2) +Math.sqrt(144)
(a) 17.0 (b) 13.0 (c) 37.0 (d) 13

(xix) The output of Double.parseDouble("71.25") + 0.75 is


(c) 72 6 ) 72.0 (c) 71 (d) 71.0
(xx) What will be the output of the following program code?

char opn= 'b';


switch(opn)
'a':
case
System.out.println("Platform independent");
break;
case 'b': System.out.print("Object oriented");
'c:
case
System.out.print("Robust and secure");
default: System.out.print("Wrong output");

(a) Object oriented


(b) Object orientedRobust and secure
(c) Object orientedRobust and secure Wrong output
This Paper consists of 4 printed pages. Turn Over
Qnestion

() Why is a class hnown aN


eummaile lata tyv"
i l State two ditterenees etween
equalq) ant v u
ii) Write the return type ot tlhe
followin ntiau
. islctteOrdigit (elhuar)
Nb. replace (elhar, ehar)

for
iv)Write the Java expression

(v) Consider the tollowing elass:


publie elass Ticket

public intN 10. y = 20:

public statie int a 45, b 32:

. Name the variable(s) for which euch objoct of the class will huve its OWII distinet tuuy
b. Name the variable(s) that are common to all the objocts of the clams.

Convert the following do-while ( ) loop to is eorrespondig lor loop:


inti= 1, d = 5:
do

d d*2;
System.out.println(d9:
whilei= 5);
(vii) What will the value ofx be atter execution ifx -
8 initially?
x+x+++x+ ++x ---x +X-- + 10

(vii) Write the values stored in the variables for the following juva segments:
a. String s= "Application".substring(7,11):
b. int indx = "Coconut".indexOt"o");

c. String e-"Tomputer".charA(0)+"Application".chatAt(0):
d. Boolean b = "Upper".isUpperCase();

(ix)State the output of the following program code segment:

intaf4] {2, 4, 6, 8};


for(i =0; i <a.length; i ++)
Sa[i] * a[3-i];

System.out.println(s);

c when the following program code executes?


(x) What will be the final value of
int c = 0;

for(int i =1;i<=5; it+)


for(intj=1;j<=5;j=j+2)

cc+1;

This Paper consists of 4 printed pages. Turn Over


SECTIONB (60 Marks)
Attemptany four questions from this Section.
he agwwers in this Section should consist f the Programs in either Blae J environment or uny
program environment with Java as the base.
Bach program should be writlen usng Parabie descriptions/Mnemonic Codes so that the logic oftha
progrum is clearly depicted.
Flow-Charts and Algorithms are not required.
IS

Qúestion 3 [15
Define a class taximeter having the following description:
Data members/instance variables:
int taxino - to store taxi number

String name -

to store passenger's name


int km - to store number of kilomectres travelled

Member functions:
b to 0.
taximeter()-constructor to initialize taxino to 0, name to"" and
input() - to accept taxino,name,km
calculate()- to calculate bill for a customer according to given conditions

Kilometers travelled (km) Rate/km


SI km Rs 25
1<km6 Rs?20
6<km 12 Rs 15
>12 km Rs110

display)- To display the details in the following format


Taxino Name Kilometres travelled Bill amount

Create an object in the main method and call all the above methods in it.

Question 4
[15
Write a program to accept a sentence and print only the first letter of each word of the sentence in
capital letters.

Question 5
Write a program to print the largest and smallest element ofan array storing 10 integers entered byy
the user.

Question 6
[15]
Write a menu driven program to perform the following operations:
) To input a number and print if it is a palindrome number or not.
(i) To input a mumber and print the product of first and last digit of the number

Question 7
[15
Design a class to overload a function SumSeries() as follows:
()void SumSeries (int n, double x) - with one integer argument and one double argument to find
and display the sum of the given series:

n terms

(i) void SumSeries ( )- to display the sum of the given series:


S 1+x+x+x...+x0

This Paper consists of 4 printed pages. Turn Over

You might also like