Search Header Logo

Arrays

Authored by Ayesha Abdullah

Computers

Professional Development

Used 22+ times

Arrays
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Is String a primitive data type?

Yes

No

Both

2.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Which method to use to find length of an array?

length

size

long

count

3.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

int[] myArray = {11, 22, 33, 44, 55};

which code is correct to print length of above int-array?

System.out.println(int[].myArray.length());

System.out.println(myArray.length);

System.out.println(myArray.length());

System.out.println(int[].myArray.size());

4.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

String[] friends = {"John", "Mike", "Samantha", "Monica"};

which code is correct to print "Samantha" using array functionality?

System.out.println(friends[2]);

System.out.println(friends[3]);

System.out.println(friends["Samantha"]);

System.out.println(friends{2});

5.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Select correct code to create an array of "double" datatype of length 5.

double arr = double[5];

double{} arr = new double{5};

double[5] arr = new double[];

double[] arr = new double[5];

6.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

What is the correct relation between length and last-index of array?

last-index is always 1 more than the length

last-index is 1 less than the length (but not always)

last-index is always 1 less than the length

last-index is always equal to the length

7.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Consider the following code segment.

int[]arr={1, 2, 3, 4, 5, 6, 7};

for(int k=3; k<arr.length-1;k++) {

Arr[k]=arr[k+1];

}

Which of the following represents the contents of arr as a result of executing the code segment?

{1, 2, 3, 4, 5, 6,7}

{1, 2, 3, 5, 6,7}

{1, 2, 3, 5, 6, 7,7}

{1, 2, 3, 5, 6, 7,8}

{2, 3, 4, 5, 6, 7,7}

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?