One Dimensional Array

One Dimensional Array

University

10 Qs

quiz-placeholder

Similar activities

The AI Shield

The AI Shield

University

15 Qs

Unit 28 - Quiz #1

Unit 28 - Quiz #1

University

15 Qs

PROBLEM SOLVING USING R  UNIT I  MCQS

PROBLEM SOLVING USING R UNIT I MCQS

University

15 Qs

Prak MC

Prak MC

University

15 Qs

Quiz on Basics of C

Quiz on Basics of C

University

10 Qs

استعني علي الشقا بالله

استعني علي الشقا بالله

University

10 Qs

CHAPTER 5 ONLINE QUIZ

CHAPTER 5 ONLINE QUIZ

University

9 Qs

Javascript

Javascript

University

12 Qs

One Dimensional Array

One Dimensional Array

Assessment

Quiz

Computers

University

Hard

Created by

Thomas Martinez

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the possible output of the following code?

String[] strings = new String[2];

System.out.println(strings);

[null, null]

[ , ]

String@74a14482

None of the above

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How many lines does the following code output?

String[] days = new String[] { “sun”, ”mon”, ”tue”, ”wed”, ”thr”, ”fri”, ”sat”, ”sun”} ;

for(int i =1;i<=days.length ;i++)

System.out.println (days[i]);

six

seven

The code does not compile

The code compiles but throws an exception at runtime

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How many dimensions does the array reference moreBools allow?

boolean[][] bools[], moreBools;

one dimension

two dimensions

three dimensions

none of the above

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

If an index value is less than 0 or greater than or equal to 'array name'.length in an array element access expression, an . . . . . . is thrown.

ArrayOutOfBoundsException

ArraysIndexOutOfBoundsException

ArrayIndexOutOfBoundsException

ArrayIndexIsOutOfBoundsException

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

To declare a one-dimensional array, you will use this general form

type[] array-name = new [size];

type[size] array-name = new type[];

type[] array-name = new type[size];

type[] array-name = type[size];

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these array declaration statements are not legal?

int[ ][ ] i = { { 1, 2 }, { 1 }, {}, { 1, 2, 3 } };

int[ ] x = new int[2] {1, 2};

int[ ][ ] x = new int[ ][ ] { {1, 2, 3}, {4, 5, 6} };

int[ ][ ] x = { { 1, 2 }, new int[ 2 ] };

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these operators is used to allocate memory to array variables in Java?

malloc

alloc

new

new malloc

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?

Discover more resources for Computers