0% found this document useful (0 votes)
41 views9 pages

Computer Practice

The document is an examination paper for Class X Computer Applications, consisting of multiple-choice questions and programming tasks. It covers various Java concepts, including data types, methods, and control structures, as well as practical programming assignments. The paper is divided into two sections, with Section A focusing on theoretical questions and Section B requiring coding solutions.
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)
41 views9 pages

Computer Practice

The document is an examination paper for Class X Computer Applications, consisting of multiple-choice questions and programming tasks. It covers various Java concepts, including data types, methods, and control structures, as well as practical programming assignments. The paper is divided into two sections, with Section A focusing on theoretical questions and Section B requiring coding solutions.
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/ 9

CLASS X

COMPUTER APPLICATIONS

Maximum Marks: 100

Time allowed: one hour

SECTION A
(Attempt all questions from this Section.)
Question 1 (1 × 20 = 20)
Choose the correct answers to the questions from the given options.
(Do not copy the question, write the correct answers only.)

(i)

Name the feature of java depicted in the above picture.


(a) Encapsulation
(b) Inheritance
(c) Abstraction
(d) Polymorphism
(ii) A fall through is a
(a) type of error
(b) code
(c) variable
(d) loop

1
(iii) The result of dividing by zero in java is

(a) Error

(b) Exception

(c) Infinite

(d) None
(iv) When a composite data type is converted to a corresponding primitive data type,
is called:
(a) Boxing

(b) Unboxing

(c) explicit type conversion

(d) implicit type conversion


(v) The number of bytes occupied by a char array of 20 elements.

(a) 20 bytes

(b) 40 bytes

(c) 80 bytes

(d) 160 bytes


(vi) A variable that is declared within the class but outside constructors or block is
called as

(a) Instance variable

(b) Class variable

(c) Local variable

(d) Argument variable


(vii) Find the output of the following code:
int a=10;
System.out.println(++a);

(a) 10

(b) 9

(c) 11

(d) code error

2
(viii) The output of Math.round(8.5) + Math.floor(-4.3) is:

(a) 14.0

(b) 4.0

(c) 14

(d) 4
(ix) Implicit type conversion is also known as
(a) coercion

(b) type casting

(c) dynamic casting

(d) static conversion


(x) Java statement to access the nth element of an array is:

(a) X[n]

(b) X[n+1]

(c) X[n-1]

(d) X[2n]
(xi) Which of the following functions is used to check whether a given character is a
tab

(a) isTab()

(b) isTabSpace()

(c) isSpace()
(d) isWhitespace()
(xii) Cell numbers of a dimensional array are known as …..

(a) packets

(b) blocks

(c) subscripts

(d) compartments

3
(xiii) Name the package that contains wrapper classes:

(a) java.lang

(b) java.util

(c) java .io

(d) java.awt
(xiv) The technique in which the change in the formal parameter is reflected in the
actual parameter is known as …..
(a) call by value

(b) call by reference

(c) call by argument

(d) call by address


(xv) Which of the following methods does not return an int value ?
(a) compareTo()

(b) indexOf()

(c) endsWith()

(d) none
(xvi) In the following program code, what is the process involved?
int x=12;
Integer y = x;
(a) boxing

(b) auto boxing

(c) packaging

(d) unboxing
(xvii) Assertion(A): The indexOf() method is used for searching for the first
occurrence of a character in a string.
Reason(R): The indexOf() and lastIndexOf() methods do the same
function.

