MOCK TEST COMPUTER APPLICATIONS
Time allowed : 2hrs
Maximum Marks: 100
General Instructions:-
• •Take 15 minutes to read the question paper .
• Do not write anything in this 15 minutes.
• The time written at the head of the paper is the time
allowed for writing this answers.
• Omission of any essential working in the numericals will
result in loss of marks.
• All reasons must be specified in the answers.
• For the MCQs do not write the whole question. Write only
the correct option with the statement.
• For any query in the paper , use your own sense to rectify it.
• All the questions must be attempted in serial order.
• You marks will tell your performance. Use of any unfair
means will be your loss. On the basis of your previous
performance I can catch your cheatings. Thus, Be Honest.
• Best of luck.
• This paper consist of 11 printed pages.
SECTION A (40 Marks)
Attempt all questions from this section
Question 1. [20]
(i) A method can return .........
(a) 1 value
(b)2 values
(c) 3 values
(d) any number of values
(ii) In Java a constructor with no parameter is called a
(a) Default constructor
(b) user defined constructor
(c) custom constructor
(d) static constructor
(iii) Private function is accessible to......
(a) Own class only
(b) sub class and class in the same package
(c) subclass
(d) none of these.
(iv) Function prototype means
(a) Return value of a function
(b) Name of a function
(c) Return type of a function
(d) Return type, name and argument of a function.
(v) Which of the following represent the constructor of the ABC class
(a) ABC()
(b) ABC
(c) ABCconstructor
(d) Constructor ABC ()
(vi) What is the return type of indexOf() function of string class?
(a) char
(b) String
(c) boolean
(d) int
(vii) The ability of a method or object to take on multiple forms is called.
(a) abstraction
(b) encapsulation
(c) inheritance
(d) polymorphism
(viii) Which of the following is a keyword?
(a) token
(b) continue
(c) constant
(d) all of these
(ix) Name the method used to convert String value into int?
(a) ParseInt()
(b) parseInt
(c) parseInteger
(d) none of these
(x) The ......... allows a class to use property of another class.
(a) Encapsulation
(b) Abstraction
(c) inheritance
(d) None of these
(xi) The ......... operator is used to access method of a class.
(a) Object
(b) new
(c) (.)dot
(d) import
(xii) The statement [Link](1+2+“four ”+2+5); gives the output.........
(a) 3 four 5
(b) 3 four 23
(c) 12 four 23
(d) error
(xiii) x + = x++ + --x + --x + x ; [ x = 5 ]
(a) 23
(b) 20
(c) 18
(d) none of these
(xiv) [Link]([Link](4.22), [Link](8));
(a) 16
(b) 25
(c) 25.0
(d) 16.0
(xv) Consider the following String array and give the output:
String arr[ ]={"Java", "PHP", "Python", ".Net", "HTML"};
[Link]( arr[2].charAt(2)+” “+arr[3].indexOf(‘N’));
(a) h -1
(b) H 1
(c) t 1
(d) Runtime Error
(xvi) Predict the output of the following statement:
String wd[ ] = {"INDIA", "USA", "NEPAL", "GERMANY", "MEXICO"};
[Link](wd[2].substring(0,3) + wd[4].substring(4));
(a) USANY
(b) MEXPAL
(c) NEPCO
(d) INDNY
(xvii) The return data type of [Link]( ) method is _________ .
(a) String
(b) int
(c) void
(d) Integer
(xviii) Which of the following is not a type of inheritance?
(a) multiple
(b) double
(c) hybrid
(d) single
(xix) Corresponding wrapper class of the char data type is?
(a) String
(b) Character
(c) Char
(d) CHARACTER
(xx) The process to change one data type value to another data type is known as
(a) Declaration
(b) Type conversion
(c) Converting data type
(d) Initialising data type
Question 2. [20]
(i) Define method overloading?
(ii) Write an expression in Java for
(iii) State any two differences between user defined data type and primitive data type?
(iv) What is the difference between class variable and instance variable? int x = 20, y = 10, z;
What is the value of x, y, z in z = ++x * (y--) % 4 – y++ * 4 / --x Show the steps.
(v) What is the purpose of default in a switch?
(vi) What will be the output of the following code? String s = “Java is Best”;
[Link]([Link](‘A’)) [Link]([Link](5)+5)
(vii) What do mean by arrays?
(viii) What is the significance of using isDigit() function of Character class?
(ix) Write the Syntax to creating String implicitly and explicitly.
(x) State the output of the following code segment.
char ch;
int x=65;
do
{
ch=(char) x;
[Link](ch + “ “);
if(x%11==0)
break;
x+=2;
} while(x<120);
SECTION B (40 Marks)
Attempt any four questions from this Section.
Question 3. [15]
Define a class Taximeter having the following description.
Data members/instance variables
int taxino – to store taxi number.
String name – to store passenger’s name.
int km – to store number of kilometres travelled.
int bill – to store bill of customer.
Member functions:
taximeter() — constructor to initialize int data members to 0, and string data member to
“”.
input() – to store taxino, name and km.
calculate() – to calculate bill for a customer according to given conditions:
Kilometres travelled Rate per kilometre
First 2 km Rs. 25
Next 10 km Rs. 30
Next 10 km Rs.40
Above 22 km Rs. 50
display () – To display the details.
Design a main method and invoke all the other methods .
Question 4. [15]
Design a class to overload a function Sum( ) as follows.
(i) int Sum(int A, int B) – with two integer arguments (A and B)
calculate and return sum of square of all the even numbers in the
range of A and [Link] input: A=3 and B=10Sample output: sum
= 16 + 36 + 64 + 100
(ii) double Sum( double x, int n ) – with one double arguments(x) and
one int type argument(n) and calculate and return the product of the
following series:
(iii) int Sum(int N) - with one integer argument (N)
calculate and return sum of only odd digits of the
number N. Sample input : N=43961 Sample output :
sum = 3 + 9 + 1 = 13
Question 5. [15]
Write a menu driven program to calculate sum of digits of a number and sum of factors of a
number depending upon users choice.
Question 6 . [15]
Write a program that accept a word and check if it is palindrome or just a special word. Hint
A Palindrome word is which reads the same backward and forward. Example MADAM,
LEVEL etc. Special words are which starts and ends with same character, example COMIC,
ATLANTA etc.
Question 7. [15]
Write a program that input and store monthly salary of 50 employees in an array and perform
following task.
Print the highest salary.
Calculate and print sum and average of salary.
Count how many employees are taking more than 5 lakh salary per annum.
Question 8. [15]
Write a program to sort the given array in descending order using bubble sort techniuque. 15,
25, 41, 68, 92, 55, 48, 21, 74, 19.