1. Is the code snippet written below legal? Select one: a. Yes. b. No; there sho
ID: 3679965 • Letter: 1
Question
1. Is the code snippet written below legal?
Select one:
a. Yes.
b. No; there should be a semicolon at the end of line 2.
c. No; for i = 3, s.substring(i, i + 1) will result in an StringIndexOutOfBounds error.
d. No; line 4 should have no semicolon at the end.
2.
What is the output of the code fragment given below?
Select one:
a. 0
b. 62
c. 63
d. The code fragment displays no output because it does not compile.
3.
What is the output of the code snippet given below?
Select one:
a. abcd
b. bcde
c. bcbcd
d. cdef
4.
What is the output of the code snippet given below?
Select one:
a. i=7, j =7
b. i =7, j =6
c. i =6, j =7
d. i =5, j =5
5.
How many times does the following loop execute?
Select one:
a. 6 times
b. 8 times
c. 9 times
d. 12 times
Explanation / Answer
1. c) out of bound when i =5
2. c) 63
3. c) bcbcd
4. d) i=5 j=5
5. d) 12 times
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.