0% found this document useful (0 votes)
77 views15 pages

Ict1511 2017 6 e 1

Introduction to Programming Unisa

Uploaded by

gerryrushway
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
77 views15 pages

Ict1511 2017 6 e 1

Introduction to Programming Unisa

Uploaded by

gerryrushway
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 15
i FINAL % FINALE: hd U N 1 SA ICT1511 May/June 2017 INTRODUCTION TO PROGRAMMING ‘STUDENT NUMBER / STUDENTENOMMER 0 FRE Total - 100 I Date of ‘amination, WARNING , carci who without autonsaton takes ro the examination venue any book document of object Which could assist hm inthe samtion and does not hand oer such matonal to he megiato Before the fica commencement ol Ure enarnewon Wal Gs guy of De fo punrmant as dotomined by Cound 2 Rough work may ba dane cry on he axamnaten question paper and must be abeled ns Such 3. Norte may be mage on any pat ote body, ugh the hands oon ay garment M Ths pagelpaper s he propo ofthe Unvarty and under no creumslances may tne cangidats ein tor take tout of he examination venue iB PLEASE COMPLETE THE ATTENDANCE REGISTER ON THE BACK PAGE, TEAR OFF AND HAND TO THE INVIGILATOR inning te Unverstys Sxaranatian sglaions and val UNIVERSITY EXAMINATIONS UNIVERSITEITSEKSAMENS UNISA Ise 1CT1511 May/June 2017 INTRODUCTION TO PROGRAMMING Duraton 2 Hours 400 Marks EXAMINERS. FIRST MS ME VAN HEERDEN SECOND MRS 10 SCHOLTZ Programmable pocket calculator 1s permissible 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 paper consists of 9 pages + Appendix A (pp 10 - 13) INSTRUCTIONS 1 Make 100% sure you are writing the correct examination paper 2. CHECK the module code on the front page to ensure you are writing the correct examination paper 3 Answer question 1, 2, 3, and 4 in Appendix A 4 All rough work must be done on the back of this question paper and in the answer book 5. The mark for each question is indicated in brackets next to the question GOOD LUCK vcrisi Maydune 2017 Question 1 — True/False 15) Indicate whether the statement is true or false 1. A sentential value is a value that is not legitimate data value for a particular problem, but it is proper type, that ts used to check for a ‘stopping value’ 2 In cases where quite a number of files are used at different stages in the program, it is very important to keep open all the files that are in use at all times. 3 While solving a problem, two variables may have the same name. 4. Anelement in an array need not have an initial value 5. Indicate if the following statement is true of false m+7>3*pwherem=4andp=5 6. The data type of the value returned by a function must be the same in all the return statements when a function contains an if statement In some cases, a loop control variable does not have to be initialized. 8 Indicate if the following statement ts true or false a+t<> (a+b) * 4 where a=6,b=19 andt = 22 9 Intermediate variables may be used to assist with calculations. 10.When different operators are combined in one expression, all the mathematical operators will be processed first, then the relational operators and finally the logical operators 11 Its important to appreciate that each nested IF statement is designed to eliminate the potential answers until there's only one result left 12. The position of an element in an array 1s called an index or a subscript 13 The way that data ts stored in a file determines the type of file it is 14 The key word “together”, in an arithmetic expression indicates that addition will take place 15. The name of the value returned by the function need not be the same as in the calling statement lorisis Mayltune 2017 Question 2 - Multiple Choice 15} Identify the choice that best completes the statement or answers the question. 1 Which of the ‘if’ statements below is the correct one for the following problem statement? To earn a medal in a competition, a participant must cycle at least 20 kilometers and swim 500 meters a if cycleDist <= 20 AND swimDist <= 500 then display “July qualifies for a medal” else display “July does not qualify for a medal” endif b if cycleDist >= 20 AND swmDist >= 500 then display “July qualifies for a medal” else display “July does not qualify for a medal” endif c. if cycleDist > 20 AND swimDist > 500 then display “July qualifies for a medal” else display “July does not qualify for a medal” endif if cycleDist > 20 AND swimDist > 500 then display “July qualifies for a medal” else display “July does not qualify for a medal” endif a rom how many places in the code can a procedure be called? s Many times as needed 3 > Cu 4 rors Mayisune 2017 Which of the ‘if’ statements below Is the correct one for the following problem statement? Dabanior wants to go to the dance, the tickets cost R60 and he must take a date (use a Boolean value for this). Display a message to indicate whether he can go a if money >= 60 AND date then display “Dabarior may go on his date” endif if money >= 60 AND NOT date then display “Dabarior may go on his date” endif if money >= 60 AND if date then display “Dabarior may go on his date” else display “Dabarior may go on his date” endif c ifmoney <= 60 AND date then display “Dabanor may go on his date” a else display “Dabanor may go on his date” endif dif money <= 60 AND date then display “Dabarior may go on his date” else display “Dabanor may go on his date” endif The way that 1s stored in a file determines the type of file it 1s a information b byte c data d All of the above Mapping of files 1s managed by a file metadata b. page table c. virtual memory d file system 5 rorssit Mayvune 2017 6 What would be the displayed as the monthly increased salary in the following pseudocode if the user enters the department as “c” and the annual salary as 50000? if anSalary 1s numberic then monSalary = anSalary / 12 if deptCode = “A” then monSalary = monSalary + monSalary * 0 072 else if deptCode = “B” then monSalary = monSalary + monSalary * 0 068 else monSalary = monSalary + monSalary * 0 063 endif endif display “The increased monthly salary is R”, monSalary else display “The annual salary must be numeric ” endif a The increased monthly salary is R53150 00 b The increased monthly salary is R4429 17 c The increased monthly salary is R4450 00 d. The annual salary must be numeric ~ How many times would “Hello World” be displayed when the following is executed? ShowHelloWorld a=0 display “Hello World” do while a <5 display “Hello World” asa+1 loop end a? bé cs d none (Phncaton ot 6 erist: MayiJune 2017 8 Aprogram contains an array that holds all the names of the days of the week Which of the following ts true? a The highest subscript is 6 b The highest subscript is 7 c The lowest subscript ts 1 d The highest subscript is 12 9 The following equation would result in an answer of x= 38 (45 mod 2) + 99\2-16*2 a 36 b 55 © 104 d 110 10 When you ask multiple questions before an outcome is determined, you create a condition. a dual-alternative b nested ¢ single-alternative d_ compound 11. How would you set up the following arithmetic equation? Maria bought 10 notebooks costing 5 Rand each and 5 pens costing 2 Rand each How much did Mana pay? a payment = notebooks + pens b payment = (notebook * 5) + (pens * 2) ¢. payment = (notebook + pens) * 5 * 2 d_ none of the above 12 Objects often need to hold ___ about themselves. a scope b. information member d reference 13 ____ are the charactenstics that define an object a Instances b Attnbutes c Behaviors d Methods 7 orssis MaylJone 2517 14 Which of the following ts not true about count controlled and sentinel- controlled loops? a. While loops are the natural implementation choice for sentinel-controlled loops b A loop cannot be both count-controlled and sentinel controlled ¢ Ifthe number of iterations for a loop depends on certain condition or event becoming true, then one should use a sentinel-controlled loop d_Ifone knows exactly the number of iterations for a loop, then one should use a count-controlied loop 15. How many times would “Programming ts fun” be displayed when the following 1s executed? ProgramminglsFun x=2 y=3 do x=x+1 do while y <=5 display “Programming is Fun” y=y+2 loop display “Programming is Fun” loop until x = 6 display “Programming 's Fun” end a7 b6 cs d_ infinite Question 3- Completion [15] Complete each statement. 1 Test data must include a sample of every category and must also be 2. A group of related characters that conveys meaning is called a 3. Lines can be read from a file until the character is found, which indicates that the file doesn’t contain any data that has not been read. 4A is made up of several fields 5 Inanif statement the clause Is executed when the condition is not TRUE 8 sorts Mayllune 2017 Encapsulation is an OOP feature that is possible by making use of the access specifier o 7. The 1s the steps to solve a problem and the pseudocode Is the way in which these steps are expressed 8. Each case !s followed by one or more statements that are executed if the value of the case matches the value of the statement's expression 9. The value of result will be when the following nested for loop has finished executing. for x = 4 to 0 step -2 fory =x to 7 step 2 result =x +y next y next x 40 Programming often involves a set of instructions a number of times 11 To achieve the intended results, the programmer compiles a set of to test the logic 12 Post-test loops evaluate a loop condition located at the of a loop body. 13. The symbol is used to indicate exponentiation 14. The value of answer will be __ when the following nested for loop has finished executing 30 for w 1 to 5 step 2 fory=1tow answer =a+b-y +2 b=b-4 next y next W 15 When working with arrays, you can use in several ways To hold the size of an array, as the array values, and as a subscript rossi Mayltune 2017 Question 4 [55] The price of hiring a car per day from the Reliable Car Hire Company depends on the type of car the customer hires The customer ma choose between small (S), medium (M) and large (L) cars as shown below Size of car | Dally price in Rand Ss 100 M 260 L 400 The user is asked to enter the type of car he or she needs as well as the number of days it will be hired. Calculate and display the total amount the customer has to pay, using a nested if statement At the moment, there 1s a special offer of a 12.5% discount for hiring a small car Display error messages if user enters Incorrect data. Complete the planning and IPO provided in Appendix A, write the algorithm to solve the problem Use the following test data and provide the output Type of car Number of days Small 4 Large 3 Grand 9 Medium K Paver od 10. rersst Mayne 2017 Appendix A Question 1 - True/False Question 2 - Multiple Choice Mark correct choice with X Mark correct choice with X 1[T IF 1] af[bfela 2)/T/ F 2) a b c d 3 T F 3 a b c d (egeact( cio Ea a4|al|pf[el|d 5 T FE 5 a b e | d 6 T F | 6 a b eid 7 T FE 7 a b c d 8 T F 8 a b c qd 9|TlF 9{ajfetfeld | 10 | T | F wo[a[bf[eld ial T F "1 a b c d 12 T F 12 a b c d 13 T F 13 a b c d 14 | T F 14 a b c d 1s | T|F wilal[btfela Question 3 - Completion - Write down the correct phrase only rorssis Mayne 2017 Question 4 [55] Description Type Variable name | Input / Output ee Input Processing Output roristy Mayliune 2017 lortsit Mayidune 2017 o UNISA 2017 (rea IIDC Examination ponoe — ‘Student number | Sumame Fist Names Subject cate ot pour L_ [fe umber of oper Contre Date ‘This sto cerfy that I have read the nles govemng he examsnations as Set out on Ue inde ‘cover of ths examination ansiver book and in the examnation instruchons That the information supplied by re 9 ths answer book s correct and vale {undertake to adhere to the procedures, rules and requialions ofthe Unversity of South Afnca as published inthe official brochures attendance register (university copy) UNISA Signature of candidate 10 Number I I Batch No 28O0QO1SMCD sonore of nvataor a TI UWS gators personel number by the lnvgiator NOTE Not a vad documant it not complet Filln/MCQ. Examaation penod i ao t fi stutent number [_]

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy