Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
14 views7 pages

Computer Applications JML

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 7

Gujarat Research Society's

JASUDBEN M. L. SCHOOL
AND BLOOMINGDALES PRE-PRIMARY

Dr. Maahuri Shah CampUS. Ramakrishna Mission Road. Corner of 16th


and 17n Roads, Khar,
Mumbai 400 052
ASSESSMENT I
2024 - 2025
GRADE: X
DATE: 21.08.2024
SUBJECT: Computer Application TIME: 2Hr.
MARKS: 100

This Paper has 7 Printed papers


Answers to this Paper must be witten on the paper provided separately.
You will not be allowed to write during the first 15 minutes
This time is to be spent in reading the question paper.
The time given at the head of this Paper is the time allowed for writing the answers.
This Paper is divided into two Sections.
Attempt all questions from Section Aand any six guestions from Section
The intended marks for questions or parts of questions are given in brackets)

SectionA(40 Marks)
(Attempt all questions from this Section)
Question 1
Choose the correct answers to the questions from the given options.
(Do not copythe question, write the correct answers only.)
1 Name the feature of java depicted in the above picture. [1]

Class

Voriobies Methods

(a) Encapsulation
(b) Inheritance
(c) Abstraction
(d) Polymorphism
2. State the type of loop in the given program segment: [1)
for (int i =5; i!= 0; i-=2)
System.out.printin(i):
a) finite
b) infinite
c) null
d) fixed

3 Write a method prototype name check() which takes an integer argument and returns a [1]
char:

a) char check()
b) void check (int x)
c) check (int x)
d) char check (int x)

1
[1
4 int x = (int)32.8; is an example of .............. typecasting.
a) implicit
b) automatic
c) explicit
d) coercion

5 Ternary operator is a: [1]


(a)logical operator
(b) arithmetic operator
(c) relational operator
(d)conditional operator

6 Consider the array given below: [1)


char ch1={A,E,T0, "U"};
Write the output of the following statements:
System.out. println(ch[1]2);
(a)65
(b)138
(c) 'A'
(d) 0
7 "Java's feature that allows code to be executed on any device or operating system
without modification is known for its portability."
Name the feature.
(a) Garbage Collection
(b) Platform Independent
(c) High Performance
(d) Multithreading
8 Which of the following functions checks whether a character is a blank or not? [1]
(a) Character.isBlankSpace( )
(b) Character.isWhiteSpace( )
(c) Character.isEmptySpace( )
(d) Character. isNul( )
9 Assertion (A): The Wrapper class objects' value is comparable to primitive type values.
Reason (R): Wrapper class requires less memory compared to primitive data types.
(a) Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation
of Assertion (A).
(b) Both Assertion (A) and Reason (R)are true but Reason (R) is not a correct
explanation of Assertion (A).
(c) Assertion (A)is true and Reason (R) is false.
(d)Assertion (A) is false and Reason (R) is true.
10. The output of Math.floor(5.9) + Math.abs(-7.3) is: [1]
(a) 6.6
(b) 12.3
(c) 11.2
(d) 11

11. The parselnt() function is a member of [1]


a) integer wrapper class
b) character wrapper class
c) boolean wrapper class
d) none
49 Whichof the tollowing function finds the size of
char m] =(R, 'A, J','E, array [1]
N, 'D, 'R, 'A'};?
(a) m.sizeof (a)
(b) m.elementsof (m)
(c) m.length
(d) None
13. Constructor overloading follows which principle of Object
Orientedprogramming?
(a) Inheritance
(b) Polymorphism
(c) Abstraction
(d) Encapsulation
14. Which of the following is a valid Integer constant:
1.4
2. 4.0
3. 4.3f
4. "four

(a) Only 1.
(b)1. and 3.
(c) 2. and 4.
(d) 1. and 2.

14. For a two-dimensional array with Mrows and Ncolumns in Java, what will be the index of
the last element in the last row?

a) (M-1,N-1)
b) (M, N)
c) (M-1, N)
d) (M, N-1)
15. Assertion (A): Java supports the use of the ASCIl character set only.
Reason(R); Unicode can represent nearly all languages of the world like English, Hindi,
Bengali, Kannada, Arabic, Japanese, etc.
a) Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation
of Assertion (A).
b) Both Assertion (A) and Reason (R)are true but Reason (R) is not a correct
explanation of Assertion (A).
c) Assetion (A) is true and Reason (R) is false.
d) Assertion (A)is false and Reason (R) is true.
[1]
16. How many times will the followingcode print "Hello"?
for (int i= 1; i<=3; it+);
System.out.printin("Hello");

(a) o
(b) 1
(c) 3
(d) 2
17. Assertion (A): In Java, the keywords public, Public. and PUBLIC are treated as the
same.
Reason (R): Javais a case-sensitive language.
(a)Both Assertion (A)and Reason (R) are true and Reason (R)is a correct explanation
of Assertion (A).
(b) Both Assertion (A) and Reason (R)are true and Reason (R) 0s not a correct
explanation of Assertion (A)
(C) Assertion (A) is true and Reasorn (R) is false
(d) Assertion (A)is false and Reason (R) is true
18 Read the following text, and choose the correct answer [1]
Aclass encapsulate Data Members that contains the information necessary to
represent the class and Member methods that perform operations on the data memoel.
What does a class encapsulate?

