20.1 Programming paradigms
192 questions in this subtopic. Open a question to solve it and check the official answer.
Programming paradigms · 4 marks · official answer ready
(i) Write program code to declare the class vendingMachine. You are only required to write program code for the attribute declarations and the constructor. If you are writing in P…
Programming paradigms · 5 marks · official answer ready
(ii) The method checkValid() takes the food item code as a parameter. It checks the code against each element in items and returns: • –1 if the code is not valid • -2 if the code …
Programming paradigms · 2 marks · official answer ready
(iii) Four objects of type foodItem are declared with the identifiers: chocolate, sweets, sandwich, apple Write program code to declare an instance of vendingMachine with the iden…
Programming paradigms · 4 marks · official answer ready
(a) Write program code to define the class QuizClass. You are only required to write code for the attribute declarations and constructor. If you are writing in Python, include att…
Programming paradigms · 4 marks · official answer ready
(b) The QuizClass method AddQuestion() takes a question object as a parameter and stores it in the next available location in the array Questions. It returns TRUE if it is success…
Programming paradigms · 5 marks · official answer ready
(c) The first quiz is created with the identifier FirstQuiz. The first question in this quiz is: “What is 100 / 5 ?”. The answer is “20” and the difficulty level is 1. Write progr…
Programming paradigms · 1 mark · official answer ready
(d) The object FirstQuiz contains objects of type QuestionClass. State the name of this OOP feature. ..............................................................................…
Programming paradigms · 2 marks · official answer ready
(i) State when Ejaz should use an interpreter and a compiler. Each answer must be different. Interpreter ..........................................................................…
Programming paradigms · 2 marks · official answer ready
(ii) Give the name of two facilities that Ejaz can use to debug his program. 1 ....................................................................................................…
Programming paradigms · 2 marks · official answer ready
(iii) Describe one feature of an editor that Ejaz can use when writing the program. ...............................................................................................…
Programming paradigms · 4 marks · official answer ready
(i) Write program code to declare the class vendingMachine. You are only required to write program code for the attribute declarations and the constructor. If you are writing in P…
Programming paradigms · 5 marks · official answer ready
(ii) The method checkValid() takes the food item code as a parameter. It checks the code against each element in items and returns: • –1 if the code is not valid • -2 if the code …
Programming paradigms · 2 marks · official answer ready
(iii) Four objects of type foodItem are declared with the identifiers: chocolate, sweets, sandwich, apple Write program code to declare an instance of vendingMachine with the iden…
Programming paradigms · 4 marks · official answer ready
(i) Write program code for the Constructor() method. Programming language ..................................................................................................... Pro…
Programming paradigms · 2 marks · official answer ready
(ii) Write program code for the SetFirstName()method. Programming language ..................................................................................................... Pr…
Programming paradigms · 2 marks · official answer ready
(iii) Write program code for the GetName()method. Programming language ..................................................................................................... Progra…
Programming paradigms · 6 marks · official answer ready
(iv) The method AddCredits()calculates the number of printing credits a student buys and adds the printing credits to the student’s account. • Credits cost $1 for 25 credits. • If…
Programming paradigms · 2 marks · official answer ready
(v) A global array, StudentAccounts, stores 1000 instances of PrintAccount. Write pseudocode to declare the array StudentAccounts. ................................................…
Programming paradigms · 8 marks · official answer ready
(vi) The main program has a procedure, CreateID(), that: • takes the first name and last name as parameters • creates PrintID that is a concatenation of: ◦ the first three letters…
Programming paradigms · 13 marks
2 3 5 6 1 1 F 7 8 9 [6] 3 (ii) State what is meant by the critical path in a PERT chart. ..........................................................................................…
