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

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

This document contains questions related to arrays in Java. It has three sections - Section A contains 10 multiple choice questions related to arrays, their properties, methods and sorting. Section B contains 9 programming questions to test skills with single and multi-dimensional arrays. The questions cover array initialization, traversal, merging, equivalence checking, salary calculation, removing duplicates and sorting arrays. Students are required to write Java code for the questions in Section B to demonstrate their understanding of arrays.

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)
69 views2 pages

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

This document contains questions related to arrays in Java. It has three sections - Section A contains 10 multiple choice questions related to arrays, their properties, methods and sorting. Section B contains 9 programming questions to test skills with single and multi-dimensional arrays. The questions cover array initialization, traversal, merging, equivalence checking, salary calculation, removing duplicates and sorting arrays. Students are required to write Java code for the questions in Section B to demonstrate their understanding of arrays.

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) How to initialize your school name in character array?
b) What are the difference between Linear array and Two Dimensional array?
c) What is meant by index of an element?
d) What is array? How to declare a staring array of 10 elements in Java?
e) Following integers are to be sorted in ascending order using selection sort technique, write the
sequences 97,28,29,64,58,62,86
Ques 2
a) Write any two differences between String and Array?
b) Write a function prototype that accept two integer SDAs and return Boolean.
c) A SDA contains M elements. What will be the second last subscript?
d) Write Java statement to create a SDA which stores vowels of English alphabet.
e) What are the disadvantages of array?
Ques 3
Write the output of following program segments-
a) String ar[ ]={"DELHI","CHENNI","MUMBAI", “LOCKNOW”, “JAIPUR”};
System.out.println(ar[0].length>a[3].length);
System.out.println(ar[4],substring(0,3));
b) int a[ ]={160,150,140,130,220,210};
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]);
}
c) int a[]=new int[10];
for(int i=0;i<=9;i+=2)
a[i]=2*(i+1);
for(i=9;i>=0;i--)
System.out.println( a[i]);
d) double D[]= {45,38,27,12,32,34,45};
for(int i=0;i<7;i+=1)
if( D[i]%9==0)
System.out.println(D[i]);
e) int y[]= {24,35,18,19};
int p=0;
for(int i=0;i<y.length;i++)
{
p =y[i]+y[3-i];
System.out.println(p);
}
f) int V[] = {19,25,17,15,44};
int P[] = {21};
V[1] = V[3];
int p=P[0]+V[1]*3;
System.out.println(p);
g) int a[ ]={17,10,9,18,7};
a[4]=++a[3];
a[4]=a[1]-a[2]++;
System.out.print(a[3]+” “+a[4]);
h) int m[] = {10,21,14,26,28};
System.out.println(m[1] + " " + m[2]+” ”+(m[1+3]));
i) 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]);
}
j) 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]);
}
SECTION – B[Any 4]
(Comment lines and variable description must be given with the code)

Ques 4
Write a program to accept name and total marks of N number of students in two single subscripts array
name[] and totalmarks[].
Calculate and print:
(i) The average of the total marks obtained by N number of students.
[average = (sum of total marks of all the students) / N]
(ii) Deviation of each student’s total marks with the average.
[deviation = total marks of a student – average]

Ques 5
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.
Ques 6
Write a program that create two different arrays and check they are equivalent or not.
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 an integer array and removed duplicate from it , then display the new array.
Ques 9
Write a program in Java to accept an array that contains +ve, -ve and zero(0). Swap the negative elements
at the beginning of the array, followed by zero(0) and Positive elements without changing their sequence.
Example : INPUT : 3,5,-5,7,0,-2,-1,4,8,-3
OUTPUT : -5,-2,-1,-3,0,3,5,7,4,8

You might also like