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

Sample QP-Comp-X

Uploaded by

lololololo
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)
108 views

Sample QP-Comp-X

Uploaded by

lololololo
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/ 5

XXXXX SCHOOL

FIRST PRE BOARD EXAMINATION: 2024 – 25


SUBJECT: COMPUTER APPLICATIONS
GRADE: X Max.Marks: 100
Duration: 2 hrs
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.
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 A and any three questions from Section B.
The intended marks for questions or parts of questions are given in brackets [].
SECTION A (40 Marks)
(Attempt all the questions from this section)
Question 1
Choose the correct answers to the questions from the given options. [20]
(Do not copy the question, write the correct answers only.)

(i) Name the feature of java which is depicted in the above picture.
(a) Inheritance (b) Encapsulation
(c) Polymorphism (d) Data Abstraction
(ii) Which of the following types can be used for a non-returnable method?
(a) int (b) double
(b) float (d) void
(iii) Give the output of the following statement:
“SUCCESS”.indexOf(‘S’)+”SUCCESS”.lastIndexOf(‘S’)
(a) 0 (b) 5
(c) -5 (d) 6
(iv) State the type of the loop in the given program segment :
for (int i=5;i!=0;i-=2)
System.out.println(i);
(a) finite (b) infinite
(c) null (d) fixed

Computer Applications Page 1|5


(v) “Java compiled code(byte code) can run on all the operating systems”-Name the feature.
(a) Robust and secure (b) Object oriented
(c) Platform independent (d) Multithreaded
(vi) What makes two or more functions having the same name different?
(a) Number of arguments (b) Type of arguments
(c) Return type (d) Both A and B
(vii) Assertion (A) : A class is used to create similar objects that possess different characteristics
and common behaviour.
Reason(R) : Class is an object factory.
Based on the above discussion , choose an appropriate statement from the options given
below.
(a) Both (A) and ( R) are true , and (R) is the correct explanation of (A).
(b) Both (A) and ( R) are true , but (R) is not the correct explanation of (A).
(c) Assertion (A) is true but reason ( R) is false.
(d) Assertion (A) is false but reason ( R) is true.
(viii) Which of the following datatype cannot be used with switch case construct?
(a) int (b) char
(c) String (d) double
(ix) What is the value stored in variable p?
double p= Math.abs (Math.floor (-8.50));
(a) -8.0 (b) -9
(c) 9.0 (d) 9
(x) The non-static data members of a class are also called:
(a) non-instance variables (b) instance variables
(c) constant variables (d) local variables
(xi) The variable that is accessible to all parts of the program is called.
(a) Local variable (b) global variable
(c) static variable (d) final variable
(xii) The extension of a java source code file is _____:
(a) .exe (b) .obj
(c) .java (d) .class
(xiii) ______ class is used to convert a primitive datatype to its corresponding object.
(a) System (b) Math
(c) Scanner (d) wrapper
(xiv) Multiple branching statement of java is _______.
(a) for (b) while
(c) do-while (d) switch
(xv) Choose the odd one:
(a) isWhitespace( ) (b) replace( )
(c) concat( ) (d) trim( )
(xvi) The method to convert a lowercase character to uppercase is :
(a) String.toUpperCase( ) (b) Character.isUpperCase( char)
(c) Character.toUpperCase(char) (d) Character.toUppercase(char)
(xvii) Assertion (A):In java , using function one can convert a string given in uppercase into
lowercase letters.
Reason(R) : The String.LowerCase( ) function is useful for this purpose.
Based on the above discussion , choose an appropriate statement from the options given
below.

Computer Applications Page 2|5


(a) Both (A) and ( R) are true , and (R) is the correct explanation of (A).
(b) Both (A) and ( R) are true , but (R) is not the correct explanation of (A).
(c) Assertion (A) is true but reason( R) is false.
(d) Assertion (A) is false but reason( R) is true.
(xviii)The function that extracts a part of a String is called ________.
(a) indexOf( ) (b) IndexOf( )
(c) Indexof( ) (d) none of these
(xix) Consider the array given below and predict the output:
char ch= {‘A’,’E’,’I’,’O’,’U’};
System.out.println(ch[0]*2);
(a) 65 (b) 130
(c) ‘A’ (d) 0
(xx) The statement used to find the total number of strings present in the string array
String s[ ] is:
(a) s.length (b) s.length( )
(c) s.Length( ) (d) length(s)

