0% found this document useful (0 votes)
67 views2 pages

Computer Application - X Test 5 Total - 100 Time:2:00H

This document contains a computer application test with 9 questions covering arrays in Java. The test has two sections - Section A with multiple choice and true/false questions about one-dimensional and multi-dimensional arrays. Section B asks to write code for 4 out of the 9 questions provided, including programs to calculate student marks and salaries, search arrays, merge arrays, and check if arrays are equivalent.

Uploaded by

AtanuBhandary
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views2 pages

Computer Application - X Test 5 Total - 100 Time:2:00H

This document contains a computer application test with 9 questions covering arrays in Java. The test has two sections - Section A with multiple choice and true/false questions about one-dimensional and multi-dimensional arrays. Section B asks to write code for 4 out of the 9 questions provided, including programs to calculate student marks and salaries, search arrays, merge arrays, and check if arrays are equivalent.

Uploaded by

AtanuBhandary
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

COMPUTER APPLICATION –X TEST 5 TOTAL -100 TIME :2:00H

SECTION A

Ques 1
a) A SDA contains M elements. What will be the second subscript?
b) Write Java statement to create a SDA which stores names of the continent of world.
c) Write any two differences between String and Array?
d) Write a function prototype that accept two integer SDAs and return Boolean.
e) What are the disadvantages of array?
Ques 2
a)Differentiate between subscript and subscript variable.
b) How one dimension array is different from double dimension array?
c) What is the difference between linear and binary search?
d) What do you mean be arrayindexoutof Bound?
e) How much memory is requied for following array.
i) int[4] ii) short[4][2]
Ques 3
Write the output of following program segments-
a) int a[ ]={1,2,3,4,5,6};
for(i=0;i<5;i++)
{
a[i]=a[i+1]+a[i];
a[i+1]=a[i]-a[i+1];
a[i]=a[i]-a[i+1];
}
for(i=0;i<6;i++)
{
System.out.print(a[i]);
}
b) int a[ ]={17,10,9,18,7};
a[4]=++a[3];
a[4]=a[1]-a[2]++;
System.out.print(a[4]+” “+a[3]);
c) int a[]=new int[6];
a[0]=20;
a[1]=30;
for(i=2;i<6;i++)
{
a[i]=a[i-1]+a[i-2];
}
for(i=0;i<6;i++)
System.out.println(a[i]);
d) int a[]={3,10,15,20,25};
int i,j,k=1,m;
i=++a[0];
j=++a[2];
m=a[++i];
System.out.println(i+” “+” “+j+m);
e) int m[] = {10,21,14,26,28};
System.out.println(m[1] + " " + m[2]+” ”+(m[1+3]));
f) int a[]=new int[5];
for(int i=0;i<5;i++)
a[i]=3*(i+1);
for(i=0;i<5;i++)
System.out.println( a[i]);
g) 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]);
}
h) int y[]= {214,515,118,919};
int p=0;
for(int i=0;i<y.length;i++)
{
p =y[i]+y[3-i];
System.out.println(p);
}
i) String ar[ ]={"kolkata","gangtok","bangalore"};
for(int i=0;i<ar.length;i++)
{
ar[i]=ar[i].substring(0,1).toUpperCase( )+ar[i].charAt(1);
System.out.println(ar[i]);
}
j) String ar[ ]={"DELHI","CHENNI","MUMBAI", “LOCKNOW”, “JAIPUR”};
System.out.println(ar[0].length>a[3].length);
System.out.println(ar[4],substring(0,3));
SECTION – B[Any 4]
(Comment lines and variable description must be given with the code)

Ques 4
The marks obtained by N students in a subject are tabulated as follows:-
Name Marks
.. ..
.. ..
Write a program to input the names and marks of the students in the subject.
Calculate and display:-
(i) The subject average marks ( subject average marks = subject total / N )
(ii) The highest mark in the subject and the name of the student (The maximum marks in the subject are
100)
Ques 5
Write a program in Java to create an array and store N numbers in it. Print those numbers which are even
as well as divisible by 5 along with their locations.

Ques 6
Write a program to initialize the seven Wonders of the World along with their locations indifferent arrays.
Search for a name of the country input by the user. If found, display the name of the country along with its
Wonder, otherwise display “Sorry Not Found”.
Seven Wonders - CHICHEN ITZA, CHRIST THE REDEEMER, TAJ MAHAL, GREAT WALL OF CHINA, MACHU
PICCHU, PETRA,COLOSSEUM
Locations – MEXICO, BRAZIL, INDIA, CHINA, PERU, JORDAN, ITALY
Example – Country Name : INDIA Output : INDIA - TAJ MAHAL
Country Name : USA Output : Sorry Not Found
Ques 7
Write a program to create three single dimensional arrays empcode[](integer), sal[](double), spl[](double)
to store employee code, monthly salary and special allowance of N employees. Calculate the total monthly
salary (sal+spl) and annual salary of each employee. Print the salary details in tabular form including all the
data. At the end print total of monthly salary and total of allowances of all employees.
Ques 8
Write a program that create two different arrays and check they are equivalent or not.
Ques 9
Write a program that create two different arrays and merge two arrays into another array in following
ways :
arr1[ ] = {1, 2, 3, 4, 5, 6}; //first array. arr2[ ] = {7, 8, 9, 0}; //second array.
arr3[ ] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0} //resultant array.

You might also like