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

Class 10 1st Term Paper - Retest

Uploaded by

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

Class 10 1st Term Paper - Retest

Uploaded by

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

NIRAJ PUBLIC SCHOOL

ST
1 TERM EXAMINATION –SEPTEMBER 2023-24
COMPUTER APPLICATIONS
CLASS: 10
TIME: 2 hrs. MARKS:
100

Answers to this paper must be written 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 only.
Answer ALL questions from SECTION–A and any FOUR questions from
SECTION – B.
The intended marks for questions or parts of questions are given in
brackets [ ].
SECTION A (40 marks)
Attempt all questions from this section

QUESTION NO 1:- [20]


Choose the correct answer and write the correct option:
(i) Which feature of object-oriented programming describes the
reusability of code?
(a) Abstraction
(b) Encapsulation
(c) Polymorphism
(d) Inheritance

(ii) A java expression that contains all the elements of same data
type is _____________ expression.
(a) Simple
(b) Complex
(c) Pure
(d) mixed

(iii) Write the output:


System.out.println(Math.abs(-12.34)+Math.sqrt(625));
System.out.println(Math.ceil(-2.3)+Math.floor(-5.6));
(a) -37.34
-8.0
(b) 37.34
-8.0
(c) 37.34
8.0
(d) -37.34
-8.0
(iv) The style of expressing single line comment is:
(a) //comment//
(b) \\comment
(c) /*comment*/
(d) //comment

(v) Rewrite the following using the ternary operator.

int age = 60;


boolean r;
if(age >= 60)
r= true;
else
r= false;

(a) Age >= 60? r=true : false;


(b) Age >= 60? r=true : r= false;
(c) r=Age >= 60? true : false;
(d) r=Age >= 60? “true” : “false”;

(vi) Write the output:


int a=12, b=8;
a*= ++a/6 + b++ % 3;
System.out.println(a);

(a) 36
(b) 58
(c) 48
(d) 60

(vii) The access modifier that gives the least accessibility is:
(a) private
(b) public
(c) protected
(d) Package

(viii) Range of short data type in Java is _____________

(a) -128 to 127


(b) -32768 to 32767
(c) 0 to 65535
(d) -256 to 255

(ix) What type of conversion is happening in the following


statement:
int d=’A’;
(a) explicit
(b) implicit
(c) default
(d) simple

(x) Which among the following is a valid float literal?


(a) 12.36
(b) 12.36f
(c) 12.36F
(d) Both b and c

(xi) Character data type can’t store _______ value.


(a) Special character
(b) Digit
(c) String
(d) Letter

(xii) What is the value of ‘a’ after executing the following code?
int arr[ ]={1,2,3,4,5};
int a=arr[1]*arr[4]+arr[2]%arr[3];
(a) 6
(b) 5
(c) 11
(d) 13

(xiii) Write the output:


int p=(int) ‘X’;
int q=(int) ‘d’;
System.out.println(p+q+27);
(a) 213
(b) 203
(c) 225
(d) 215

(xiv) The operator which acts on one operand is known as


___________.
(a) binary
(b) ternary
(c) unary
(d) relational

(xv) The keyword which makes the variable a class variable.


(a) class
(b) final
(c) static
(d) public

(xvi) What is the output of the following code?


char c=’F’;
int i=10;
System.out.println(c+i);
System.out.println((int)c+i);

(a) F10
80
(b) F10
112
(c) 80
80
(d) 112
112

(xvii) The program code written in any high-level language to solve


a problem is:
(a) object code
(b) source code
(c) machine code
(d) bytecode

(xviii) Which one is a valid declaration of a boolean data type?


a. boolean b1= 1;
b. boolean b1= true;
c. boolean b1= ‘true’;
d. boolean b1= “true”;

(xix) Class Demo


{ public static void main( )
{
int t;
System.out.println(t);
}
}

(a) 0
(b) Garbage value
(c) Syntax error
(d) Run time error

