Which of the following is the output of the code?
Given the following pseudocode:
Which of the following is the output of the code?
A . 1
B . 9
C . 10
D . 11
Answer: B
Explanation:
The code uses a for loop to iterate from 1 to 3, and assigns the value of i to the variable x. Then, it adds 3 to x and prints the result.
The output of the code is:
3 (when i = 1, x = 1, x + 3 = 4) 6 (when i = 2, x = 2, x + 3 = 5) 9 (when i = 3, x = 3, x + 3 = 6)
Reference: CompTIA IT Fundamentals+ Study Guide: Exam FC0-U61, Second Edition, Chapter 4: Programming Concepts and Data Structures, page 153.
Latest FC0-U61 Dumps Valid Version with 146 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund
Subscribe
Login
0 Comments
Inline Feedbacks
View all comments