1 Create a module named numericquestions. Inside the comdule create NumericQuestion class as a subclass of Question override the checkAnswer method such that if the response and the expected answer differ by no more than 0.01, then accept the response as correct. 2. Create a module named fillnquestions. Inside the comdule create FillnQuestion class as a subclass of Question Such a question is constructed with a string that contains the answer, surrounded by - for example, "The inventor of Python was Guido van Rossum_". The question should be displayed as The inventor of Python was 3. Create a module named multichoicequestionq. Inside the mdule create a MultiChoiceQuestion class as a

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Python programming language.
1 Create a module named numericquestions. Inside the
comdule create NumericQuestion class as a subclass of
Question override the checkAnswer method such
that if the response and the expected answer differ by
no more than 0.01, then accept the response as
correct.
2. Create a module named filllnquestions. Inside the
comdule create FillnQuestion class as a subclass of
Question Such a question is constructed with a string
that contains the answer, surrounded by - -
for
example, "The inventor of Python was
Rossum_". The question should be displayed as
Guido van
The inventor of Python was
3. Create a module named multichoicequestionq. Inside
the mdule create
a MultiChoiceQuestion class as a
subclass
of
ChoiceQuestion.
The
MultiChoiceQuestion allows multiple correct choices.
The respondent (exam taker) should provide all correct
choices, separated by spaces. Provide instructions in the
question text.
4. Add a method named addText to the Question
superclass that appends text to the question text and
provide a different implementation of ChoiceQuestion
that calls addText rather than storing a list of choices
5. Create a module named exammanegers. Inside the
module, create a class named ExamManager
An ExamManager object stores Questions . It
uses a list to store questions.
o It has a method for adding a Question
message. The newly added question to
be appended to the end of the list
o It has a method for returning the
question found at a given index.
O Implement the necessary constructor.
o Each attribute must have a getter
method.
6. Add a module named main. Inside the module, create
a main method that
Creates an ExamManager object
Creates 10 different questions of different types,
and adds them to the exam manager object
use a proper loop to display questions stored in
the Exammanager object
Transcribed Image Text:1 Create a module named numericquestions. Inside the comdule create NumericQuestion class as a subclass of Question override the checkAnswer method such that if the response and the expected answer differ by no more than 0.01, then accept the response as correct. 2. Create a module named filllnquestions. Inside the comdule create FillnQuestion class as a subclass of Question Such a question is constructed with a string that contains the answer, surrounded by - - for example, "The inventor of Python was Rossum_". The question should be displayed as Guido van The inventor of Python was 3. Create a module named multichoicequestionq. Inside the mdule create a MultiChoiceQuestion class as a subclass of ChoiceQuestion. The MultiChoiceQuestion allows multiple correct choices. The respondent (exam taker) should provide all correct choices, separated by spaces. Provide instructions in the question text. 4. Add a method named addText to the Question superclass that appends text to the question text and provide a different implementation of ChoiceQuestion that calls addText rather than storing a list of choices 5. Create a module named exammanegers. Inside the module, create a class named ExamManager An ExamManager object stores Questions . It uses a list to store questions. o It has a method for adding a Question message. The newly added question to be appended to the end of the list o It has a method for returning the question found at a given index. O Implement the necessary constructor. o Each attribute must have a getter method. 6. Add a module named main. Inside the module, create a main method that Creates an ExamManager object Creates 10 different questions of different types, and adds them to the exam manager object use a proper loop to display questions stored in the Exammanager object
Exercises 1:
Consider the following class diagram and the
definition of question class in a module named
"questions"
class ChoiceQuestion in a module named
and the
definition of
choicequestions
# This module defines
a
class that models
exam questions.
## A question with a text and an answer.
class Question :
def
init
(self,t-"", a="") :
self. text = t
self._answer - a
def setText (self, questionText) :
self._text = questionText
def setAnswer (self, correctResponse) :
self._answer - correctResponse
def checkAnswer (self, response) :
return response == self._answer
def display (self) :
print (self._text)
def
(self) :
_repr
return "Question[%s, %s]" % (self._text,
self._answer)
from questions import Question
class ChoiceQuestion (Question) :
_init_(self,t="",a="") :
super ()._init (t, a)
self._choices = ]
def
def addChoice (self, choice, correct) :
self. choices.append (choice)
if correct :
# Convert len (choices) to string.
choicestring = str(len (self._choices))
self.setAnswer (choicestring)
def display (self) :
super ().display ()
# Display the answer choices.
for i in range (len (self._choices)) :
choiceNumber - i + 1
print ("d:
self._choices[i]))
ts"
(choiceNumber,
< >
Transcribed Image Text:Exercises 1: Consider the following class diagram and the definition of question class in a module named "questions" class ChoiceQuestion in a module named and the definition of choicequestions # This module defines a class that models exam questions. ## A question with a text and an answer. class Question : def init (self,t-"", a="") : self. text = t self._answer - a def setText (self, questionText) : self._text = questionText def setAnswer (self, correctResponse) : self._answer - correctResponse def checkAnswer (self, response) : return response == self._answer def display (self) : print (self._text) def (self) : _repr return "Question[%s, %s]" % (self._text, self._answer) from questions import Question class ChoiceQuestion (Question) : _init_(self,t="",a="") : super ()._init (t, a) self._choices = ] def def addChoice (self, choice, correct) : self. choices.append (choice) if correct : # Convert len (choices) to string. choicestring = str(len (self._choices)) self.setAnswer (choicestring) def display (self) : super ().display () # Display the answer choices. for i in range (len (self._choices)) : choiceNumber - i + 1 print ("d: self._choices[i])) ts" (choiceNumber, < >
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY