Java Arrays and Multidimensional Arrays Interview MCQ Questions and Answers | MCQ Questions and Answers on Java Arrays and Multidimensional Arrays

SoftwareTechIT ProductSellerMarket
10 min readSep 21, 2022

2

blog.softwaretechit.com
home.softwaretechit.com

Study and learn Interview MCQ Questions and Answers on Java Arrays and Multidimensional Arrays. Attend job interviews easily with these Multiple Choice Questions. You can print these Questions in default mode to conduct exams directly. You can download these MCQs in PDF format by Choosing Print Option first and Save as PDF option next using any Web Browser.

Go through Java Theory Notes Arrays and Multidimensional Arrays before reading these objective questions.

1) An Array in Java is a collection of elements of ___ data type.

A) Same

B) Different

C) -

D) -

Answer [=]

A

2) The Java Virtual Machine (JVM) implements arrays as ___ type.

A) Primitive

B) Object

C) -

D) -

Answer [=]

B

Explanation:

That is the reason why Java Array has predefined methods.

3) Unlike C-Arrays, the Java-Arrays have ___.

A) Names

B) Values

C) Methods and Fields

D) None

Answer [=]

C

4) An array declaration in Java without initialization ___ memory.

A) Does not allocate

B) Allocates memory

C) -

D) -

Answer [=]

A

Explanation:

Only initialization causes memory to be allocated.

5) In Java language, an array index starts with ___.

A) -1

B) 0

C) 1

D) Any integer

Answer [=]

B

6) Which are the special symbols used to declare an array in Java?

A) Braces { }

B) Parentheses ()

C) Square Brackets [ ]

D) Angled Brackets < >

Answer [=]

C

7) Which are the special symbols used to initialize an array at the time of the declaration itself?

A) Parentheses ( )

B) Square Brackets [ ]

C) Braces { }

D) Angled Brackets < >

Answer [=]

C

Explanation:

int[] nums = {1,3,6};

8) It is possible to skip initializing some elements of the array during Shorthand Initialization. (TRUE / FALSE)

A) FALSE

B) TRUE

C) -

D) -

Answer [=]

A

Explanation:

No, you can not skip any elements. All elements need to be initialized in one go or at the same time.

9) In Java, an array can be declared without initialization without mentioning the size. (TRUE / FALSE)

A) TRUE

B) FALSE

C) -

D) -

Answer [=]

A

Explanation:

It is a Lazy initialization of an array.

Also read :Introduction to development approach SSAD and OOAD MCQ OOSE MCA(MANAGMENT) by SoftwareTechIT

10) What is the output of the below Java code snippet with arrays?

static int[] nums;

public static void main(String args[])

{

System.out.println(nums.length);

}

A) 0

B) null

C) Compiler error

D) Runtime Exception — Null Pointer Exception

Answer [=]

D

11) What is the output of the below Java program?

int[] marks = {35,65,95};

System.out.print(marks.length + “,” + marks[1]);

A) 2,65

B) 3,95

C) 3,65

D) Compiler error

Answer [=]

C

Explanation:

Array index starts with Zero (0). So marks[1] represents the second element.

12) What is the output of the below Java code snippet?

int[] balls = {};

System.out.print(balls.length);

A) 0

B) -1

C) 1

D) Compiler error

Answer [=]

A

13) Which is the correct way of knowing Array Size in Java?

A)

//int[] ary;

ary.length()

B)

//int[] ary;

ary.length

C)

//int[] ary;

ary->length()

D)

//int[] ary;

ary->length

Answer [=]

B

Explanation:

“length” is a field, not a method. So, parentheses are not required.

14) What is the output of the below Java program with arrays?

String[] colors = {“RED”;”YELLOW”;”WHITE”};

System.out.print(colors[2]);

A) RED

B) YELLOW

C) WHITE

D) Compiler error

Answer [=]

D

Explanation:

Array elements must be separated with Comma(,)s.

15) What is the output of the below Java program with arrays?

public class Polo {

public static void main(String args[])

{

String[] computer = {“RAM”,”HDD”,”MOUSE”};

String[] parts = {computer[0],computer[2]};

System.out.print(parts[1]);

}

}

A) RAM

B) HDD

C) MOUSE

D) Compiler error

Answer [=]

C

16) What is the output of the below Java program?

int ages[3] = {25, 27, 30};

System.out.println(ages[1]);

Also read :Current trends in Software Engineering oose mcq mca(managment) by SoftwareTechIT

A) 25

B) 27

C) 30

D) Compile error

Answer [=]

D

Explanation:

We should not mention the array size at the time of Shorthand Initialization.

Error: Unresolved compilation problem:

Syntax error on token “3”, delete this token

So make it like

int ages[] = {25, 27, 30};

17) We should not specify the array size if declaration and initialization are done at the same time. (TRUE / FALSE)

A) FALSE

B) TRUE

C) -

D) -

Answer [=]

B

Explanation:

WRONG:

int ary[2]={34,45};

RIGHT:

int ary[] ={34,45};

18) If an index of an element is N, what is its actual position in the array?

A) N-1

B) N

C) N+1

