Recall & Review
beginner
What does the
print() function do in Swift?The
print() function shows text or values on the screen (console). It helps you see results or messages while your program runs.Click to reveal answer
beginner
How do you print a simple message like "Hello, world!" in Swift?
Use
print("Hello, world!"). This tells the program to show the words Hello, world! on the screen.Click to reveal answer
beginner
Can you print numbers using
print() in Swift? How?Yes! You can print numbers directly like
print(123). It will show the number 123 on the screen.Click to reveal answer
beginner
How do you print multiple values or variables in one
print() statement?You can separate values with commas, like
print("Age:", age). Swift prints them with spaces between.Click to reveal answer
intermediate
What is the difference between
print() and debugPrint() in Swift?print() shows user-friendly output. debugPrint() shows more detailed info, useful for debugging your code.Click to reveal answer
Which Swift code prints the message "Welcome!" to the screen?
✗ Incorrect
In Swift,
print() is used to show messages on the screen.What will
print(5 + 3) output in Swift?✗ Incorrect
Swift calculates 5 + 3 and prints the result 8.
How do you print two variables,
name and age, separated by a space?✗ Incorrect
Using commas in
print() prints values separated by spaces.Which function shows more detailed info for debugging in Swift?
✗ Incorrect
debugPrint() gives detailed output useful for debugging.What happens if you write
print() with no arguments?✗ Incorrect
Calling
print() without arguments prints a blank line.Explain how to use the
print() function in Swift to show messages and variables.Think about how you tell a friend what you want to show on the screen.
You got /4 concepts.
Describe the difference between
print() and debugPrint() in Swift and when to use each.One is for normal messages, the other helps find problems.
You got /3 concepts.