[go: up one dir, main page]

0% found this document useful (0 votes)
18 views4 pages

St. Georges Unit 2 Preboard

Pre-board

Uploaded by

mfurkhan677
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views4 pages

St. Georges Unit 2 Preboard

Pre-board

Uploaded by

mfurkhan677
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Name. ****** ... Sec. .. Roll No.

Second Term Examination 2022-23


CLASS-X
Time: 2 Hrs.] COMPUTER APPLICATIONS IM. M.: 100

Attempt all the questions from Section A and any four questlons from Section B.

Section-AA 140 Marks


[Attempt all questions from this Section.]
1. Choose the correct answer and write the correct option: (20
Which of these keywords is used to make a class ?
(a) class (6) int

c)void (d) static.


The size of variable of type char is
(a) 1 byte b) 2 bytes
c) 3 bytes (d) 4 bytes.
(i) Which of the following variable declarations will not compile in Java program ?
(a) int VAR; (b) t varl;
(c) int var_ (d) intj_var,
) Suppose your method does not return any value, which of the following keyword can be used as
v)
returntype:
(a) int (b) public
(c)void (d) main.
(V) The signature of a method consist of
(a) method name (b) method name and parameter list
(d) return type.
(C)parameter list
(vi) Invoking a method means
(a) Checking method for errors -(6) Designing method
(c)Asking the method to do its job (d) revising method.
vii) Java will automatically definea constructor:
(a) If the programmer does not define a default constructor for a class.
(b) If the programmer does not define any constructor for a class.
(c) If the program refers to a constructor with no parameters.
(vii) A method with same name as of the class and with arguments and no return data type is termed
as

(a) Parameterized constructor


(b) default constructor
() Non parameterized constructor.
2
ix) The number of bytes occupicd by constant
4.5 is
(a) 2 bytes
(b) 4 bytes
(c)8 bytes (d) 10 byte
Return type of
Math.round(O:
(a) double
(b) int
() boolean (d) byte
i) Parameters used in function call statement arc known as
(a) Passed parameters
(b) Formal parameters
(c) Actual parameters
(d) Defined parameters.
ci) A function with many definitions is called
(a) Multiple function
6) Function overloading
)Calling fimction
(d) Retuming functions.
cii) Ifa -
18 find the value of:
a t a + att+4

(a) 14 b) -14
(c) 22 (d) -22.
(xiv) Retun type of concat() is
()char b) siring
(c) int (d) boolean.
(xv) Return type of trim() is :
(a) char (b) Saring
(c) int (d) boolean.
xvi) Givethe output
Math.max(-24,-8.4)+Math.sqrt(4);
(a) -6.4 (b) 6.4
(c) -0.4 (d) None of these.
(xvii) Give the output:
System.out.printin ("Compare" CompareTo (COMPARE)y';
(a)-32 b) 0
c)32 (d) 1.
3
(xvii) for (k =1; k <=2; kt++),

for(m 1; m<=4; mt+)

System.out.print(m* 2)

How many times the inner


loop is exccuted 7
(a) 4 times (b) 8 times
(c) 2 times (d) 16 times.
xix) int r='F'; What is the value of r ?
(a) F (b) 70

()71 (d) 102

(ox) The style of expressing single line comment is:


(a) | comment"| (6) | comment

() comment (d) None of these.


2. (a) Write the difference between function and constructor. 41
(b) What is function overloading ? Explain with the help of example.
(Differentiate between Actual Parameter and Formal parameter. 41
(d) Give the output: (2
System.out.println("REDUCE"CompareTo ("REVOLT")+
"ANTARTICA".(astindexOf( A");
n and returns
() Give the prototype for the function check which receives a character ch and an integer
true or false.

(Write the statement to create object "obj' of class 'Hello'.


(What is the role of keyword void' in function ?
Section-B 4x15-60
[Atiempt any 4 questions]
[Write variable description and comments for each program.]

1. Create a class Calculate with folloving functions: [15)


i n t factorial(int n) -it will of 'n'.
calculate and return the factorial

'n' is special number or not using above function factorial()


)void special(intn) -it will check whether
and call the above function special().
)void main( create the object of a class
41
2. Define a class salary described as below: (151
Data Members Name, Address, Phone, Subject, MonthlySalary, Incometax.
Member methods 0 To accept the details of a teacher including the monthly salary

i) To display the details of the


teacher
(11) To compute thc annual Income Tax as 5% of the annual salary above

Rs. 1,75,000.
Write a main method to create object of a class and call the above member methods.
3. Design a class to overload a function num_cal( ) as follows: [15
) void num_cal (int num, char ch) with one integer It
argument and one character argument. cormputes
the square of an integer if choice ch is 's' otherwise, computes its cube.
(7 void num_cal (int a, int b, char ch) with two integer arguments and one character argument. It
computes the product of integer arguments if ch is p' else adds the integers.
1) void num_cal (String str 1, String str 2) with two String arguments prints the two Strings are
equal
or not.

4. A string is said to be 'Unique' if none of the letters present in the string are repeated. Write a program
to accept a string and check whether the string is Unique or not. The program displays a message

accordingly. [15]
Sample Input: COMPUTER
Sample Output: Unique String
5. Design a class to overload a function area( ) as follows [15
double area (double a, double b, double c) with three double arguments, return the area of scalene
triangle usingthe formula:

Area Vs(s-a) (s-b) (s-c)


where s (a +b + c)/2
(ü) double area (int a, int b, int height) with three integer arguments, returns the area of a trapezium using

theformula:
area 1/2 * height (a + b)

(i) double area (double diagonal 1, double diagonal 2) with two double arguments, returms the area of
a rhombus using the formula
area 1/2 * (diagonal 1 * diagonal 2)

You might also like