D) N+2

Answer [=]

C

Explanation:

Array index starts with 0. So, an index of 6 means 7th position. An index of N means, N+1 position.

19) An array in Java can be declared only of some predefined types. (TRUE/FALSE)

A) FALSE

B) TRUE

C) -

D) -

Answer [=]

A

Explanation:

An array can be of any data type, primitive or Object type.

20) The name of an array variable or identifier can start with ___.

A) A letter

B) Underscore ( _ )

C) Dollar Symbol ($)

D) All

Answer [=]

D

21) Shorthand array initialization in Java needs the keyword “new” to allocate memory to the array and elements. State TRUE or FALSE.

A) FALSE

B) TRUE

C) -

D) -

Answer [=]

A

Explanation:

Only lazy initialization of array needs the keyword “new” to allocate memory.

22) Lazy initialization of array requires the keyword “new” to allocate memory to the array and its elements. State TRUE or FALSE.

A) FALSE

B) TRUE

C) -

D) -

Answer [=]

B

Explanation:

int[] ary;

ary = new int[5];

23) What is the default value of an element of Object type array?

A) 0

B) null

C) -1

D) Garbage value

Answer [=]

B

Explanation:

Objects can be String, ArrayList, HashMap, HashSet etc.

Also read :Neural Network msc(cs) mcq by SoftwareTechIT

24) What is the default value of byte, short, int or long data type elements of an array in Java?

A) -1

B) 1

C) 0

D) Garbage value

Answer [=]

C

25) What is the default value of float or double data type elements of an array in Java?

A) 0

B) 0.0

C) 1

D) 1.0

Answer [=]

B

advjava

Advance JAVA mcq msc(ca) | advanced java objective questions | advanced java mcq questions with answers

Advance Java first year msc(cs) by SoftwareTechIT | java questions and answers mcq

android

Android Tutorials Series Learn Android with SoftwareTechIT |android studio tutorial for beginners

android 12

Android 12 features and changes list |Features and APIs Overview |latest android version 12 release date|android 12 ui by SoftwareTechIT

Android os 12 release date |release date android 12 |google 12 android by SoftwareTechIT

android Studio Tutorial

Android Tutorials Series Learn Android with SoftwareTechIT |android studio tutorial for beginners

android tutorial

Activity and Activity Life Cycle with SoftwareTechIT

Android First App With SoftwareTechIT

Android Program To GridView with Images imagesAdapter | gridview android example with image adapter

Android Tutorials Series Learn Android with SoftwareTechIT |android studio tutorial for beginners

Android os 12 release date |release date android 12 |google 12 android by SoftwareTechIT

Play Store App Publish Step by Step |google play console classic | play store console publish |developer play store console by SoftwareTechIT

Top 80 Best Interview Questions for Android Programming with SoftwareTechIT

Top Questions on Android | Android Interview Quetions

Views & ViewGroups Learn With | SoftwareTechIT (English) by SoftwareTechIT

example of PreferenceFragment | Android Developers by SoftwareTechIT

example of Tab Layout in Android Tutorial Develop Android app by SoftwareTechIT

android videos

Views & ViewGroups Learn With | SoftwareTechIT (English) by SoftwareTechIT

app

Android 12 features and changes list |Features and APIs Overview |latest android version 12 release date|android 12 ui by SoftwareTechIT

Android os 12 release date |release date android 12 |google 12 android by SoftwareTechIT

Play Store App Publish Step by Step |google play console classic | play store console publish |developer play store console by SoftwareTechIT

basic

45 Fun [and Unique] Python Project Ideas for Beginners and Easy Learning by SoftwareTechIT

Advance Java first year msc(cs) by SoftwareTechIT | java questions and answers mcq

Advance operating system msc(cs) |Advance operating system MCQ questions and answers

Advanced Database Management System MCQ with Answers |by softwaretechit

Advanced Neural Network & Fuzzy System msq msc(cs)

Android 12 features and changes list |Features and APIs Overview |latest android version 12 release date|android 12 ui by SoftwareTechIT

Android Program To GridView with Images imagesAdapter | gridview android example with image adapter

Android os 12 release date |release date android 12 |google 12 android by SoftwareTechIT

C MCQ Questions and Answers on Arrays and Pointers 3 | c programming mcq | mcq quetions

C MCQ Questions and Answers on C Program Build Process | c Programming Question And Answer

C MCQ Questions and Answers on Console IO and Formatted IO | c programming question and answer

C MCQ Questions and Answers on File Operations IO | c programming questions answers

C MCQ Questions and Answers on Functions and Pointers 1

C MCQ Questions and Answers on Loops While For Do While 1

C MCQ Questions and Answers on Loops While For Do While 2

C MCQ Questions and Answers on Preprocessor Directives 1 | c programming question and answer

C MCQ Questions and Answers on Preprocessor Directives 2 | c programming questions answers

C MCQ Questions and Answers on Strings, Char Arrays and Pointers 1

C MCQ Questions and Answers on Strings, Char Arrays and Pointers 2 | c programming mcq questions answer

C MCQ Questions and Answers on Structures and Pointers 1 | c programming Questions and answers