(a) Information and operation


(b) Data members and Member methods
(c) Data members and information
(d) Member methods and operation
19. What Will be the output for:
System.out.print(Character.toLowerCase('1"):
(a) 0
(b) 1
(c) A
(d) true
variable 'x by 2. (1]
20. A student executes the following code to increase the value of a
incorrect.
He has written the following statement,which is
X=+2:
What will be the correct statement?
A. x+=2;
B. x=2;
C. X=X+2;

(a) Only A
(b) Only C
(c) Allthe three
(d) Both A and C

Question No.2
(21
1. Write the Java expression for x=Jy
statement: (21
2. Rewrite the following code using a single if

if (grade =='A)
System.out.println("Excellent");
else if (grade == 'a')
System.out.println("Excellent"):
else if (grade =='B')
System.out.println("Good");
else if (grade == 'b')
System.out.printin("Good");
respectively.
values of x and y are 5 and 7,
3. Evaluate the given expression when the
y += X-- * ++y -+x,
System.out.printin("x="+x);
System.out.println("'y ="+ y);

4
4 Stuuellexecues the following program segment and encounters an error. ldentify the 2]
Statement which has an error. and correct the code to get the output as "SUCCESS".
char x='A;
switch(x) {
case 'B': System.out.println("SUCCESS");
case 'A': System.out. println("FAIL"),
5. Consider the following code snippet. Determine how many times the loop will execute (2]
and write the output of the code:

int z = 20;
while (true) {
System.out.printin(z- 5);
if (z % 7 == 0){
break;

Z +=3:

6. When there is no explicit initialization, what are the default values set for variables in the [21
following cases?
(a) Integer variable
(b) String variable
7. Predict the output of the following code snippet: [2]
char ch = 'M:
ch = Character.tolLowerCase(ch);
int n = (int) ch + 5;
System.out.println(char) n +"t" +ch);
A student is trying to convert a stringpresent in str tO a numerical value so that they can [21
compute the cube of the converted value. However, the code has an error. Name the
error (syntax / logical / runtime). Correct the code so that it compiles and runs correcty.
String str = "64":
int num = Integer.parselnt(str):
int result = Math.pow(num,3);
system.out.println(result);
9. Consider the following program segment and answer the questions below:
class calculate {
int a;
double b;
calculate()
a=0;
b=0.0:
}
calculate(int x, double y\.
a=x;
b=y;
void sum(X
System.out.printin(a'b);:}}
Name the type of constructors used in the above program segment.
10. Consider the following program segment and answer the questions given below: (21
int x[]0 ={2,4,5,6}, {5,7,8,1), (34, 1,10, 93):
(a)What is the position of 34?
(b)What is the result of x[2][3] + x[1I212

SECTION B
(Answer any four questions from this Section.)
The ansWers in this section should consist of the progrems in either
BlueJ environien
or any
program environment with java as the base.
Each program should be written using variable
description / mnemonic codes so iat to
logic of the
program is clearly depicted.
Flowcharts and algorithms are not required
Question 3
(15]
Define aclass with the following
specifications:
Class name: Bank
Member variables:
double p - stores the principal amount
double n - stores the time period in years
double r- stores the rate of interest
double a- stores the amount

member methods:
Void accept () - input values for p and n using Scanner class methods only.
void calculate () -calculate the amount based on the following conditions:

Time in (Years) Rate %


Upto v2
>V2to 1year 10
>1to 3years 11
>3 years 12

a=p(1+100
void display () - display the details in the given format.

Principal Time Rate Amount


XXX XXX xXX XXX

Write the main method to create an object and call the above methods.

Question 4: [15]
below.
Define a class to search for a value input by the user from the list of values given
If it is found display the message "Search successful", otherwise display the message
"Search element not found" using Binary search technique.

5.6, 11.5, 20.8, 35.4, 43.1, 52.4,66.6, 78.9, 80.0, 95.5.


Question 5
[15]
display the
Define a class to accept astring and convert it into uppercase. Count and
number of vowels in it.
Input: computer application
Output: COMPUTER APPLICATION
Number of vowels: 8
Question 6:
Deine a class to accept values into a 4x4 array and find and display the sum of each
row.
Example:
AD)={1.2,3,4). {5,6,7,8). {1,3,5,7), (2,5,3,1)}

Output:
sum of row 1= 10 (1+2+3+4)
sum of row 2 = 26 (5+6+7+8)
sum of row 3= 16 (1+3+5+7)
sum of row 4= 11 (2+5+3+1)

Question7
Define aclass to accept a number andcheck whether it is a SUPERSPY number or not.
A number is called SUPERSPY if the sum of the digits equals the number of the digits.
Example: Input: 1021
Output: SUPERSPY number
SUM OF THE DIGITS = 1+0+2+1 =4, NUMBER OF DIGITS =4]
Example2: Input: 125
Output: Not a SUPERSPY number
[SUM OF THE DIGITS = 1+2+5 =8, NUMBER OF DIGITS =3, Does not match with sum
of digits]
Question 8:
Define a class to overload the method display as follows:

void display(): To print the following format using nested loop


1
12
123
1234
12345

void display(int n): Toprint the square root of each digit of the given number
Example: n=4329
output-3.0
1.414213562
1.732050808
2.0
****** *********

You might also like