Computer Application Class - X Test - 3 Total - 50 Time 1:20 Section - A
Computer Application Class - X Test - 3 Total - 50 Time 1:20 Section - A
SECTION –A
Question 1: Predict output of the following:
a) int m[] = {1,2,4,6,8};
System.out.println(m[1] + " " + m[2]+” ”+(m[3]+m[0]));
b) int [] array = {21,26,22,24,28,20};
for(int i=0;i<array.length-1;i++){
if(array[i]<array[i+1])
{
int temp= array[i];
array[i]=array[i+1];
array[i+1]=temp;
}
System.out.println(array[i]);
}
c) int y[]= {14,15,18,19};
int p=0;
for(int i=0;i<y.length;i++)
{
p =y[i]+y[3-i];
System.out.println(p);
}
d) String ar[ ]={"kolkata","gangtok","bangalore"};
for(int i=0;i<ar.length;i++)
{
ar[i]=arr[i].substring(0,1).toUpperCase( )+arr[i].substring(1);
System.out.println(ar[i]);
}
e) int mat[][] = { { 1, 2, 3, 4 },{ 3,2,4,5 }, { 9, 11, 12, 10 } };
for (int[] row : mat)
for (int x : row)
System.out.print(x + " ");
Question 2:
a) What are the disadvantages of array?
b) What are the difference between sorting and searching?
c) What are the difference between bubble sort and selection sort?
d) How many bytes need to store array char ch[10] and int arr[10][10]?
e) Write the prototype of a function search which takes two arguments an array of string and a string and
returns an integer value.
Question 3:
The annual examination result of 50 students in a class is tabulated in different Single Dimensional Arrays
(SDA) are as follows:
Roll No. Subject A Subject B Subject C
Write a program to read the data, calculate and display the following:
(a) Average marks obtained by each student.
(b) Print the roll number and the average marks of the students whose average is above. 80.
(c) Print the roll number and the average marks of the students whose got position 1 st and 2nd.
Question 4:
Write a Java Program that accepts Customer and their mobile number in two separate SDA. Now display
Name with their mobile number alphabetically.
Question 5:
Write a program to store 20 names of world class batsmen with their countries name and respective total
number of centuries in different SDA. The user wants to enlist the cricketers by entering the first letter of a
particular country viz. ‘I’ for India, ‘E’ for England and so on. The program to perform the above task. If found
the display name of the players with numbers of centuries and country, otherwise display “Unsuccessful,
Name not enlisted”
Question 6:
Write a Java program to find the duplicate values of an array of string values.