C MCQ Questions and Answers on Structures and Pointers 2 | c programming questions answers

C MCQ Questions and Answers on Switch Case Syntax

C Programming MCQ Questions and Answers Basics 1

C Programming MCQ Questions and Answers Basics 2

C Programming MCQ Questions and Answers on Arithmetic Operators 1

C Programming MCQ Questions and Answers on Arithmetic Operators 2

C Programming MCQ Questions and Answers on Conditional Statements 1

C Programming MCQ Questions and Answers on Conditional Statements 2

C Programming MCQ Questions and Answers on Data Types and Storage Classes 1

C Programming MCQ Questions and Answers on Data Types and Storage Classes 2

C Programming MCQ Questions and Answers on Data Types and Storage Classes 3

Current trends in Software Engineering oose mcq mca(managment) by SoftwareTechIT

Data Structures & Analysis of Algorithm mcq msc(cs) | data structures and algorithms

Digital Electronics mcq Questions And Answers | digital electronics objective questions

Digital Image Processing mcq msc(cs)

Digital Signal Processing msc(cs) | Digital Signal Processing mcq questions and answers

Grid Computing MCQ with Answers Set 2| grid computing mcq. questions and answers

Grid Computing Multiple Choice Questions and Answers Set 1| grid computing 50 Questions and Answers

HackerRank Company Logo solution in python | python practice problems for beginners with solutions — New!

HackerRank Set .union() Operation solution in python | python practice problems for beginners with solutions — New!

Java Arrays and Multidimensional Arrays Interview MCQ Questions and Answers | MCQ Questions and Answers on Java Arrays and Multidimensional Arrays — New!

Java Basic Program Structure MCQ Questions and Answers 1

Java Basics History MCQ Questions and Answers 1

Java Basics History MCQ Questions and Answers 2

Java Classes and Objects Interview MCQ Questions and Answers 1 | MCQ Questions and Answers on Java Classes and Objects — New!

Java Classes and Objects Interview MCQ Questions and Answers 2 | MCQ Questions and Answers on Java Classes and Objects. — New!

Java IF ELSE IF Control Statements Interview MCQ Questions and Answers | Interview MCQ Questions and Answers on Java IF ELSE IF Control Statements. — New!

Java Literals MCQ Questions and Answers 1

Java Literals MCQ Questions and Answers 2

Java Loops WHILE FOR DO WHILE Interview MCQ Questions and Answers | MCQ Questions and Answers on Java Loops namely FOR, WHILE, DO WHILE and Break & Continue Label Statements. — New!

Java MCQ Questions and Answers Logical Operators 1 | java Questions and Answers

Java MCQ Questions and Answers on Arithmetic Operators 1

Java MCQ Questions and Answers on Bitwise Operators 1 | Java MCQ Questions and Answers on Bitwise Operators

Java MCQ Questions and Answers on Bitwise Operators 2 | Java MCQ Questions and Answers on Bitwise Operators

Java MCQ Questions and Answers on Logical Operators 2 | Java MCQ questions and answers on Logical Operators and their priorities

Java MCQ Questions and Answers on Relational Operators 1

Java Primitive Data Types MCQ Questions and Answers 1

Java Switch Case Interview MCQ Questions and Answers | Interview MCQ Questions and Answers on Java Switch Case Statements. — New!

Java Ternary Operator (Conditional) Interview MCQ Questions and Answers | learn Interview MCQ Questions and Answers on Java Ternary Operator or Conditional Operator.

Java Type Casting / Promotion MCQ Questions and Answers on 1

Learn Ethical Hacking From Scratch Free & Paid Udemy And More With SoftwareTechIT

Neural Network msc(cs) mcq by SoftwareTechIT

Parallel Computing mcq question answers msc(cs) by SoftwareTechIT

Play Store App Publish Step by Step |google play console classic | play store console publish |developer play store console by SoftwareTechIT

Requirement Engineering mcq oose Questions With Answers mca managment by SoftwareTechIT

Software Project Management Multiple Choice Questions with answers

Use-case Driven Object Oriented Analysis mcq questions with answers mca by SoftwareTechIT

User Interface Design mcq questions with answers mca mcq by SoftwareTechIT

example of PreferenceFragment | Android Developers by SoftwareTechIT

example of Tab Layout in Android Tutorial Develop Android app by SoftwareTechIT

what is xcode explain it?

bca

Advance D.B.M.S Multiple Choice Question & answer

Aptitude and Logical Reasoning Multiple Choice Question & Answer

Database Management System Multiple Choice Questions with Answers

Digital Electronics mcq Questions And Answers | digital electronics objective questions

Enterprise Resource Planning Multiple Choice Questions and Answers by SoftwareTechIT

Grid Computing Multiple Choice Questions and Answers Set 1| grid computing 50 Questions and Answers

Linear Programming Problem Multiple Choice Question & Answer

Mobile Communication Multiple Choice Questions and Answers on Mobile Communication

Mobile Maintenence-I Multiple Choice Question & answer

Read More About Java Interview Quetions

Read More About Java Interview Quetions

--

--