BRINDAVAN’S KID’S UNIVERSITY
Date : 15/11/2024 Subject : computer application
Marks:100 Class : X
Time: 2 hours Name:
__________________________________________________________________
Attempt all questions from Section I and any 4 questions from Section II.
The intended marks for questions or parts of questions, are given in brackets[ ].
________________________________________________________________
SECTION I (40 Marks)
Attempt all questions from this Section
Question 1 [20]
(i)
Consider the above picture and choose the correct statement from the following:
a. Vehicles is the object and the pictures are classes
b. Both vehicles and the pictures are classes
c. Vehicles is the class and the pictures are objects
d. Both vehicles and the pictures are objects
1
(ii) Identify the type of error in the following
code: double a;
a=ob.nextInt();
a. Syntax Error b. Logical error
c. Runtime Error d. No error in the code
(iii) String a[]= {“MI”, “SAMSUNG”, “MICROMAX”, “ONE PLUS”,
MOTOROLA};
Give the output of the following statement:
System.out.println(a[3].replace(‘O’, ‘*’));
a. *NE PLUS b. MICR*MAX
c. M*T*R*LA d. MI
(iv) An array elements are always stored in __________ memory locations.
a. Sequential b. Random
c. Sequential and random d. Binary
(v) Give the output of the following :
int x=2, y=4, z=1;
int result = (++z) + y + (++x) + (++z);
a. 11 b. 12
c. 10 d. 9
(vi) The array int a[] with 7 elements occupy:
a. 40 bytes b. 14 bytes
c. 7 bytes d. 28 bytes
(vii) What is the output of the given
code: double b=-15.6;
double a= Math.round(Math.abs(b));
System.out.println(“a=”+a);
a. 14 b. 16
c. 16.0 d. 17.0
(viii) What will be the output of the following
code: boolean p;
p = (“BLUEJ”.length()> “bluej”.length()) ? true:false;
a. 1 b. 0
c. false d. true
(ix) For a given array int x[]= {11, 22, 33, 44, 55}; the value of a x[1+2] is
a. 11 b. 22
c. 33 d. 44
2
(x) What will this code print?
int arr[] = new int [5];
System.out.println(arr);
a. 0 b. Value stored in arr[0]
c. 0000 d. Garbage value
(xi) What will be the final value stored in variable
x? double x=Math.max(Math.abs(-7.3),7.0);
a. 7.0 b. 7.3
c. 6.0 d. 8.0
(xii) Which of the following declaration and initialization in the below line equivalent
to?
String str= new String();
a. String str= “ ”; b. String str= “ 0”;
c. String str= null; d. String str= “ \0”;
(xiii) Assersion(A) : An argument is a value that is passed to a method when it
is called.
Reason(R) : Variables which are declared in a method prototype to receive
values are called actual parameters.
a. Both assertion(A) and Reason(R) are correct and Reason (R)
is correct explanation of Assertion.
b. Both assertion(A) and Reason(R) are correct but Reason (R) is
not the correct explanation of Assertion.
c. Assertion (A) is true Reason(R ) is false.
d. Assertion (A) is false Reason(R ) is true.
(xiv) Which of the following option is used to find the size of the given
array? char m[] = { ‘R’ , ‘A’, ‘J’, ‘E’, ‘N’ , ‘D’, ‘R’, ‘A’};
a. m.sizeOf(a); b. m.elementsof(m);
c. m.length; d. m.length();
(xv) Assertion (A) while loop is an entry-controlled loop.
Reason ( R ) while loop execute the statements first and then checks
the condition.
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) Which of the following method returns a boolean value?
a. toLowerCase() b. toUpperCase()
c. parseInt() d. isUpperCase()
3
(xvii) Identify the correct array declaration
a. int [] d=new int[9]; b. int d[]=9;
c. int d[]=new int[]; d. int d[9];
(xviii) What will be the output of the following code?
System.out.println(“Lucknow”.substring(0,4));
a. Lucknow b. Luckn
c. Luck d. Luck
(xix) Consider the following code
snippet : if(c>d)
x=c;
else
x=d;
Choose the correct option if the code mentioned above is rewritten using the
ternary operator?
a. x=(c>d)?c:d; b. x=(c>d)?d:c;
c. x=(c>d)?c:c; d. x=(c>d)?d:d;
(xx) The technique in which the change in the formal parameter gets reflected in the
actual parameter is known as:
a. Call by reference b. Call by value
c. Call by argument d. Call by method
Question 2
(i) What is the output of the following code? [2]
char ch = ‘x’;
char ch1=Character.toUpperCase(ch);
int p= (int)ch1;
System.out.println(ch1+ “\t”+p);
(ii) How many times the following loop will execute? [2]
int n=1,i=1;
do
{
n++;
i++;
if(i= =4)
{
n=1;
break;
}
}while(i<5);
System.out.println(“n=”+n);
(iii) Write the corresponding java expression for the following mathematical [2] expression:
= + −
3 2 √
2
4
(iv) Rewrite the following code using while loop: [2]
int x=1, y=2;
for(x=1; x<=14; x++, y +=1)
{
System.out.println(“ “+x++);
}
System.out.println(“Welcome to Java Programming”);
(v) Give the output of the following code snippet: [2]
String s1= “HELLO”, s2= “hello”;
System.out.println(s1.compareTo(s2));
System.out.println(s1.compareToIgnoreCase(s2));
(vi) State the difference between = = and equals() method.
(vi) Write a prototype of function abc which takes a string argument and a character [2]
argument and returns an integer value.
(vii) Give the output of the following code snippet [2]
String color;
String s= “Color”;
color = s.concat(“ “ +” YELLOW”);
System.out.println(s.replace(‘o’, ‘O’);
System.out.println(color.toUpperCase());
(viii) x[]= {5, 4, 3, 4, 7, 8}; [2]
Rohan is considering the above array; he needs to multiply the second element of
the array with sixth element and add the result to the third element. What should
be the correct code for the same? Also write the value after calculation.
(ix) State the datatype and value of b after the following code is executed: [2]
char a= ‘8’;
b=Character.isLetter(a);
(x) State the method. [2]
i. Convert a string to a primitive float data type.
ii. Determines if the specified character is an upper case character.
5
SECTION II (60 Marks)
Attempt any four questions from this section.
Question 3
Write a program in java to accept the name of an employee and his/her annual [15]
income. Pass the name and the annual income to a method Tax(String name, int
income) which displays the name of the employee and the income tax as per the
given tariff:
Annual Income Income Tax
Up to ₹2,50,000 No tax
₹2,50,001 to ₹5,00,000 10 % of the income exceeding ₹2,50,000
₹5,00,001 to ₹10,00,000 ₹30,000+20 % of the income exceeding ₹5,00,000
₹10,00,001 and above ₹50,000+30 % of the income exceeding
₹10,00,000
Question 4
Write a program to accept a set of ten characters in a single dimensional array. [15]
Sort the characters in ascending order by using the Bubble sort technique.
Display the sorted array.
Question 5
The International Standard book number (ISBN) is a unique numeric book [15]
Identifier which is printed on every book the ISBN is a 10-digit code the ISBN is
legal if:
1x digit1 +2 x digit2 +3 x digit3 +4 x digit4 +5 x digit5 +6 x digit6 +7 x digit7 +8
x digit8 +9 x digit9 +10 x digit10 is divisible by 11. For example: for an ISBN
1401601499
Sum = 1 x 1+ 2 x 4 +3 x 0+ 4x 1+5 x 6+ 6 x 0+7 x 1 8 x 4 +9 x 9 + 10 x
9 Sum =253 which is divisible 11
i. Input the ISBN code as a 10-digit integer.
ii. If the ISBN is not a 10-digit integer, output a message “illegal
ISBN” and terminate the program.
iii. If the number is 10-digit, extract the digits of the number and
compute the sum as explained above.
If the Sam is divisible by 11 output the message “Legal ISBN”. If the sum is
not divisible by 11 output the message “Illegal ISBN.”
Question 6
A string is said to be unique if none of the letters present in the strings are
repeated. Write a program to accept a string and check whether the string
is unique or not. The program displays a message accordingly. Sample
input : COMPUTER
Sample output: Unique String
Sample input : APPLICATIONS
Sample output: Not a unique string
Question 7
Write a program in Java to store the numbers in 4x4 matrix in a double
Dimensional Array. Find the sum of numbers of the left diagonal and the sum
of the numbers of the right diagonal of the matrix by using an input statement.
Sample input the numbers of the Matrix are:
12 21 13 14
24 41 51 33
61 11 30 29
59 82 41 76
Sample output
The sum of the left diagonal elements =159
The sum of the right diagonal elements = 135
Question 8
Define a class to accept a string and convert the same to upper case. Create and
display the new string by replacing each vowel by immediate next character and
every consonant by the previous character. The other characters remain the same.
Sample Input: **ComputerScience**
Sample Output :**BPLOVSFQRBJFMBF**
7