0% found this document useful (0 votes)
33 views3 pages

ICSE - 10th Test 5 Array

This document is a test paper for Class IX Computer Application (Java) focusing on arrays, consisting of multiple-choice questions and programming tasks. Section A contains 10 MCQs worth 20 marks, while Section B includes programming questions worth 30 marks, covering topics like sorting algorithms and array manipulations. The test assesses students' understanding of Java arrays, including their properties, operations, and error handling.

Uploaded by

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

ICSE - 10th Test 5 Array

This document is a test paper for Class IX Computer Application (Java) focusing on arrays, consisting of multiple-choice questions and programming tasks. Section A contains 10 MCQs worth 20 marks, while Section B includes programming questions worth 30 marks, covering topics like sorting algorithms and array manipulations. The test assesses students' understanding of Java arrays, including their properties, operations, and error handling.

Uploaded by

rihapew773
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JMD-HGGM YP COMPUTER CLASSES Class-IX

***************************************************************************************************************************************************
Computer Application (Java)
YPCC Test 5th
Date: __________ Class – 10th
Time: 1:00 hr. M.M : 50
Topics: Ch→ Array
___________________________________________________________________________
Attempt all questions from Section A
___________________________________________________________________________
SECTION A (20 Marks)
Attempt all questions from this part.
Question 1 Tick the correct answers: [10]
(i) What will this code print ?
int arr[] = new int[5];
System.out.println(arr);
a) 0 b) 00000
c) value stored in arr[0] d) Garbage Value

(ii) When does the ArrayIndexOutOfBounds Exception occur ?


a) At compile time
b) At run time
c) It is not an error
d) It is not an exception at all

(iii) The statement …………………….


weight[ ] = {26,28,32,31};
a) Assigns 28 to weight[0] b) Assign 28 to weight[1]
c) Assign 32 to weight [3] d) None of these

(iv) Assuming int takes 4 bytes of memory, what is the size of int arr[15]
a) 15 bytes b) 19 bytes
c) 11 bytes d) 60 bytes

(v) How many of the following are legal declarations?


char [] dog = new char[ ];
char [] tiger = new char[ 1];
char [] horse = new [ ]char;
char [] cat = new [1] char;
a) One b) Two
c) Three d) Four

(vi) In java, arrays are ……………………….


a) Objects b) Object references
c) Primitive data type d) None of these

(vii) We can determine the length of an array using …………….. .


a) array.length() b) array.len
c) array.sizeof() d) array.length

***************************************************************************************************************************************************
Please Read Q Carefully www.YpComputerClasses.in (: 7798161873) P→1
JMD-HGGM YP COMPUTER CLASSES Class-IX
***************************************************************************************************************************************************
(viii) Write a valid statement to declare a single dimensional array of 5 integers.
a) int arr[] = new int[5]; b) int arr[6] = new int[6];
c) int arr[4] = new int[4]; d) None of these

(ix) What is printed by the below statements?


int num[] = {3,5,10,12,18};
System.out.println(num[2]+”\t”+num[1]+”\t”+num[3]+”\t”+num[4-2]);
a) 3 5 10 12 b) 10 5 12 10
c) 5 10 12 8 d) None of these

(x) Write a set of statements that would find and print the size of array.
ar[] = {2,5,6,7,8,9,10};
a) int len = ar.length;
System.out.println(“The size of array =”+len);
b) int len = ar.length();
System.out.println(“The size of array =”+len );
c) int len = ar.len;
System.out.println(“The size of array =”+len);
d) None of these

Question 2 [10]
(i) What are the difference between bubble sort and selection sort?
(ii) Given the array 24, 4, 19, 6, 12, 15, 30, 20. Show the state of array 3 passes of bubble sort
technique with ascending order.
(iii) If int[] n = {1, 2, 0, 5, 7, 9, 13, 16} what are the values of x and y?
x = Math.pow(n[4], n[2]);
y = Math.sqrt(n[5] + n[7]);
(iv) Find and correct the errors in the following program segment :-
int n[ ] = (2,4,6,8,10);
for(int i = 0; i<=5; i++)
System.out.println("n[" + i + "] = " + n[i]);
(v) Find the output
int ar[ ] = {1, 2, 3, 4, 5};
int i = 2;
ar[i] += ar[i++] + 10 - ++ar[i-1];
for(i=1; i<=3; i++)
System.out.println( ar[i] + “,” );

Section B (30 Marks)


Attempt any two questions from this part.
Question 3
Define a class to declare an array of size N of double datatype, accept the elements into the
array and perform the following:
• Calculate and print the sum of the elements who ends with 7.
• Calculate and print the second highest value of the array. [15 marks]

***************************************************************************************************************************************************
Please Read Q Carefully www.YpComputerClasses.in (: 7798161873) P→2
JMD-HGGM YP COMPUTER CLASSES Class-IX
***************************************************************************************************************************************************
Question 4
Write a program in java to initialize an array of 10 elements in ascending order. Ask the user to
enter a value and find the value in the array using Binary search method and display appropriate
message.

Question 5
Write a program to input 15 fractional elements in array and sort then in descending order using
the selection sort technique.

***************************************************************************************************************************************************
Please Read Q Carefully www.YpComputerClasses.in (: 7798161873) P→3

You might also like