(xx) Two arithmetic expressions can be compared with the if


statement using
(a) Arithmetic operator
(b) Relational operator
(c) Logical operator
(d) Assignment operator

QUESTION NO 2:-

(i) (a) Write the difference between static and dynamic


initialization.
(b) Write any 2 examples of Primitive and composite datatype.
[2]

(ii) a) Define Unicode.


b) Calculate the memory space occupied by the following
String:
String s= “Computer Applications”;
[2]

(iii) Write the difference between equals( ) and compareTo( )


functions. [2]

(iv) Write a java statement to perform the following tasks on a


string: [2]
(a) To extract 4th character of the string m
(b) To extract first 5 characters of the string str.

(v) In the program given below, state the name and the value of
the [2]
a) Argument variable b) class variable
c) local variable d) instance variable

class Myclass
{
static int x=7;
int y=2;
void sampleMethod(int n)
{
System.out.println(n);
System.out.println(y);
}
public static void main( )
{
Myclass obj = new Myclass( );
System.out.println(x);
0bj.sampleMethod(5);
int a=6;
System.out.println(a);
}
}

(vi) Write the output:


[2]
String s= “Hard Work is the key to success”;
System.out.println(s.length( ));
System.out.println(s.lastIndexOf(‘o’));
System.out.println(s.substring(5,12));
System.out.println(s.charAt(10));

(vii) Write the output:


[2]
String A[ ]= {“Chandan”, “Madhu”, “Manjula”, “Raju”,
“Pooja”, “Ramya”};
System.out.println(A[5].length( ));
System.out.printn(A[1].compareTo(A[2]);

1 3
(viii) Write the Java expression for q= + 2
√ a+b c
[2]

(ix) (a) Define identifier


(b) Name any two classes defined in the ‘lang’ package.
[2]

(x) Write the difference between prefix, postfix and infix


notations. [2]

SECTION B (60 Marks)


Attempt any four questions from this Section.
Each question carries 15 marks.
The answers in this section should consist of the programs in
either BlueJ environment or any program environment with Java
as the base. Each program should be written using Variable
descriptions/Mnemonic codes so that the logic of the program is
clearly depicted.

QUESTION NO 3:- [15]

Write a program to perform binary search on a list of integers given


below, to search for an element input by the user, if it is found display
the element along with its position, otherwise display the message
“Search element not found”.

Aanya, Banu, Candan, Dolly, Jaswanth, Mahish, Nihan, Radha

QUESTION NO 4:- [15]


i) Write a class to assign a full path and file name as given below.
Using library functions, extract and output the file path, file name
and file extension separately as shown.
Sample Input: C:\users\admin\pictures\flower.jpg
Sample Output: Path: C:\users\admin\pictures\
File name: flower
Extension: jpg

ii) Write a program to print the following pattern:


ABCDE
ABCD
ABC
AB
A
QUESTION NO 5: - [15]
Write a program that accepts two strings, concatenates them and checks
if the final string is a palindrome. If it is a palindrome, count and display
the number of lowercase letters, uppercase letters, digits and special
characters.

QUESTION NO 6:- [15]


(i) Define a class to input a string. Convert all vowels in lowercase
and all consonants in uppercase.
Sample Input: WELCome TO School
Sample Output: WeLCoME To SCHooL

(ii) Define a class in Java to accept 10 different words in


an array and find and display the length of each
word.

QUESTION NO 7:- [15]


Define a class to accept values into a 3X3 array and check if it is a
special array. An array is a special array if the sum of even elements =
sum of odd elements.
Example:
A[ ] [ ] ={ {4, 5, 6}, {5, 3, 2}, {4, 2, 5}};
Sum of even elements= 4+6+2+4+2 = 18
Sum of odd elements= 5+5+3+5 = 18

QUESTION NO 8:- [15]


Define a class to accept values into a double array of size 20 and print
the range of array, range is the difference between largest and smallest
elements of the array.

You might also like