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

SXCS RE Computer 2024

SXCS preboards paper.

Uploaded by

pinakilahiri640
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)
59 views4 pages

SXCS RE Computer 2024

SXCS preboards paper.

Uploaded by

pinakilahiri640
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

ST.

XAVIER'S COLLEGIATE SCHOOL,30 MOTHER TERESA SARANI, KOLKATA-16


Clss:X SECOND SEMESTER BLOCK TEST Date: 11/12/2024
Duration: Two hours COMPUTER APPLICATIONS Full Marks: 100
Section A
Answer all questions
Question 1
Choose the correct answers to the questions from the given options [20]
i)

Name the feature of java depicted in the above picture.


a) Abstraction b) Encapsulation c) Inheritance d) Polymorphism
ii) Parameters which receive the values from the calling method are termed as parameters.
(a) actual (b) formal (c) reference (d) class

iii) Ternary operator is a:


(a) logical operator (b) arithmetic operator (c) relational operator (d) conditional operator
iv)The method to convert a String to double is: hy
(a) String. toDouble) (b) Double. Parsedouble()
, (c) Double. parseDouble(String) (d) Double. parseDouble( ) shated
v) When String m is compared to n , the result obtained is greater than zero. Which of the following is true?
(a) m comes before n in the dictionary. (b)n comes before m in the dictionary.
(c) m and n are equal. (d) m and n have the same length. iu
that
vi) Arrange the following in the descending order of number of bytes occupied.
L. char x{20]
II. int aí4][2] valiase
III. double b[6}
(a) II, II, I (b) III, I, I (c) I, L, I (d) I, II, I
cNon
)stativa
vii) Which of the following statement is an example for explicit typecasting? ade
(a) int amount = 45:
(b) int amount = 24*24:: the
(c) int amount = Integer.parselnt (45"): (d) int amount int(45.759: Wame Vari

vii) Which of the following statements are valid for static member methods of a class? Cam
I. They can access static as well as non-static data members.
II. They can call non-static member methods.
IL. An object is required to invoke the methods. b)
(a) Iand II (b) Il and III (c) I and [II (d) Only II
ix) What is the outcone of the following code snippet:
public class Test

public static void main( )

char[J[ matrix it+)


for( int i=0; iK3; -la,b','c'),{'+"");
System.out.print( matrix[i|[]
p.'qr},(xy!z}}:
}}
(a)a b c (b) ap x (c) pqr (d) bqy
x) Which ofthefollowing is NOT true for polymorphism?
(a) All methods have the same name.
Methods are invoked based on the arguments.
(b)
i iC )

(C) Methods shouBd have the same number and the


(d) It is a principle of same type of argumentS.
OOPs.
xi) Name the package that contains
(a) java.lang wrapper classes:
(b) java.util (c)java .io (d) java.awt
Xii) Invoking a method by passing the array is termed as
a) Call by value b) Call by reference c) Call by method d) Call by function
xiii)) A function that changes or modifies the state of received
a) Pure function argument.
b) Function overloading c) Impure function d) Local function
Xiv) Which access specifier allows accessibility by all classes in the same package, but only by
ditferent package? subclasses in a
(a) public (b) private (d) default
(c) protected
xv) Which of the following String
methods has integer argument?
I. length II. substring III. indexOf IV. charAt
(a) Only II (b) Iand IV (c)II and IV (d) I and III
xvi) Which of the following keyword is used to
(a) new
create an instance of a class?
(b) public (c) class (d) None of the above
xvii) Which of the following is a valid
statement to print the following sentence:
Raj said "Good moming"
(a)System. out. println(Raj said Good morning");
(b)System. out. println(Raj said \\Good morningl):
(c)System. out. printin("Raj said \"Good morning" ");
(d) System. out. println("Raj said Good morning");
xvii) ASsertion: A class can have multiple constructors
Reason: Multiple constructors are defined with same set of
(a) Assertion is true, Reason is false. arguments.
(b) Both assertion and Reason are false.
(c) Both assertion and Reason are true.
(d) Assertion is false, Reason is true.

xix)Assertion: The switch...case statement must have a


