Class – X
Subject – Computer Application
Subject – Computer Application
Marks: 100
Time: 2 hours
This paper is divided into two Sections. The intended marks for questions or parts of question are given in brackets [ ].
_______________________________________________________________________________________________
Section A
Question 1. [2 marks each]
1. What is the result of:
a. Math.abs(q++* -2) if q=3
b. char c=’E’; short m = 26; int n = c+m; System.out.println(n);
2. How are objects passed to functions? Give an example.
3. What is the difference between an array and a String?
4. Find the output:
a. System.out.println(”WONDERFUL”.substring(6));
b. System.out.println(“BRAVO”.indexOf(‘a’,3));
5. How do objects pass messages to each other?
Question 2. [2 marks each]
1. What is the difference between abstraction and encapsulation?
2. What is meant by private visibility of a method?
3. Explain function overloading with an example.
4. Define the term array. How are arrays declared?
5. How is an interface declaration different from a class declaration?
Question 3. [2 marks each]
1. What is the function of a return statement?
2. What is a stream? State the two types of streams.
3. What is meant by an exit-controlled loop? Give an example.
4. Explain the concept of try-catch-finally in Java.
5. Rewrite the following code using the switch case statement:
char code;
code=(char) obj.read( );
if (code == ‘A’)
System.out.println(“Grade I”);
else
if (code == ‘B’ || code == ‘C’)
System.out.println(“Grade II”);
else
if (code==’D’)
System.out.println(“Grade III”);
Question 4.
1. Read the program segment given below and answer the questions:
public void sample ( )
{
int ctr;
for(ctr = 1; ctr <=4; ++ctr)
{
int u = func(ctr);
System.out.print (u + “ “);
}
}
int func(int k)
{
int z=0;
z+=k;
return z;
}
a. Give the output of the above code snippet. [2 marks]
b. Identify the formal parameters and the actual parameters. [1 mark]
c. What is the function prototype of the called function? [1 mark]
2. Explain the general form of a class. [2]
3. Explain the operators used below and write the result : [4]
i) 5 & 7
ii) 13 ^ 5
iii) 23 << 2
iv) 9 >>> 1
Section B
Attempt any five questions from this section. Each program carries 12 marks. Each program should be written using variable descriptions /mnemonic codes such that the logic of the program is clearly depicted.
1. Input the names of n cricketers and the number of one day matches they have played till date into two separate one dimension arrays. Sort the arrays in alphabetical order of names using selection sort. Find the number of players who have played more than 200 matches.
2. Define a class for Electricity Board that initializes the data members using constructors. Data members: month, name of the consumer, consumer number, previous meter reading, present meter reading and net bill.
Methods:
i) Calculate the number of units consumed in the month.
ii) Calculate the charge based on the number of units consumed
No of units Charge
first 100 units 90 paisa per unit
next 120 units Rs. 1.45 for every additional unit
otherwise Rs. 2.25 for every additional unit
iii) Calculate net bill - a meter rent of Rs. 500 is charged from each consumer. A tax of 12% is charged on the sum of the rent and the bill amount. The total amount is calculated by adding tax to the sum of the amount and the rent. If the consumer is working in the board, he will get a concession of 3.5 % on the total amount.
iv) Display the details of the consumer.
3 Input a sentence and display each word of the string in the reverse order. Also find the frequency of the word “is” in the string.
4. Write a menu driven program using functions to find whether a given number is:
a. Automorphic
b. Prime Palindrome
5. Compute and print the roots of a quadratic equation of the form ax2 + bx + c= 0. Print
whether the roots are equal, real and distinct or imaginary.
6. Calculate and print the sum of the squares of odd numbers and the sum of the cubes of even numbers separately for as many numbers as the user wishes to enter.
By Prof. Mahendra Kanojia
0 comments:
Confused? Feel free to ask
Post a Comment