23-for-each loop + java

23-for-each loop + java

Professional Development

32 Qs

quiz-placeholder

Similar activities

ED02

ED02

Professional Development

28 Qs

Quiz for "Amigos"

Quiz for "Amigos"

Professional Development

30 Qs

Gernal knowledge

Gernal knowledge

Professional Development

30 Qs

Pemantapan TBI Bab 12-13 Kamis, 08072021

Pemantapan TBI Bab 12-13 Kamis, 08072021

Professional Development

30 Qs

22-throw keyword+java

22-throw keyword+java

Professional Development

30 Qs

12.Run Tests

12.Run Tests

Professional Development

30 Qs

TBI Pemantapan Bab 13 & 14

TBI Pemantapan Bab 13 & 14

Professional Development

30 Qs

23-for-each loop + java

23-for-each loop + java

Assessment

Quiz

English

Professional Development

Hard

Created by

ANIL KUMAR

Used 1+ times

FREE Resource

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
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?