Class 10 - Practice Paper 1 - 2022-23 - Comp App
Class 10 - Practice Paper 1 - 2022-23 - Comp App
PRACTICE PAPER 1
COMPUTER APPLICATIONS
Attempt 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
(Attempt all questions)
Question 1 [20]
Choose the correct answers to the questions from the given options.
(Do not copy the question. Write the correct answers only)
(i) Total size of array A having 25 elements of char type :-
a. 25 bytes
b. 100 bytes
c. 50 bytes
d. 10 bytes
(ii) Write the output for the following :-
String s1 = “Life is Beautiful”;
System.out.println(“Earth” + s1.substring(4));
System.out.println(s1.endsWith(“L”));
a. Earth is Beautiful and true
b. Earth is Beautiful and false
c. Earthis Beautiful and true
d. Earthis Beautiful and false
(iii) A wrapper class converts :
a. int to float
b. float to int
c. String to StringBuffer
d. Primitive data type to object
(iv) Which statement among the following will not create an array?
a. int ar1[]=new int[10];
b. float ar1[]=new float[10];
c. byte ar1[]=new byte[10];
d. int ar1=new int[10];
(v) Composite data types are formed by using:
a. Class variables
b. Primitive data types
c. Static data types
d. Method names
(vi) In which case would binary search terminate in one search?
a. If the middle element is the target
b. If the first element is the target
c. If the last element is the target
d. In all cases
(vii) Find the output of the following code: System.out.println(“UniVersAl”.indexOf(„V‟));
a. 2
b. 3
c. 4
d. 5
(viii) Which among the following can be used together in a single class?
a. Only private
b. Private and Protected together
c. Private and public together
d. All access specifiers together
Page 1 of 2
(x) State the output for the following code:
char ch1='T',ch2='C';
int d = (int)ch1 - (int)ch2;
if (d > 0)
System.out.println("Second character is smaller");
else if (d < 0)
System.out.println("First character is smaller");
else
System.out.println("Both the characters are same");
a. First character is smaller
b. Second character is smaller
c. Both the characters are same
d. Incorrect code
(xi) What output will the following code produce ?
class trial
{ static void main()
{
String s1=null;
System.out.println(s1.toString());
}
}
a. “null”
b. java.lang.NullPointerException
c. null
d. None of these
(xii) Given the following lines of code. Choose correct option.
int []myar = new int[5];
myar=new int[6];
a. The array is extended losing its contents.
b. The array is extended keeping the contents.
c. The 2nd line assigns a new size to myar.
d. None of these.
(xiii) Write statements that will produce the output given with respect to the string and
character given below :
String str=”Festivals@2022”;
char ch=str.charAt(5);
Statement to produce the output „FESTIVALS@2022’
a. str.sentenceCase()
b. str.upper()
c. str.toUpperCase()
d. str.toUpper()
Page 2 of 2
(xv) private double m is accessible in ?
a. Class A, Class B
b. Only class D
c. Class B, Class C
d. Only class B
Question 2. [20]
(a) Name the keyword that :-
(i) Distinguishes between instance variables and class variables.
(ii) Calls a package in the program.
(b) State one difference and one similarity between do-while loop and while loop.
(c) Differentiate between a constructor and a method.
(d) How can class be used as a user defined data type ? Explain it with the help of
an example.
(e) What is the difference between length and length() functions.
SECTION B
Attempt any four questions from this Section
Question 3. [15]
Write a program to input 10 numbers into an integer array and find the average of even as
well as odd numbers separately.
Question 4. [15]
Write a program to accept a String type array s[] as parameter and print the smallest
word in it.
Page 3 of 2
Question 5. [15]
Write a program to accept an email address and output username, domain name (mail
server) and domain separately.
Sample input : - jsmith@outlook.com
Sample output :-
Username : jsmith
Domain name : outlook
Domain : .com
Question 6 [15]
An e-store announced the following seasonal discounts on certain items purchased. Create
a class with the following details to handle this task.
Class : E_Store
Data members : String itname, long tcost, float discount, double amount
Member functions :
void Accept() – Input the item name and its total cost.
void Compute() – Calculate the seasonal discount as given below :-
Item name Discount on total cost
LandPhone 50%
Mobile 30%
Tab 25%
Laptop 40%
Otherwise 10%
void display() – Print the discount and amount payable.
Also use the main() to create an object and execute the above member methods.
Question 7 [15]
Write a Java program to accept a positive integer in main() and pass it to another
function double COMPUTE(int m). This method will calculate and return the norm of
the passed number, back to main(). The norm of a number is the square root of sum of
squares of all digits of the number.
Sample input : Enter a positive integer :- 68
Sample output : The norm of 68 is 10
Question 8 [15]
b) void fnPrint()
12345
2345
345
45
5
**************
Page 4 of 2