23-for-each loop + java

23-for-each loop + java

Professional Development

32 Qs

quiz-placeholder

Similar activities

BS1 Final Review

BS1 Final Review

Professional Development

27 Qs

MGNF 27

MGNF 27

Professional Development

30 Qs

Review 1

Review 1

KG - Professional Development

28 Qs

FCE - GF - Unit Test 2

FCE - GF - Unit Test 2

10th Grade - Professional Development

28 Qs

Hospital quiz

Hospital quiz

Professional Development

28 Qs

TGAT conversation

TGAT conversation

Professional Development

34 Qs

SELF-ASSESSMENT(SIMPLE PAST)

SELF-ASSESSMENT(SIMPLE PAST)

Professional Development

27 Qs

English for WELDERS

English for WELDERS

Professional Development

27 Qs

23-for-each loop + java

23-for-each loop + java

Assessment

Quiz

English

Professional Development

Practice Problem

Hard

Created by

ANIL KUMAR

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

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

32 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is for loop and forEach loop?

for loop is used only for arrays, while forEach loop can be used for any collection
for loop can only iterate forward, while forEach loop can iterate forward and backward
for loop requires an index variable, while forEach loop does not
for loop is faster than forEach loop

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is forEach loop in Java explain with example?

for (int i = 0; i < arr.length; i++) {System.out.println(arr[i]);}
for (String str : list) {System.out.println(str);}
while (iterator.hasNext()) {System.out.println(iterator.next());}
do {System.out.println(str);} while (str != null);

3.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Is forEach loop only for arrays?

Yes
No

4.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What can forEach loops not do?

Modify the collection being iterated
Iterate through multiple collections at once
Break out of the loop early
None of the above

5.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Is for loop same as forEach?

Yes
No

6.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Is forEach faster than for Java?

Yes
No

7.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is for-each loop write the syntax of it?

for(i=0;i<arr.length;i++)
for(Object obj: arr)
for(i in arr)
for each(obj in arr)

Create a free account and access millions of resources

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

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?