What is the output of the following code snippet?
Int f1 = 0;
Int f2 = 1;
Int fRes;
System.out.print(f1 + " ") ;
System.out.print(f2 + " ") ;
For (int i = 1; i < 10; i++)
{
FRes = f1 + f2;
System.out.print(fRes + " ") ;
F1 = f2;
F2 = fRes;
}
System.out.println() ;
A) 0 1 5 7 9 11 13 15 17 19
B) 0 1 1 2 3 5 8 13 21 34
C) 0 1 4 6 8 10 12 14 16 18
D) 0 1 6 7 9 12 14 17 19 21
Correct Answer:
Verified
Q30: Which of the following is considered a
Q40: In the _ loop header, you can
Q43: What does the following code snippet print?
Int
Q46: What is the output of the following
Q51: How many times does the following loop
Q55: Insert a statement that will correctly terminate
Q57: What values does counter variable i assume
Q58: What is the output of this code
Q65: Choose the loop that is equivalent to
Q66: Which of the following loop(s) could possibly
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents