|| Jai Sri Gurudev ||
BGS WORLD SCHOOL
Mahalakshmipuram, Bangalore-86
2024-2025
SESSION-II
SUBJECT: COMPUTER APPLICATIONS
GRADE: X TOPIC: Arrays TOTAL MARKS: 20
Question1
Choose the correct answer. [6]
1) Java statement to access the 5th element of an array is:
a) x[4] b) x[5] c) x[3] d x[0]
2) Which among the following is/are the correct way(s) to create an integer array of
size 40?
a) int a[]=new int[-40] b) int a[] = new int[40]
c) int a[] = new int[0-40] d) int a[40] = new int[ 40]
3) If a blank array is created with type double, the contents of the array pockets will
be:
a) 0 b) 0.0 c) NULL d) space
4) The algorithm in which the middle index is found and the array is divided into
halves to search for an element is called:
a) linear search b) bubble sort c) selection sort d) binary search
5) The element in x[4] of the array [3,5,12,16,18,20,42,89] is :
a) 16 b) 12 c) 7 d) 18
6) In java arrays are:
a) objects b) primitive types c) references d) pointers
Question 2
1) Write the output for the below codes.
a) class A1 [2]
{
public static void main()
{
int arr[] = {5,10,15,20,25};
int s=0;
for (int i=0; i<arr.length; i++)
{ arr[i]=arr[i]-1;
s=s+arr[i];
}
System.out.println(s); }}
|| Jai Sri Gurudev ||
b) String x[] = { “ artificial intelligence”, “IOT”, “machine learning”, “big data”}; [2]
Give the output of the following statements:
i) System.out.println(x[3]);
ii) System.out.println(x.length);
2) State the total size in bytes, of the arrays a[4] of char data type and p[4] of float data
type. [2]
3) What are the values in A after multAll(3) executes ? [2]
private int[]A ={ 1,3,-5,-2};
public void multAll(int amt)
{
int i=0; while (i<A.length)
{
A[i] = a[i]* amt;
i++;
}}
Question 3 (Any two) [6]
1) Write a program to accept 15 integers from the keyboard, assuming that no integer
entered at a zero. Perform bubble sort on the integers and print them in ascending
order.
2) Write a program to input and store integer elements in a double dimensional array
of size 3*3 and find the sum of diagonals.
3) Write a program to search for an integer value input by the user in the sorted list
below using binary search technique. If found, display “search successful” and print
the element otherwise display search unsuccessful.
********