Login


Lost your password?

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


Shop
Java All : Array Basics


Exam Papers 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



Exam Paper Problems:5 
Back