Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

PreBoard_24_25

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

ST.

PETER’S SCHOOL
Affiliated to CISE, New Delhi-Code: WB401
B.T. Sarkar Road, Purulia-723101
Multiple Choice Question (MCQ) Examination-2024-25
Class: X
COMPUTER APPLICATIONS
Maximum Marks:20
Time allowed:

Name: Sec: Roll No:

Question 1 [20]
Choose the correct answer to the questions from the given options. (Tick (  ) the correct answer)
1. Name the feature of OOP depicted in the below picture.

Recipe? Recipe? Recipe?

a. Inheritance b. Encapsulation c. Abstraction d. Polymorphism


2. Whenever an object is created, which among the following is called first automatically?
a. new b. class c. constructor d. Trigger
3. Modulus operator, % can be applied to.
a. Integers b. Both Integers and floating - point numbers c. Floating - point numbers
d. None of the above
4. The expression Math.pow(2,-2) + Math.floor(12.59) returns?
a. 12.0 b. 12.25 c. 14.5 d. Compiler error
5. Byte data type range is _______
a. -128 to 128 b. -127 to 128 c. -128 to 127 d. -127 to 127
6. for(k=1;k<=2;k++)
{
for(m=1;m<=4;m++)
{
System.out.println(m*2);
}
}
How many times the inner loop is executed?
a. 4 times b. 8 times c. 2 times d. 16 times
7. To create an instance method the keyword used is _____________
a. instance b. static c. non static d. No keyword required
8. The default return type of a User defined function is
a. float b. int c. void d. Null
9. The method compareTo() returns ____________ when two strings are equal and in lowercase :
a. true b. 0 c. 1 d. false
10. Find the output of the following:-
System.out.println(“ABSOLUTE”.substring(“ABSENT”.length()));
a. ABSOLU b. TE c. ABSOLUT d. ABSOLUTE
11. The number of bytes occupied by character constant ‘k’ are:
a. 1 byte b. 2 byte c. 4 byte d. 8 byte
12. Consider the following code
String name[ ] = new String[5];
System.out.println(name[2]);
After execution of this code, which one is true ?
a. 0 b. undefined c. null d. Syntax error
13 What is the output of the below Java program with WHILE, BREAK and CONTINUE?
int cnt=0;
while(true)
{
if(cnt > 4)
break;
if(cnt == 0)
{
cnt++;
continue;
}
System.out.print(cnt + ",");
cnt++;
}
a. 0,1,2,3,4, b. 1,2,3,4, c. 1,2,3,4 d. Compiler error
14. Assertion (A): Static method can access static and instance variables.
Reason (R): Static variable can be accessed only by static method.
a. Assertion and Reason both are correct. b. Assertion is true and Reason is false.
c. Assertion is false and Reason is true. d. Assertion and Reason both are false.
15. A class can have ____________________ number of constructors.
a. one b. two c. three d. multiple
16. The size of an array is:
a. Fixed b. Fixed for integer arrays only
c. Can be changed after creation d. None of these
17. Name the operator that is used to access method of a class:
a. Object b. new c. (.) dot d. import
18. Predict the output of the following statement:
String wd[ ] = {"INDIA", "USA", "NEPAL", "GERMANY", "MEXICO"};
System.out.println(wd[2].substring(0,3) + wd[4].substring(4));
a. USANY b. MEXPAL c. NEPCO d. INDNY
19. Assertion (A): The members of a class declared without any access specifier are accessible in all
classes of the package.
Reason (R): The members without any access specifier are default or package members, hence they
are accessible in all classes of the package.
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) 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.
20. What will be the output of the following statement?
System.out.println( ‘a’ – ‘A’);
a. 32 b. ‘a’ - ‘A’ c. -32 d. will give an error
1. Write the java statement for:
(a) Difference between a raised to b and cuberoot of c
2. Name the following:
(a) A Character method that checks whether a character is space or not.
(b) A Math method that does not have an argument.
3. A manager wants to check the number of employees with names ending with KUMAR,
and fill in the blanks in the given program segment with appropriate Java statements:
void count(String s[])
{
int i, l=_________, c=0;
for(i=0;i<l;i++)
{
if(________________)
c++;
}
System.out.println(c);
}
4. Convert the following for loop segment to an exit-controlled loop.
for(k=10;k>= -1;k- -)
System. out. println(k*2);
System. out. println(k*4);
5. Give the output of the following program segment:
int x[]={2,45,7,67,12,3};
int i, t=0;
for(i=0, t=5;i<3;i++,t- -)
{
System. out. println(x[i]+x[t]);
}
6. Write Java statements for the following:
a. To display the last 4 character of string s.
b. To find the square root of an element present in the array a at 3rd index position.
7. Evaluate the expression:
3*6%5*4/2*7%5
8. The output of a program which extracts a part of the string “COMPASSION” is as
follows:
(a) “PASS”
(b) “PASSION”
Write appropriate Java statements to get the above outputs.
9. For the below code, give the output.
String str =" It is need of the hour";
System.out.println("substring hour"+"/:"+ str.indexOf("hour"));
10 Predict the output
"COMPUTER".compareTo("computer")+”MALAYALAM".indexOf(‘A’)
SECTION B(60 Marks)
(Attempt any four questions.)

Question 3 [15]

1. The basic salary of employees is undergoing a revision. Define a class called Grade_Revision
with the following specifications:
Data Members Purpose
String name to store name of the employee
int bas to store basic salary
int expn to consider the length of service as an experience
double inc to store increment
double nbas to store new basic salary (basic + increment)
Member Methods Purpose
Grade_Revision() constructor to initialize all data members
void accept() to input name, basic and experience
void increment() to calculate increment based on experience as per the table given below
void display() to print all the details of an employee
Experience Increment
Up to 3 years ₹1,000 + 10% of basic
3 years or more and up to 5 years ₹3,000 + 12% of basic
5 years or more and up to 10 ₹5,000 + 15% of basic
years
10 years or more ₹8,000 + 20% of basic
Write the main method to create an object of the class and call all the member methods.
2. Define a class to accept values into a 3x3 array and check if it is a Losho grid or not.
A grid is a Losho grid if the sum of each row and column equals 15.
Print appropriate messages.
Example: 4 9 2
357
816
3. Write a program 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.
Input C:\Users\admin\Pictures\flower.jpg
Output Path: C:\Users\admin\Pictures\
File name: flower
Extension: jpg
4. (a) Define a class to print the Floyds triangle of given rows using nested loops only.
Example:
A Floyd triangle of 6 rows is
1
23
456
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
(b) Define a class to print the sum of the following series:
1+(1+2)+(1+2+3)+..........(1+2+3……20)
5. Write a program to input the number of students present in a class. Create a single
dimension array and input the names of the students into the array. Enter a name and check
whether the student is present in the class or not, using linear search.
6. Define a class to overload the method perform () as follows:-
(i) void perform () – display the following pattern
1
34
567
78910
(ii) boolean perform (int n) – to check whether the input number is abundant number or not.
An Abundant number is a number for which the sum of its proper factors is greater than
the number itself.
Example:
Consider the number 12.
Factors of 12 = 1, 2, 3, 4, 6 Sum of factors = 1 + 2 + 3 + 4 + 6 = 16
As 16 > 12 so 12 is an Abundant number.

You might also like