Python Repr() Quiz
FREE Online Courses: Elevate Your Skills, Zero Cost Attached - Enroll Now!
Quiz Summary
0 of 10 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 10 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
Question 1 of 10
1. Question
- What method is invoked by repr()?
CorrectIncorrect -
Question 2 of 10
2. Question
What is the output of the below code?
Code
>>> num = 36
>>> sum = repr(36) + 3
>>> print(sum)
CorrectIncorrect -
Question 3 of 10
3. Question
Python repr() function takes ___ number of arguments.
CorrectIncorrect -
Question 4 of 10
4. Question
What is the output of the below code?
Code
>>> website = “PythonGeeks”
>>> print(repr(website))
CorrectIncorrect -
Question 5 of 10
5. Question
What type of function is repr() ?
CorrectIncorrect -
Question 6 of 10
6. Question
Which built-in function returns a string containing a printable representation of an object, but escapes the non-ASCII characters in the string returned by repr() using \x, \u or \U escapes?
CorrectIncorrect -
Question 7 of 10
7. Question
Which built-in function returns a string containing a printable representation of an object which would often yield an object with the same value when passed to eval()
CorrectIncorrect -
Question 8 of 10
8. Question
What is the output of the below code?
Code
>>> class Website:
>>> def __init__(self, name):
>>> self.name = name
>>> def __repr__(self):
>>> return f’Website is {self.name}’
>>> website1 = Website(“PythonGeeks”)
>>> print(repr(website1))
CorrectIncorrect -
Question 9 of 10
9. Question
What is the output of the below code?
Code
>>> class Date:
>>> def __init__(self, day, month, year):
>>> self.day = day
>>> self.month = month
>>> self.year = year
>>> def __str__(self):
>>> return f”{self.day}/{self.month}/{self.year}”
>>> def __repr__(self):
>>> return f”Date({self.day}, {self.month}, {self.year})”
>>> today = Date(24, 4, 2021)
>>> print(repr(today))
>>> print(str(today))
CorrectIncorrect -
Question 10 of 10
10. Question
What is the output of the below code?
Code
>>> class Fruit:
>>> def __repr__(self):
>>> return “Invoked __repr__()”
>>> mango = Fruit()
>>> print(repr(mango))
>>> print(str(mango))
CorrectIncorrect