VIBGYOR HIGH
Sample Paper
COMPUTER APPLICATIONS
Grade: X Max. Marks : 100
Date : dd/mm/yyyy Time Allowed: 2 hour
INSTRUCTIONS:
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 in Section A and any four questions from Section B.
The intended marks for the questions or parts of questions are given alongside
the questions.
This paper contains 8 printed sheets.
SECTION A (40 marks)
Attempt all questions
Q. 1 Multiple Choice Questions [20]
1. What is the value of variable ans after evaluating the following statement if [1]
initially ans=200:
ans= (ans>=180)? ans++ : ++ans;
a. 201
b. 200
c. 199
d. None of the above
2. Which one of the following is not a jump statement? [1]
a. break
1
b. continue
c. default
d. return
3. What is the correct output for this program? [1]
public class loop
{
public static void main ()
{
for ( ; ; )
{
System.out.println(“Hello Loop”);
}
}
}
a. compile time error
b. run time error
c. infinite loop
d. Hello loop
4. The package that contains wrapper class is ___________________ package. [1]
a. java.awt
b. java.lang
c. java.util
d. java.net
5. What is result of the following statements on the basis of given array? [1]
int num[ ] = { 3,5,10,12,8};
System.out.println(num[2]+ “\t” + (num[1]*10)+ “\t”+(num[3]-5));
a. 10 50 7
b. 5 10 12
c. 10 10 7
d. 5 50 5
6. Which one of the following operators can be used to concat two strings? [1]
a. +
b. &&
c. +=
2
d. II
7. The statement a*=5 is equal to ________. [1]
a. a = 5*
b. a = a* 5
c. a*5
d. a= a+5
8. Arrange the following primitive data types is an ascending order of their size: [1]
short boolean double int
a. short boolean int double
b. boolean double int short
c. short boolean double int
d. boolean short int double
9. The access specifier that gives the most accessibility is ____________. [1]
a. default
b. protected
c. public
d. private
10. The ASCII values of lowercase characters ( a to z ) are ____________ . [1]
a. 48 – 59
b. 97 – 122
c. 65 – 90
d. 32 – 58
11. What will be the output of following function? [1]
Math.ceil(- 47.95)
a. – 47.00
b. 48.00
c. – 47
d. – 48.00
12. In OOP, stress is given on ________________ . [1]
a. data
b. functions
c. procedure
d. class
3
13. The return type of the library function isWhitespace(char ch) is__________ . [1]
a. boolean
b. char
c. int
d. double
14. What is a nested loop? [1]
a. loop with empty initialization
b. loop without condition
c. a loop within a loop
d. All of above
15. The variable that comes into existence when an object of the class is created [1]
is known as_________________.
a. static variable
b. local variable
c. global variable
d. instance variable
16. String x= “Computer”; [1]
System.out.println(x.substring(1,3)) ;
The output will be
a. comp
b. om
c. omp
d. com
17. The number of values that can be returned from a function is/are ________ . [1]
a. one
b. many
c. zero
d. two
18. Which one of the following is a valid statement? [1]
a. char [ ] c= new char();
b. char [ ] c= new char(5);
c. char [ ] c= new char[5];
d. char [ ] c= new char{ };
4
19. When automatic conversion of data types takes place in Java it is known as [1]
a. Explicit Conversion
b. Constants
c. Implicit Conversion
d. Type Casting
20. Select the odd one out. [1]
a. Function Overloading
b. Abstraction
c. One in many forms
d. Polymorphism
Q. 2 Answer the following questions. [20]
1. Evaluate the following expression if value of x = 3 initially, [2]
x += x++ + --x + 4 * x-- ;
2. Convert the following code segment into an equivalent do…. while loop. [2]
int x, c;
for( x=10,c=20; c>=10; c=c-2)
x++;
System.out.println(x);
3. Define: Autoboxing. Give example. [2]
4. What will be output of the following code fragment? [2]
for( int i= 1; i<=2; i++ )
{
for( int j= 1; j<4; j ++ )
{
int c= i*j;
System.out.print(c);
}
System.out.println();
}
5. Write a statement to convert a string S which stores the value 150 to the [2]
corresponding wrapper object.
6. What will be output of following? [2]
String s = “Intelligent”;
5
System.out.println(s.indexOf(„e‟));
System.out.println(s.lastIndexOf(„e‟));
7. Identify the errors and rewrite the correct code snippet. [2]
int choice;
Switch(choice);
{
case „a‟:
System.out.println(“Number is” + c);
break;
case 2
System.out.println(“Number is” + d);
Break
}
8. Name the String functions that perform the following: [2]
a. Remove blank spaces provided in prefix and suffix of the String
b. Allows extraction of a character from a String
9. Name the java keyword that: [2]
a. indicates that a method has no return type
b. indicates that a reference does not refer to anything not even zero
10. State the 4 principles of Object-oriented programming (OOP). [2]
SECTION B (60 marks)
Attempt any four questions from this Section.
The answers in this section should consist of the Programs in BlueJ
environment or any program environment with Java as the base. Each
program should be-written using Variable descriptions/Mnemonic
Codes such that the logic of the program is clearly depicted.
Flowcharts and Algorithms are not required.
Q. 3 Define a class named Bike_cal with the following description:
Instance variables/Data members:
String name – Stores the name of the customer
int phno – Stores the phone number of customer
6
int bno -- Store the bike‟s number
int days -- Store number of days bike is taken on rent
int charge -- To calculate and store rental charge
Parameterized Constructor – To input and store the details of the customer
Member Methods:
(i) void compute() To input compute the rental charge
The rent for bike is charged on following basis:
First 5 days = Rs. 500 per day
Next 5 days = Rs. 400 per day
Rest of the days = Rs. 200 per day
(ii) void display() To display details in following format
Bike No Phone No. No. of days Charge
______ _________ _________ ______
Write a main method to create object of the class and call other member
methods.
Q. 4 Write a program to input 20 names in an array. Arrange these names in [15]
ascending order of names, using bubble sort technique.
Q 5. Write a program to accept a String. Replace all vowels present in the string by [15]
a symbol asterisk(*). Store the new string into another string object str. Print
the original and new string.
Example:
Input: I am eating a Mango.
Output: * *m **t*ng * M*ng*.
Q. 6 Write a program to perform following operations on a two-dimensional array: [15]
a. Find sum of each row of the matrix
b. Find sum of each column of the matrix
7
Q. 7 Write a program to input all Prime - Palindrome numbers between „n‟ and „m‟. [15]
(If the square of a prime number is palindrome, the number is known as prime-
palindrome.)
For example:
Input: 11, 112 = 121, which is palindrome so 11 is a Prime - Palindrome.
Q. 8 Design a class to overload a function series( ) as follows: [15]
1. double series (double x, double n) with two double argument and returns the
sum of the series
sum= - + …………………... n terms
2. double series (double x) with one double argument and returns the sum of
the series
sum= + + ………………. +
*****