default case.
Reason: The default case is executed when no case matches the
(a) Assertion is true, Reason is faise.
value of the variable.
(b) Both assertion and Reason are false.
(c) Both assertion and Reason are true.
(d) Assertion is false, Reason is true.

XX)Give the output:


(a) ) System.out.println("but".compareTo("buter");
(b) -3 (c) 3 (d) 6
Question 2
i) Convert the following while loop to the corresponding for loop:
int m = 5, n = 10; (2]
while (n>=l)

System.out.println(m*n);
n--;

i) What will be the output of the following code?


int m=2; int n=15;
for( int i= l; i<5; it+); [2]
m++; --n;
System.out.println("m=" +m):
System.out.printIn(n=" n):
[21
iii) Consider the following code and answer the questions that follow:
class academic

int x,y;
void access()

int a,b:
academic student-new academic();
System.out.printin(Object Created");

a. Name the instance variables used in the class.


b. Write the name of local variables used in the program.

iv) Write the prototype ofa function which takes in 2 integers and 1
String arguments and returns a value {2)
which is either true or false.

v) Correct the eror(s), if any, in the following program. [2]


class First

public static void main( String args[]1)


int i;
int a{6]={0,1,8,7,6,4};
for(i-0;i<-a.length();itt)
System.out.printin(a[i]);
}}

vi) Predict the output (show working): (2]


int i-5;
do
System.out.printin(ttit5);
itt;
}while(++i<ll);
System.out.printin();
vii) Predict the output (show working): [2]
int p=1, i-2;
do

p*=i;
} while (+ti<s);
System.out.println(p);
viii) Using Java library functions, write statements with appropriate datatypes for the
i) Toextract "SIP" from following: [2]
MISSISSIPPI".
ii) To remove all leading and trailing spaces from a
string str.
ix) Replace the following set of if-else
statements with switch-case statements: [2]
void work(char code)

if(code=='A')
else System.out.printin(Well Done")};
if(code== B' | code= 'C)
System.out.println(Satisfactory");
else if(code= D'|code=E)
System.out.println("More effort required");
x) If m and n are int type variables, what will
be the result of the expression m%n
when m= -14 and n= -3? (2]
SECTION B
(Answer any four questions from this Section.)
Each program should be written using variable description /mnemonic codes so that the logic of the
program is clearly depicted.
Question 3
Define a class called Mobike with the following description:
Instance variabless/ Data members:
bno:to store the bike's number
phno : tostore the phone number of the customer
name tostore the name of the customer
days : to store the number of days the bike is taken on rent
charge : to calculate and store the rental charge
Member methods:
void input () :to input and store the details of the customer
void compute (): to compute the rental charge. The rent for aMobike is charged on the following basis
First five days : Rs.500per day
Next five days : Rs.400 per day
Rest of the days: Rs.200per day
void display () : to display the details in the following format:
Bike No. Phone No. Name No. of days Charge
Question 4 [15]
Write a program to input 10 numbers into an integer array and store only the numbers occurring once into another
array and display it.
For example, if the given array contains 99, 12, 34, 7, 99,36, 12, 16, 14, 123
The resultant array should be: 34, 7, 36, 16, 14, 123
Question 5
Design a program to check the strength of a password. A strong password should satisfy the following conditions:
’length of the password should be at least 12 characters
’should at least have 4 upper case letters, 4 lower case letters, 2 digits,2 special characters
Define a class to accept the password and check and print whether the password is strong or not.
Question 6 [15]
Define a class to overioad the method that performs as follows :
void perforn( int x]) - to display the largest element of the array.
Exampie: (4, 5, 16, 6, 12, 9)
Largest: !6
void perform (String s,char ch)
If ch is F print the first 5 characters, if ch is 'L' print the last Scharacters
Example: s= CARPENTER"
ch = F
Output: CARPE
ch = L
Output: ENTER
void perform(int n) : to print the Product of the first and last digits of the number
Example: ifn = 45326
Output: 4x6-24

Question 7 [15]
Define a class to accept values into a 3×3 array and check and print if it is a special array or not. An array
is a special array if the sumof the even elements =sum of the odd elements.
Example: A[J[]={{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 & [15]


Iut an integer and form a new number by removing all odd dig1ts fron it. Print the new number.
For example,
Input: 123456
Output: 246

You might also like