Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
Java All : Array Basics


Exam Paper Problems

Integer array – Code error Finding #3909

( As In Exam - ICSE2014 )

Find the errors in the given program segment and re-write the statements corr

Find the errors in the given program segment and re-write the statements correctly to assign values to an integer array.

int a = new int( 5 );
for( int i=0; i<=5; i++ ) a[i]=i;

array.length() and substring() #4065

( As In Exam - ICSE2018 )

Consider the following String array and give the output
String arr[]= {

Consider the following String array and give the output
String arr[]= {“DELHI”, “CHENNAI”, “MUMBAI”, “LUCKNOW”, “JAIPUR”};
System.out.println(arr[0].length()>arr[3].length());
System.out.print(arr[4].substring(0,3));

string array basics #4108

( As In Exam - ICSE2017 )

String x[] = {“SAMSUNG”, “NOKIA”, “SONY” , “MICROMAX”, “BLA

String x[] = {“SAMSUNG”, “NOKIA”, “SONY” , “MICROMAX”, “BLACKBERRY”};
Give the output of the following statements:
i) System.out.println(x[1]);
ii) System.out.println(x[3].length());

integer array length and member addition #4218

( As In Exam - ICSE2016 )

If int x[] = { 4, 3, 7, 8, 9, 10 }; what are the values of p and q?
(i)

If int x[] = { 4, 3, 7, 8, 9, 10 }; what are the values of p and q?
(i) p = x.length
(ii) q = x[2] + x[5] * x[1]

printing reference to an object #4261

( As In Exam - ICSE2015 )

(i) What will the code print?

int arr[] = new int [5]

(i) What will the code print?

int arr[] = new int [5];
System.out.println(arr);

(i) 0 (ii) value stored in arr[0] (iii) 0000 (iv) garbage value

(ii) Name the keyword which is used to resolve the conflict between method parameter and instance variables/fields

Array Filling – Name and Marks – Average and Deviation display #7198

( As In Exam - ICSE2018 )

Write a program to accept name and total marks of N number of students in two

Write a program to accept name and total marks of N number of students in two single subscript 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]

07A-2017 #7262

( As In Exam - ICSE2017 )

Write a program to input integer elements into an array of size 20 and perfor

Write a program to input integer elements into an array of size 20 and perform the following operations:
(i) Display largest number from the array.
(ii) Display smallest number from the array.
(iii) Display sum of all the elements of the array.



Exam Paper Problems:7 
Back