(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

4
(xviii) Read the following text, and choose the correct answer:

A class encapsulate Data Members that contains the information necessary to


represent the class and Member methods that perform operations on the data
member.
What does a class encapsulate?

(a) Information and operation

(b) Data members and Member methods

(c) Data members and information

(d) Member methods and operation


(xix) Assertion(A): call by value is known as pure method

Reason(R): The original value of variable does not change as operation is


performed on copied values.
(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 false and Reason (R) is true

(d) Assertion (A) is false and Reason (R) is true


(xx) String in java is a
(a) object

(b) character array

(c) class

(d) variable

Question 2

(i) State the output of the following program segment: [2]


String s = “Internet of Things”;
int n=s.length();
System.out.println(s.startsWith(s.substring(6,n)));
System.out.println(s.charAt(3) = = s.charAt(7));
(ii) Evaluate the expression when the value of x = 5: [2]
x += x ++ + ++ x + x
(iii) The following code segment should print “You can go out” if you have done [2]
your homework (dh) and cleaned your room(cr). However, the code has errors.

5
Fix the code so that it compiles and runs correctly.
boolean dh = True; boolean cr= true; if (dh && cr)
System.out.println("You cannot go out"); else
System.out.println("You can go out");
(iv) Sam executes the following program segment and the answer displayed is zero [2]
irrespective of any non zero values are given. Name the error. How the program
can be modified to get the correct answer?
void triangle(double b, double h)
{ double a; a = ½ * b * h;
System.out.println(“Area=”+a); }
(v) How many times will the following loop execute? What value will be returned? [2]
int x=2;
int y=50; do{
++x;
y-=x++;
}
while(x<=10); return y;
(vi) Write the output of the following String methods: [2]
(a) "ARTIFICIAL ".indexOf('I' )
(b) “DOG and PUPPY”. trim().length()
(vii) Name any two jump statements. [2]

(viii) Predict the output of the following code snippet: String a="20"; [2]
String b="23";
int p=Integer.parseInt(a); int q=Integer.parseInt(b); System.out.print(a+"*"+b);
(ix) When there is no explicit initialization, what are the default values set for [2]
variables in the following cases?
(a) Integer variable
(b) String variable

(x) int n[ ] = {1,2,3,5,7,8,13,16}; [2]


What are the values of x and y?

x = Math.pow(n[3] , n[2]);
y = Math.sqrt(n[5] + n[0])

6
SECTION B(4×15=60)

(Answer any four questions from this Section.)


Question 3
Design a class name EShop with the following description :
Instance variables/ Data members :
String name – To store the name of the customer
long mobno – To store the mobile number of the customer
double cost – To store the cost of the items purchased
double dis – To store the discount amount
double amount – To store the amount to be paid after discount
Member methods: –
EShop() – default constructor to initialize data members
void input() – To input customer name, mobile number, cost
void calculate() – To calculate discount on the cost of purchased items, based on following criteria

Discount (in
Cost
percentage)

Less than or equal to ₹ 10000 5%

More than ₹ 10000 and less than or equal to ₹


10%
20000

More than ₹ 20000 and less than or equal to ₹


15%
35000

More than ₹ 35000 20%

void display() – To display customer name, mobile number, amount to be paid after discount
Write a main method to create an object of the class and call the above member methods.

7
Question 4
Write a program to input a number and print whether the number is a special number or not.
(A number is. said to be a special number, if the sum of the factorial of the digits of the number is
same as the original number).
Example: 145 is a special number, because 1!+4!+5! = 1 + 24 + 120 = 145 (Where! stands for
factorial of the number and the factorial value of a number is the product of all integers from 1 to
that number, example 5! = 1*2*3*4*5 = 120).

Question 5
Write a Java program to initialize a square matrix of order 4×4 to store integers. Display the
matrix data in the format of matrix. Also check whether the given matrix is a UNIQUE matrix of
not.

A UNIQUE matrix is a matrix whose sum of left diagonal elements is equal to the sum of right
disgonal elements.

Question 6

Write a program to input twenty names in an array. Arrange these names in ascending order of
letters, using the bubble sort technique.
Sample Input:
Rohit, Devesh, Indrani, Shivangi, Himanshu, Rishi, Piyush, Deepak, Abhishek, Kunal, .....
Sample Output:
Abhishek, Deepak, Devesh, Himanshu, Indrani, Kunal, Piyush, Rishi, Rohit, Shivangi, .....

Question 7

Design a class to overload a function find ( ) as follows :


(i) void find (String str, char ch) – to find and print the frequency of a character in a string.
Example : *
Input:
str = “success”
ch = ‘s’ .
Output:
number of s present is = 3

(ii) void find(String si) – to find and display only vowels from string si, after converting it to lower
case.
Example:
Input:
s1 = “computer”
Output:
oue

Question 8

Write a program to initialize the Seven Wonders of the World along with their locations in two
different arrays. Search for a name of the country input by the user. If found, display the name of

8
the country along with its Wonder, otherwise display “Sorry Not Found!”.
Seven wonders — CHICHEN ITZA, CHRIST THE REDEEMER, TAJMAHAL, GREAT WALL
OF CHINA, MACHU PICCHU, PETRA, COLOSSEUM
Locations — MEXICO, BRAZIL, INDIA, CHINA, PERU, JORDAN, ITALY
Example — Country Name: INDIA Output: INDIA-TAJMAHAL
Country Name: USA Output: Sorry Not Found!

You might also like