In: Computer Science
Use Python, please type.
A multiple-choice quiz with 5 questions. Each question has 4 possible answers labelled A, B, C and D.
After displaying the first question and the 4 possible answers, the user is asked to enter their choice. If their choice is correct, add 1 to the score, then display the next question and its 4 possible answers.
At the end of the quiz, display their score out of 5, their score as a percentage, and if they get a percentage score greater than or equal to 50, your program should output "You passed this quiz, well done!", otherwise the output is "You failed this time, better luck next time!"
Also, output the student's letter grade according to this scale:
A+ 91-100 C+ 65-69 A 86-90 C 60-64 A- 80-85 C- 55-59 B+ 77-79 P 50-54 B 73-76 F Below 50 B- 70-72
1. Which of the following is the name of an intermediate level language?
A: C++
B: Java
C: PHP
D: Assembly
Please enter your answer, A, B, C or D:
Answer: D
2. Which of the following is not an output device?
A: Monitor
B: Printer
C: Projector
D: Mouse
Please enter your answer, A, B, C or D:
Answer: D
3. Which of the following symbol is used for comments in Python?
A: @
B: **
C: #
D: /*
Please enter your answer, A, B, C or D:
Answer: C
4. What is the output of 13 % 3 in python 3?
A: 1
B: 3
C: 4
D: 6
Please enter your answer, A, B, C or D:
Answer: A
5. What is the output of 17//2 in python 3?
A: 7
B: 8
C: 9
D: 9.5
Please enter your answer, A, B, C or D:
Answer: B
questions = ['''1. Which of the following is the name of an
intermediate level language?
A: C++
B: Java
C: PHP
D: Assembly
''', '''2. Which of the following is not an output device?
A: Monitor
B: Printer
C: Projector
D: Mouse
''', '''3. Which of the following symbol is used for comments in
Python?
A: @
B: **
C: #
D: /*''', '''4. What is the output of 13 % 3 in python 3?
A: 1
B: 3
C: 4
D: 6''', '''5. What is the output of 17//2 in python 3?
A: 7
B: 8
C: 9
D: 9.5''']
answers = "DDCAB"
score = 0
for i in range(5):
print("\n",questions[i])
ans = input("Please enter your answer, A, B, C or D:")
if ans == answers[i]:
score += 1
percentage = score*100/5
if percentage >= 50:
print("\nYou passed this quiz, well done!")
else:
print("\nYou failed this time, better luck next time!")
if percentage >= 91:
print("Grade is A+")
elif percentage >= 86:
print("Grade is A")
elif percentage >= 80:
print("Grade is A-")
elif percentage >= 77:
print("Grade is B+")
elif percentage >= 73:
print("Grade is B")
elif percentage >= 70:
print("Grade is B-")
elif percentage >= 65:
print("Grade is C+")
elif percentage >= 50:
print("Grade is C")
elif percentage >= 55:
print("Grade is C-")
elif percentage >= 50:
print("Grade is P")
else:
print("Grade is F")
# Hit the thumbs up if you are fine with the answer. Happy Learning!