Você está na página 1de 2

https://sites

https sites.google
sites google.com
google com/site
com site/javaprogramsisc
site javaprogramsisc/
javaprogramsisc ICSE Questions 30

245 Differentiate between Binary Search and Linear Search.


2007, 2011, 2011SP

246 Name the search or sort algorithm that:


(i) Makes several passes through the array, selecting the next smallest item in the array
2012
each time and placing it where it belongs in the array.
(ii) At each stage, compares the sought key value of the middle element of the array.
247 State the total size in bytes, of the arrays a[4] of char data type and p[4] of float data type. 2011
248 What is an array? Write a statement to declare an integer array of 10 elements. 2012
249 Name the keyword that is used for allocating memory to an array. 2009
250 Which element is num[9] of the array num? 2005
251 Find and correct the errors in the following program segment:-
int n[ ] = ( 2, 4, 6, 8, 10 );
2006
for(int i=0; i<=5; i++)
System.out.println(“n[ ” + i + “ ] = ” + n[i] );
252 If, array[ ]={ 1, 9, 8, 5, 2 };
(i) What is array.length( )? 2008
(ii) What is array[2]?
253 Given that int x[ ][ ]={ {2, 4, 6}, {3, 5, 7 } };
2009
What will be the value of x[1][0] and x[0][2]?
254 Write the difference between length and length( ) functions. 2010
255 Find errors in the given program segment and re-write the statements correctly to assign
values to an integer array.
int a = new int(5); 2014
for(int i=0; i<=5; i++)
a[i] = i;
256 If int n[ ] = { 1, 2, 3, 5, 7, 9, 13, 16 }, what are the values of x and y?
x = Math.pow( n[4], n[2]); 2013
y = Math.sqrt( n[5] + n[7]);
257 Give the output of the following program code:
char arr[ ] = { ‘a’, ‘b’, ‘c’, ‘A’, ‘B’, ‘C’ };
char abb[ ] = arr;
System.out.println(Math.pow(arr.length, 3));
System.out.println(arr[0] = = arr[3]);
System.out.println(abb = = arr);
258 Determine the errors and correct them.
a. int a [4] = {4,2,3,6,1,7};
b. int mat [4,4] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,};
259 Find and correct the errors in the
following program segment:
int a[ ] = new int[5];
A[ ] = { 12,61,95,10,45};
For (I = 0; i<5; I ++)
System.out.println (“a[“ +I + “] =”+a[i]);
https://sites
https sites.google
sites google.com
google com/site
com site/javaprogramsisc
site javaprogramsisc/
javaprogramsisc ICSE Questions 31
260 What will be the output of the following part of a program?
int x[ ] = { 4,8,9,15};
int y[ ] = { 6,91,48,5,28};
x=y;
System.out.println (“x[1] =” + x [1]);
261 What will be the output of the following part of a program?
int a[ ]={2,4,6,8,10};
for(int i=0;i<=1;i++)
{
int s=a[i]+a[3-i];
System.out.println(s);
}
262 Write Java statement for the following –
a. To count number of elements present in the array Arr[ ].
b. To print sum of the first and the last element of one dimensional array Arr[ ].
c. To define an array to store the grades (A, B or C) of 45 students of a class.
d. To count the total number of elements of an array Arr[ ] and to store it in the variable
len.
e. To initialize all elements of a one dimensional array Arr[ ] of size 6 of byte type by 0.

Você também pode gostar