1. Home
  2. Data Science
  3. Python
  4. What is the output of the following Python code snippet?

Added 25 Nov 2026

What is the output of the following Python code snippet?

def greet(name='Guest'):
return f'Hello, {name}'
print(greet())
  1. Hello, Guest Correct answer
  2. Hello, name
  3. Hello,
  4. Error

Correct answer

A. Hello, Guest

5 views

MCQSEXAM

Explanation

A default parameter value is used when no argument is supplied.

Reference

Asked in: Python Interview Functions

https://docs.python.org/3/tutorial/controlflow.html#defining-functions

Preparing for an exam?

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs