VIDYA PRATISHTHAN’S MAGARPATTA CITY PUBLIC SCHOOL, PUNE – 13
PRELIMINARY EXAMINATION, JANUARY 2023
Std. X COMPUTER APPLICATIONS Marks : 100
_______________________________________________________________________________
SECTION A (Attempt all the questions - 40 marks)
Q1) Choose the correct answer and write the correct option of question number and answer. [20]
i) The ability of a method or object to take on multiple forms is known as __________.
a) Polymorphism b) Abstraction c) Encapsulation d) Inheritance
ii) The parameter that appear in the method call are called as ____________.
(a) Call parameters (b) void parameters (c) actual parameters (d) formal parameters
iii) Which of the following is not a binary operator .
(a) / (b) OR (c) ++ (d) =
iv) The default delimiter used in the scanner class is _______________ .
(a) semicolon (b) comma (c) whitespace (d) double quote
v) Math.pow( 25, 0) + Math.sqrt(169)
(a) 18.0 (b) 18.0 (c) 14.0 (d) 14
vi) Though the program compiles, the result is not the desired result as per the requirement
due to _________ .
(a) Syntax error (b) Logical error (c) Runtime error (d) compiler.
vii) Scanner class is under __________ package.
(a) Java.lang (b) java.util (c) java.io (d) java.awt
viii) Implicit type conversion is also known as _____________ .
(a) Coercion (b) type casting (c) explicit conversion (d) type conversion
ix) The conditional operator (ternary) operator works on _________ operands.
(a) one (b) two (c) three (d) four
x) The number of bytes occupied by char datatype is ___________ .
(a) 2 byte (b) 4 bytes (c) 8 bytes (d) 16 bytes
xi) Square root of a negative number can’t be determined. Hence the output will be __________.
(a) NaN (b) Null (c) 0 (d) 1
xii) The default of char is ________________ .
(a) '\u0000' (b) ‘\n’ (c) ‘\t’ (d) ‘\a’
xiii) The wrapper class of char datatype is ____________ .
(a) Character (b) String (c) Boolean (d) Double
--2
-2-
xiv) The automatic conversion of primitive data type into an object of its equivalent wrapper
class is known as ____________ .
(a) autoboxing (b) unboxing (c) implicit conversion (d) explicit conversion
xv) class is a ___________ data type.
(a) String (b) primitive (c) composite (d) character
xvi) A variable which can take an array of values is referred to as a _________ variable.
(a) subscripted (b) local (c) instance (d) static
xvii) The index value of array[40] are numbered from _______________.
(a) 1 to 40 (b) 1 to 39 (c) 0 to 40 (d) 0 to 39
xviii) _______function checks if the string is equal, bigger or smaller than the other string or not.
(a) equals() (b)equalsTo() (c) compare( ) (d) compareTo( )
xix) A String internally creates __________________ .
(a) an integer array (b) a character array (c) a string array (d) a numeric array
xx) Which of the following statement is false.
(a) A constructor has same name as a class name.
(b) A constructor is used to initialise the data members.
(c) A constructor returns initial value.
(d) A constructor is not used for arithmetical and logical operations.
Q2) i) Consider following program and answer the questions given below. [2]
class Display {
int a, b;
static int c;
i) Name the class variable.
ii) Name the instance variable.
ii) Evaluate the expression [2]
a *= a++ * --a / -a % ++a Given a = 4;
(a +b)(a+ b)
iii) Write the java expression for [2]
( x+ y )
iv) Convert the following do while loop to for loop. [2]
int i=2;
do{
i+=2; } while(i <=7);
System.out.println (i); --3
-3-
v) Write the ternary operator to display the minimum of three numbers. [2]
vi) Give the output of the following String function. [2]
String s = new String(“Super Computer”);
System.out.println(s.toUpperCase());
System.out.println(s.substring(7));
vii) state the output of following code. [2]
int s=0;
int b[] = {1 , 3 , 5 , 7};
for(int i=0 ; i<=1 ; i++)
s = b[i] + b[3-i];
System.out.println(s);
viii) Write the function prototype of a static function calc() which receives double type value and
returns boolean value. [2]
ix) Differentiate between the access specifier - public and private. [2]
x ) Write the array elements on given array below after the first pass to show the working of the
bubble sort algorithm. [2]
9 6 24 3 11
SECTION B (60 marks)
Attempt any four programs. Write the comments where necessary and the variable description
table at the end of each program
3) Define a class Electricity described as below. [15]
Data members :
name, consumer number , unit consumed.
Member methods :
i) To accept the name, consumer number, unit consumed.
ii) To compute the electricity charges accordingly.
Upto 100 units 80 paise per unit
For next 100 units Rs. 1 per unit
For more than 200 units Rs. 1.25 per unit
iii) To display the bill
iv) Write a main method to create the object of the class and call the above member methods.
--4
-4-
4) Define a class to overload the method to print as follows – [15]
void disp( ) to print the pattern given below
1 3 5
7 9
11
void disp(int choice, char ch) – Display the character in lowercase if choice is 1, otherwise
display the character in uppercase if the choice is 2.
void disp (String str) – Display the reverse of String str in capital. If input received for str is
“cat”, then the output printed should be “TAC”.
5) Write a program to store the year given in single dimentional array. Arrange them in the
ascending order using bubble sort technique. Print the original array and the sorted array.
Input - 2001 2000 2005 2003 2008
Output - 2000 2001 2003 2005 2008 [15]
6) Define the class to accept 10 students name and marks scored in maths. Check for the existence
of the given name in the array using linear search , if found print the position of the record, name
and marks scored in maths. If not found, print search unsuccessful. Also print the names starting
with “mo” . [15]
7) Write a program using Scanner class to enter a token / word in a mixed case . Change the case of
the word to lower case and display the new token after deleting all the vowels.
Input : ComPtEr
Output : cmptr [15]
8) Write a program to accept 20 numbers in a Single Dimensional Array. Find and display the
following.
i) Sum and count of even numbers. [15]
ii) Multiple of 3 as well as 5.
iii ) Buzz numbers.
A number that is divisible by 7 or has the last digit as 7 is said to be a buzz number.
*******************