0% found this document useful (0 votes)
21 views6 pages

Preboard 1 X

The document outlines an examination paper for Computer Applications at St. Joseph's School, Ambari, consisting of two sections. Section A includes multiple-choice questions, while Section B requires programming tasks to be completed in Java. The paper is designed to test students' knowledge of Java programming concepts and their ability to implement them in code.
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)
21 views6 pages

Preboard 1 X

The document outlines an examination paper for Computer Applications at St. Joseph's School, Ambari, consisting of two sections. Section A includes multiple-choice questions, while Section B requires programming tasks to be completed in Java. The paper is designed to test students' knowledge of Java programming concepts and their ability to implement them in code.
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/ 6

ST.

JOSEPH’S SCHOOL , AMBARI


COMPUTER APPLICATIONS
(Theory)
(Time allowed: Two hours)
(Maximum Marks: 100)
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 the sections from Section A and any 4 from Section B
The intended marks for the questions or parts of questions are given in brackets [ ].

SECTION A
(Attempt all questions from this Section.)
Question 1 [20x1]
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 picture.
(a) Encapsulation
(b) Inheritance
(c) Abstraction
(d) Polymorphism
(ii) The expression which uses > = operator is known as:
(a) relational
(b) logical
(c) arithmetic
(d) assignment

(iii)

(iv) Ternary operator is a:


(a) logical operator
(b) arithmetic operator
(c) relational operator
(d) conditional operator
(v) When primitive data type is converted to a corresponding object of its class, it is called:
(a) Boxing
(b) Unboxing
(c) explicit type conversion
(d) implicit type conversion
(vi) The number of bytes occupied by a character array of 10 elements.
(a) 20 bytes
(b) 60 bytes
(c) 40 bytes
(d) 120 bytes
(vii) The method of Scanner class used to accept a double value is:
(a) nextInt()
(b) nextDouble()
(c) next()
(d) nextInteger()
(viii) Among the following which is a keyword:
(a) every
(b) all
(c) case
(d) each
(ix) The output of Math.round(6.6) + Math.ceil(3.4) is:
(a) 9.0
(b) 11.0
(c) 10.0
(d) 11
(x) Name the type of error, if any in the following statement:
System.out.print("HELLO")
(a) logical
(b) no error
(c) runtime
(d) syntax
(xi) Java statement to access the 5th element of an array is:
(a) X[4]
(b) X[5]
(c) X[3]
(d) X[0]
(xii) Which of the following is the wrapper class for the data type char?
(a) String
(b) Char
(c) Character
(d) Float
(xiii) Name the package that contains wrapper classes:
(a) java.lang
(b) java.util
(c) java .io
(d) java.awt
(xiv) Which of the following is a valid Integer constant:
1. 4 2. 4.0 3. 4.3f 4. “four”
(a) Only 1.
(b) 1. and 3.
(c) 2. and 4.
(d) 1. and 2.

1 TURN OVER
(xv) Assertion(A): In java statements written in lower case letter or upper case letter are treated as the same.
Reason(R): Java is a case sensitive language.
(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
(xvi) 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
(xvii) 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
(xviii) What Will be the output for:
System.out.print(Character.toLowerCase('1'));
(a) 0
(b) 1
(c) A
(d) true
(xix)

(xx)

Question 2
(i) Write the Java expression for (p + q)2 [2]
(ii) Evaluate the expression when the value of x = 2:
x = x ++ + ++ x + x [2]
(iii) Name any two jump statements. [2]

2 TURN OVER
(iv) Sam executes the following program segment and the answer displayed is zero
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); } [2]
(v) Predict the output of the following code snippet:
String a="20";
String b="23";
int p=Integer.parseInt(a);
int q=Integer.parseInt(b);
System.out.print(a+"*"+b); [2]
(vi) When there is no explicit initialization, what are the default values set for
variables in the following cases?
(a) Integer variable
(b) String variable [2]
(vii) int P [ ]={ 12,14,16,18}; int Q[ ]={ 20,22,24};
Place all elements of P array and Q array in the array R one after the other.
(a) What will be the size of array R [ ] ?
(b) Write index position of first and last element? [2]
(viii)

[2]
(ix) Consider the program segment and answer the following question:
class Calculate
{
int a; double b;
Calculate( )
{
a=0; b=0.0;
}
Calculate (int aa, double bb)
{
a=aa; b=bb;
}
}
Name all the type of constructor mentioned in the code segment. [2]

3 TURN OVER
(x)

[2]

SECTION B
(Answer any four questions from this Section.)
The answers in this section should consist of the programs in either BlueJ environment or any
program environment with java as the base.
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
Define a class called with the following specifications:
Class name: Eshop
Member variables:
String name: name of the item purchased
double price: Price of the item purchased
Member methods:
Eshop( ): default constructor to initialize class variable
void accept(): Accept the name and the price of the item using the methods of Scanner class.
void calculate(): To calculate the net amount to be paid by a customer, based on the following criteria:

void display(): To display the name of the item and the net amount to be paid.
Write the main method to create an object and call the above methods. [15]

Question 4
Define a class to overload the method display as follows: 1
void display(): To print the following format using nested loop 1 2
void display(int n): To print the square root of each digit of the given number 1 2 3
Example: n = 4329 output –
1 2 3 4
3.0
1.414213562
1.732050808
2.0 [15]

4 TURN OVER
Question 5

[15]

Question 6
Write a Java program to accept a number from the user and check whether the number is a Spy number
or not.
(Hint: A number is a Spy number if the sum of digits and product of digits are same.)
Example: 1124
1+1+2+4 = 8
1*1*2*4 = 8 [15]

Question 7
Using the switch statement, write a menu driven program to perform following
operations:
(i) To Print the value of Z where

where x ranges from – 10 to 10 with an increment of 2 and Y remains constant at 5.5.


(ii) To print the Floyds triangle with N rows Example: If N = 5,
Output:
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15 [15]

Question 8
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 all the even numbers in the range of A and B.
Sample input: A=4 and B=16 Sample output: sum = 4 + 6 + 8 + 10 + 12 + 14 + 16
(ii)double Sum( double N ) – with one double arguments(N) calculate and return
the product of the following series:
sum = 1.0 x 1.2 x 1.4 x …………. x N
(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
Write the main method to create an object and invoke the above methods. [15]

5 END

You might also like