INF1511 - Visual Programming I exam pack 2022.
INF1511 - Visual Programming I exam pack 2022. Question 1 Multiple-choice questions [10] INF1S11 OCTOBER/NOVEMBER 2019 2 Downloaded by: tebzamabalane | Distribution of this document is illegal S - The study-notes marketplace [Please Turn Over] e) A class may have two types of methods, namely class methods and static methods Briefly explain a difference between these two types of methods You may use a coded example to clarify ( 4) d) Explam why garbage collecnon rs required m programmmg You may use a coded example to clarify (1) c) Motivate one benefit of usmg classes m programming (1) b) Given the class definition above, explain how an instance of the class rs created You may use a coded example to clarify (2) class student: studentnum =0 studentorder = '' deli veryto = '' print (eryto) Identify the class object and a class (2) a) Consider the following code to define a class attribute Question 3 Object Orientation [10) d) Write a program that will ask the user to input words as two strings, and will assign the strings to variables word1 and word2 The program must jom the strings word1 and word2 with the Jom function with a space between the strings The output must be displayed m caprtal letters Please name the program and provide at least one code comment ( 10) c) Ask the user for a random number and assign the value to a variable named starting Then using a for loop and write a program that asks the user for input of 5 numbers Each of these numbers must be added to the m1t1al value of the variable starting. The output must be the mmal and final value of the variable starting. Please name the program and provide at least one code comment (5) b) Write a function thedifference Wnte a program that outputs the difference between the first and the second input numerical values The input values must be requested from the user The values must be passed to the function, and the difference value rs returned The output should reflect both the input and output values Please name the program and provide at least one code comment (10) a) Use an if ... else statement and write a program that asks the user for mput of the time m hours (1 to 24} for the day If the time value rs greater than 6 and less than 18, then the program must output a comment 'Have a Happy Day', else the comment must be 'Rest Well' Please name the program and provide at least one code comment (5) Question 2 Programming (30] INF1511 OCTOBER/NOVEMBER 2019 3 : I i : : I I I I I I ' I I : I . Downloaded by: tebzamabalane | Distribution of this document is illegal S - The study-notes marketplace [Please Turn Over] to learn 00 programming is amazing Easy development of the f .i Le are: Python web development The Output: The contents in Prograrruning and matters import sys matter2 = 11' The development of programming matters ''' f = open('', 'a' ) 1te("n%s" %matter2) f. close () f = open('', 1r' } lines= ines() f. close () print('The contents in the file are:') for line in lines: 1te(l1ne} c) Consider the code below, and explain each of the 12 Imes (6) include snippets of code with comments to enhance your explanation (2) b) Explain two ways m which content may be removed from a file You are welcome to a) Explain the concept of file handling (2) INF1511 OCTOBER/NOVEMBER 2019 Question 4 File Handling (10] 4 Downloaded by: tebzamabalane | Distribution of this document is illegal S - The study-notes marketplace Urusa 2019 © c) Sketch the user interface for the adrmrustratron of the student menu delivery request The information must be saved to a file You must label all widgets included on the UI Other details to be included on the user interface rncludes the order reference number, the student number, the student contact phone number, and the delivery address (5) b) The distance (to the nearest metre) between kitchen and delivery address rs entered The cost 1s calculated usmg this distance Which widget may be used on the UI to capture the distance and to calculate the cost of the delivery? Explain (4) a) Which widget may be used on the UI to capture the request status? Motivate (1) • The student delivery request status must change Options for request status are ordered, processed, or delivered • The cost of the delivery must be captured However, the StudentMenuDelivery application needs expansion to include a delivery fee and track a delivery Thus, a new user interface (UI) must be developed for the processing of a menu delivery request from a student The StudentMenuDelivery rs an innovative new system that allows students to order refreshments to their study desk The system will be piloted at selected campus soonest Question 5 Application Development [10] INFlSll OCTOBER/NOVEMBER 2019 5 I I ' . ; I . I I • Downloaded by: tebzamabalane | Distribution of this document is illegal S - The study-notes marketplace UNIVERSITY EXAMINATIONS UNIVERSITEITSEKSAMENS UNISA N Iszx. - INF1511 May/June 2019 Visual Programming| Duration 2 Hours 70 Marks EXAMINERS FIRST MRS PM GOUWS SECOND DR VZ MZAZI Closed book examination This examination question paper remains the property of the University of South Africa and may not be removed from the examination venue This examination question paper consists of 5 pages Instructions e Answerall the questions in the answer book e Answersin pencil will not be marked e The marks are provided in brackets next to the questions [Please Turn Over] Downloaded by: tebzamabalane | Distribution of this document is illegal S - The study-notes marketplace Question 1 Multiple-choice questions [10 Marks] INF1511 MAY/JUNE 2019 Question Options Answers 1 Yes 1 Is Python case sensitive when dealing with 2 No identifiers? 3 Machine dependent 4 Noneofthe above l keywords 2 are used for storing dataina 2 variables program 3 integers 4 comments 1 an error message 3 Ifthe data type of the values in the 2 an event handler variables does not match the format codes, 3 an auto conversion then occurs 4 nothing l Integrated Development Environment 4 IDLE 1s the abbreviation for 2 Incredible Development Environment 3 Integrated Development Experience 4 Integrated Distribution Environment l python 5 The extension for a Python program 1s 2 thon 3 py 4 pyt 1 pick and return a random item from a 6 The choice() function 1s used to sequence It can be used with lists, tuples 2 select the maximum number. or strings 3 select the optimalstring value 4 pick the median value 7. A string ‘ready’ is entered into a program : sorted) To generate the outputstring ‘adery’, the ts_Random() function is used 3 swapcase() —_= 4 IstripQ) l selfies 8 The functions that are defined in a class 2 Instances are known as 3 classes 4 methods. 1 Is used to store values 2 Never requires quotes 9 A Itteral value in a program 3 Must always have quotes. 4 occurs directly in a program 1 Only 10. The following 1s a keyword in Python 2 Class 3 Without 4 Within [Please Tum Over] Downloaded by: tebzamabalane | Distribution of this document is illegal S - The study-notes marketplace INF1511 MAY/JUNE 2019 Question 2 Programming [30 Marks] a Useanif... else statement and write a program that asks the user for input of the temperature for the day If the temperature value is greater than 26, then the program must output a comment‘hot day’, else the comment must be ‘great day’ Please name the program and provide at least one code comment (5) b. Write a function thesum Write a program that outputs the sum of three numerical values The input must be requested from the user The values must be passed to the function, and the sum value is returned The output should reflect both the input and the output values. Please name the program andprovideat least one code comment (10) c Use awhile loop and write a program that asks the user for input of anumber Use a WHILE loopto iterate The output must be the next 10 odd numbers following the numberthat was inputted Please name the program and provide at least one code comment (5) d Write a program thatwill ask the user to input two strings, assign the strings to variables m and n Ifthefirst or second string 1s less than 10 characters, the program must output a warning message that the string 1s too short The program mustjoin the strings m and n with the join function The output must be displayed. Please name the program and provideat least one code comment (10) [Please Turn Over] Downloaded by: tebzamabalane | Distribution of this document is illegal S - The study-notes marketplace INF151t MAY/JUNE 2019 Question 3 Object Orientation [10 Marks] a Considerthe following codeto define a class Identify the class obyect and a class attribute (2) class book weight=461 name = ‘The Future of Robots’ print (book weight) b Aclass may have two types of data members, namely class variables and instances variables Explain a difference between these two types of variables You may use a coded example to clarify. (2) c Explain a difference between a class and an instance of aclass You may use a coded example to clarify (2) d Explain why garbage collection is required in Python (2) e Create a class Qualification with public member variables Qualification name and numberof modules required Add initQ) method ofthe class that initializes string membervariables to empty strings and numeric values to 0 (2) Question 4 File Handling [10 Marks] a Namethe three steps that are required for working with files For each of these steps, provide a code snippetthat 1s used to perform the steps required Coded examples maybe used to enhance your explanation (6) b Provide two reasons whyfile handling is required tn programmes (2) c. Compare the use of variables and files in a programme Whatts the benefit of the use of each of these two options? (2) [Please Turn Over] Downloaded by: tebzamabalane | Distribution of this document is illegal S - The study-notes marketplace INF1511 MAY/JUNE 2019 Question 5 Application Development [10 Marks] The CatRescueAreUsapplication needs expansion A newuserinterface (UI) must be developed for the processing of a Rescue Adoption Thecat status must change Opttonsfor status are rescue, foster, adopt, passed away The weight ofthe cat must be captured a Which widget may be used on the UI to capture the cat status? Motivate (2) b Which widget may be used on the UI to capture the weight of the cat? Motivate (2) c Sketch the UI for the administration of the cat’s rescue status The information must be saved to afile You mustlabelall widgets included on the UL. Other details to be included on the user interface includes the nameofthe rescuedcat, the colour description, age and gender of the cat, and the name and sumameofthe foster parent. (6) ©UNISA 2018 Downloaded by: tebzamabalane | Distribution of this document is illegal S - The study-notes marketplace Downloaded by: tebzamabalane | Distribution of this document is illegal S - The study-notes marketplace Downloaded by: tebzamabalane | Distribution of this document is illegal S - The study-notes marketplace Downloaded by: tebzamabalane | Distribution of this document is illegal S - The study-notes marketplace Downloaded by: tebzamabalane | Distribution of this document is illegal S - The study-notes marketplace Downloaded by: tebzamabalane | Distribution of this document is illegal S - The study-notes marketplace Downloaded by: tebzamabalane | Distribution of this document is illegal.
Geschreven voor
- Instelling
- University of South Africa
- Vak
- INF1511 - Visual Programming I (INF1511)
Documentinformatie
- Geüpload op
- 9 april 2022
- Aantal pagina's
- 100
- Geschreven in
- 2021/2022
- Type
- Tentamen (uitwerkingen)
- Bevat
- Vragen en antwoorden
Onderwerpen
-
visual programming i
-
inf1511 visual programming i
-
inf1511 exam pack 2022
-
exam pack 2022