Question 2

(i) Consider the following two-dimensional array and answer the questions given below. [2]
int x[ ][ ] = {{4,3,2},{7,8,2},{8,3,10},{1,2,9}};
(a) What is the order of the array?
(b) What is the value of x[0][0] + x[2][2]?
(ii) Evalute the expression when x = 4: [2]
x += x++ * ++x %2.
(iii) Predict the output: [2]
(a) Math.pow(25,0.5)+Math.ceil(4.2);
(b) Math.round(14.7)+Math.floor(7.9);
(iv) String s1=”45.50”; String s2=”54.50”; [2]
double d1= Double.parseDouble(s1);
double d2= Double. parseDouble(s2);
int x= (int) (d1+d2);
What is the value of x?
(v) Kamal wants to display only the alphabets stored in a character array.While compiling [2]
the code,an error was displayed. Check for the statement with the error and write the
correct statement.
char arr[ ]={‘4’,’&’,’a’,’w’,’d’};
int i;
for(i=0;i<arr.length;i++)
{
if(Character.isLetter(arr))
System.out.println(arr);
}
(vi) How many times will the following loop execute? Write the output of the code:
int x=10;
while(true){
System.out.println(x++ *2);
if(x%3==0)

Computer Applications Page 3|5


break;}
(vii) Consider the following array and find the outputs: [2]
int arr[ ]={10,20,30,40,50};
System.out.println(arr[3]-1);
System.out.println(arr[-1+2]);
(viii) Write java statements to perform the following tasks: [2]
(a) To extract the last character of a word(wd) stored in the variable chr..
(b) To return the first occurrence of ‘a’ in the word “applications”.
(ix) State the output: [2]
String s=”Examination”;
int n= s.length( );
System.out.println(s.startsWith(s.substring(5,n)));
System.out.println(s.charAt(2)==s.charAt(6));
(x) Identify the type of initialisation in the following statements: [2]
(a) int a=4;
(b) double c= Math.sqrt(a);

SECTION B (60 Marks)


(Attempt any four questions from this section)
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 description / mnemonic codes
so that the logic of the program is clearly depicted.
Question 3 [15]
Define a class to overload the method print( ) as follows:

void print( int n) : To print whether the given number is a special number or not. A number is
said to be special number , if the sum of factorial of its digits is same as the
original number.
Example: 145 is a special number because 1!+4!+5! = 145

𝑥 𝑥2 𝑥3 𝑥4
double print( int x, int n): To print the sum of the series 1 + 1! + + + …𝑛
2! 3! 4!

Question 4 [15]
Write a program to input a string and convert into uppercase. Print the pair of vowels and the
number of pair of vowels occurring in the string.
Sample input: BEAST AND BEAUTIFUL
Sample output: Pair of vowels: EA,EA,AU
No:of pair of vowels:3

Question 5 [15]
Write a program to input the weights of ten people. Sort and display them in ascending order
using the selection sort technique.

Computer Applications Page 4|5


Question 6 [15]
Write a program with the following specifications:
Class name : StringProg
Instance variables/Data members:
String str
Member methods:
StringProg( ) : Constructor to initialise str.
void count(char c) : to find and print the frequency of a character in the string.
void compare(String) : to compare the string str with the string passed as argument and print
whether the given string passed as an argument is larger , smaller or
equal.
Write a main method to create an object for the class and invoke the above member methods.

Question 7 [15]
Define a class to overload the following methods:
(a) void display( )
EEEEE
DDDD
CCC
BB
A
(b) void display(int n) - To check whether the number is a lead number or not.A lead number
is the one whose sum of even digits is equal to the sum of odd digits.
Sample input: 3669
Sample output: sum of odd digits =3+9=12
Sum of even digits= 6+6=12
Hence,3669 is a lead number.

Question 8 [15]
Write a program to accept integer values into a 4 x 4 array . Display the array elements and find
the sum of left diagonal and right diagonal elements.
Sample input :

12 8 29 11
7 19 23 41
16 15 9 10
2 16 5 14
Sample output:
The array elements are:
12 8 29 11
7 19 23 41
16 15 9 10
2 16 5 14
Sum of left diagonal elements : 54
Sum of right diagonal elements: 51

Computer Applications Page 5|5

You might also like