COMPUTER APPLICATIONS
Maximum Marks: 100
Time allowed: Two hours
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 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 (40 Marks)
(Attempt all questions from this Section.)
Question 1 [20]
Choose the correct answers to the questions from the given options.
(Do not copy the questions, write the correct answers only.)
i. How many times ‘Hello’ is printed?
Public static void main(String args[])
{
for(i = 0;i<5;i++)
{
System.out.println(“hello”);
break;
}
}
(a) 5
(b) 4
(c) 1
(d) 0
ii. Procedure Oriented Programming gives importance to...........
(a) Instructions only
(b) Instructions and data
(c) Data only
(d) None of these
iii. What is the purpose of the return statement in a method?
(a) It terminates the program.
(b) It returns a value to the caller of the method.
(c) It prints a message.
(d) It declares a variable
iv. If a method is described as pure, it means:
(a) It does not return any value.
(b) It takes no parameters.
(c) It does not change any state and returns the same result for the same inputs.
(d) It contains only one return statement
v. Name the types of data used in a class.
(a) Access Specifiers
(b) Instance Variables
(c) Class Variables
(d) Local Variables
(e) Constructors
(f) Member Methods
vi. What is the precision of the double data type?
(a) 5 digits
(b) 7 digits
(c) 15 digits
(d) 10 digits
vii. Which among the following is used to change the state of an object?
(a) Data Members
(b) Name of the class
(c) Both a and b
(d) None of these
viii. Which of the following statements correctly creates a Scanner object for user
input?
(a) Scanner sc = new Scanner();
(b) Scanner sc = new Scanner(System.in);
(c) Scanner sc;
(d) scan = new Scanner(System.out);
ix. Invoking a method by passing the objects of a class is termed as:
(a) Call by reference
(b) Call by value
(c) Call by method
(d) Call by constructor
x. The correct statement to create an object named mango of class fruit:
(a) Fruit Mango= new fruit();
(b) fruit mango = new fruit();
(c) Mango fruit=new Mango();
(d) fruit mango= new mango();
xi. If a method returns a value, then it must be...........
(a) of the same data type as defined in its prototype
(b) void type
(c) double type
(d) Boolean type
xii. The method that changes the state of an object is known as...........
(a) pure method
(b) impure method
(c) perfect method
(d) imperfect method
xiii. In which technique are the values of actual parameters copied to the formal
parameters?
(a) call by reference
(b) call by value
(c) call by argument
(d) call by method
xiv. Which of the following is correct about arrays in Java?
(a) Arrays in Java are dynamic and can change size after creation.
(b) Arrays in Java have a fixed size once created.
(c) Arrays in Java cannot store objects.
(d) All arrays in Java are automatically initialized with zeroes.
xv. A function that computes a value and returned is called:
(a) Computational function
(b) Manipulative function
(c) Procedural function
(d) None of these
xvi. What is the output of Math.ceil(5.4)+Math.ceil(4.5)?
(a) 10.0
(b) 11.0
(c) 12.0
(d) 9.0
xvii. Given array int x[] = {11, 22, 33, 44}; the value of x[1+2] is ........... .
(a) 11
(b) 22
(c) 33
(d) 44
xviii. Given array int z[] = {15, 16, 17}; It will occupy ........... Bytes in memory.
(a) 3
(b) 12
(c) 24
(d) 64
xix. Which of the following statements is true?
(a) Binary search is less efficient than the sequential search.
(b) Binary search is less efficient than the linear search.
(c) Binary search is more efficient than the sequential search.
(d) Binary search is as efficient as the sequential search.
xx. A linear search...........
(a) can be used with sorted arrays only
(b) can be used with unsorted arrays only
(c) can be used with both sorted and unsorted arrays
(d) cannot be used with arrays
Question 2
(i) Consider the following two-dimensional array and answer the question given
below: [2]
int x[ ][ ] = {{4,3,2}, {7,8,2}, {8, 3,10}, {1, 2, 9}};
(a) What is the order of the array?
(b) What is the value of x[0][0]+x[2][2]?
(ii) (a) What is the output of System.out.println(15/2); in Java? [1]
(b) What is the output of System.out.println(15.0/2);? [1]
(iii) State three differences between Procedure Oriented Language and Object
Oriented Languages. [2]
(iv) Rewrite the following program after removing the errors, underlining each
corrections: [2]
class My Class
int a, b;
void initialize( )
a=5;
b=6;
void show( )
System.out.println(a+ “ ”+ b);
}
static void main( )
My Class ob = new My Class( );
ob.initialize( );
show( ).ob;
(v) Write a program to initialise two integer variables a and with 5 and 6
respectively and interchange them. Thus after interchanging, a and b will
be 6 and 5 respectively. [2]
(vi) Consider the following code and answer the questions that follow: [2]
class abc()
int x,y;
void init( )
x=5;
y=10;
protected void access( )
{
int a=50, b=100;
vxl vin=new vxl( );
vin.int( );
System.out.println(“Object created”);
System.out.println(“I am X=”+vin.x);
System.out.println(“I am Y=”+vin.y);
a. What is the object name of the class vxl?
b. Name the local variables of class.
c. What is the access specifier of method access( )?
d. Write the output of the above program.
(vii) Create a method which accepts two int type variable a and b as parameter
and evaluate the following expression and return it. [2]
(viii) What will be the output of the following program: [2]
class Output
public static void main(String args[])
int a[]={6,5,4,3,2,1};
int x;
for(x=5;x>=0;x--)
System.out.println(a[x]);
(ix) Find the errors in the program given below
And rewrite the corrected form: [2]
My class
int a;
int b;
void display()
System.out.printIn(a+“ ”+b);
static void display2()
System.out.println(a+“ ”+b);
}
public static void main(String args[ ])
My class ob1=new My class( );
display1().ob1;
display2().ob2;
(x) (a) What is a formal parameter in Java? [1]
(b) What is an actual parameter? [1]
SECTION B (60 Marks) (15X4)
(Answer any four questions from this Section.)
The answers in this section should consist of the programs in either BlueJ
environment. Each program should be written using variable description /
mnemonic codes so that the logic of the Program is clearly depicted.
Flowcharts and algorithms are not required.
Question 3 [15]
Write a program to input 10 integers and find the sum of two-digit as well as three-digit
numbers separately.
AND
Write a program to input 10 integers and check whether all the entered numbers are same or
not.
Question 4 [15]
Define a class to accept a number from user and check if it is an EvenPal
number or not.
(The number is said to be EvenPal number when number is palindrome number
(a number is palindrome if it is equal to its reverse) and sum of its digits is an
even number.)
Example: 121 – is a palindrome number
Sum of the digits – 1+2+1 = 4 which is an even number
Question 5 [15]
Using nested loops write programs to generate the following patterns on the screen:
Question 6 [15]
The following code attempts to search for a target value in an array. Complete the missing part and
answer the questions.
(a) Write the code inside the main method to search arr linearly for target and update index
accordingly. [5]
(b) What will be the output after running the program? [3]
(c) Which search technique is used here? [2]
Question 7
Consider a 2D array mat that needs 2 rows and 3 columns. [15]
(a) Declare and initialize mat with the following values (row-wise):
Row1: 3, 4, 5
Row2: 6, 7, 8
[5]
(b) Write a Java statement to print the element in row 2, column 3 of mat. [3]
(c) What are the values of mat.length and mat[0].length? [2]
Question 8 [15]
Write a program to input 10 numbers into a float type array and arrange the numbers in descending
order using Selection Sorting technique.
AND
Write a program to input 10 numbers into an integer array and arrange the numbers in descending
order using Linear Sorting technique.