0% found this document useful (0 votes)
11 views

Programming Techq Past Question

Programming

Uploaded by

Ron Dany
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
11 views

Programming Techq Past Question

Programming

Uploaded by

Ron Dany
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 6
SEPTEMBER, 2019 Candidate's index Number | CSC 102SW PROGRAMMING TECHNIQUES 2 HOURS Signature: UNIVERSITY OF CAPE COAST COLLEGE OF EDUCATION STUDIES SCHOOL OF EDUCATIONAL DEVELOPMENT AND OUTREACH INSTITUTE OF EDUCATION COLLEGES OF EDUCATION FIVE-SEMESTER BACHELOR OF EDUCATION (SANDWICH) PROGRAMME FIRST YEAR, END-OF-FIRST SEMESTER EXAMINATIONS, SEPTEMBER 2019 SEPTEMBER 4, 2019 PROGRAMMING TECHNIQUES 2:30 PM — 4:00 PM SECTION B Answer ANY FOUR (4) questions. 1. Using if-else/if-statements, write a short program in pseudocode that declares an integer variable called Number, input Number, then display "Yes" if Number == 1, display "No" if Number == 2, and display "Maybe" if Number Kwamina and Esi have decided to spend their free Saturday to go to the movies. Their mother insists that they pick a 13-rated movie. Each time they suggest a movie title, she asks them if it is 13-rated. If the answer is NO, they must go back to the list of movies and pick another one. If the answer is VBS, they can go to the movies. Use the case above to construct a Flowchart 3. Construct a flowchart for this program that reflects the following tasks: If(PayRate < 10) AND (Hours > 40) then Set OvertimeHours = Hours ~ 40 Set OvertimePay = OvertimeHours * 1.5 * PayRate Set TotalPay ~ 40 * PayRate + OvertimePay Else Set TotalPay ~ Hours * PayRate End If Page 1 of 2 4 A. Distinguish between sy B. What will be the output o 10, 8, 3, 2,1 1 Declare Score As Integer 2 Declare Grade As Character 3 Write “Enter Scor: 4. Input Score 5. Select case of Score 6 Case 10 7 Set Grade = "A" 8 Break 9 Case 9 10 Case 8 11. Set Grade="B" 12 Break 13 Case 6 14 Case 7, 15 Set Grade = "C” 16 Break 17 Case 5 18 Case 4 19 Case 3 20 Set Grade="D" 21 Break 22 Case 2 23 Case | 24 Set Grade="E" 25 Break 26 End Case 27 Write “Student Had Grade”+ Grade mntax errors and logic errors. f the code below if a user enters the following number scores: 5. Carefully study the code snippets below and give its output (a) 1 Declare Count As Integer 2 Write "Hello World" 3 For (Count = 5; Count < 4; Count++) 4 Write "Help me please, I'm a prisoner in a For loop!" 5 End For 6 Write "Goodbye" (b) 1 Declare Count As Integer 2 Declare Beans as Integer 3 Set Beans = 4 4 For (Count = 1; Count <= Beans; Count++) 5 Write "You are welcome to UCC programming "+ Count + “class 6 End For Page 2 of 2 =) Candidate’s Index Number SEPTEMBER 2019 CSC102SW PROGRAMMING TECHNIQUES 'Stenatura 1 HOUR Lo UNIVERSITY OF CAPE COAST COLLEGE OF EDUCATION STUDIES SCHOOL OF EDUCATIONAL DEVELOPMENT AND OUTREACH INSTITUTE OF EDUCATION FIVE-SEMESTER BACHELOR OF EDUCATION (SANDWICH) PROGRAMME, FIRST YEAR, FIRST SEMESTER QUIZ I, AUGUST 2019 SEPTEMBER 1, 2019 PROGRAMMING TECHNIQUES 1:30 AM — 2:30 AM. Answer all the questions For items 1 to 20, each stem is followed by four options lettered A to D. Read each statement carefully and circle the letter that corresponds to the correct or best option. 1. The program development cycle consists of all the following except ..... A. creating flowchart B. problem analysis C. program coding and debugging it D. program design Which of the following is not a basic control structure? A. The decision structure B. The loop structure C. The process structure D. The sequential structure we Which of the following is not classified as a decision/selection structure statement? A. If-else statement B. If-statement C. Select-case statement D. While-loop statement 4, Flowcharts use special symbols to display pictorially the flow of execution within a program. ‘Symbols used describe all the following except A. decision B. formula C. process D. starvend Page 1 of 4 5. What will be displayed when the variable Number = -1? If Number <0 Then Write "1" Else End if All B. 2 G3 D. Syntax Error 6. Algorithms can be expressed in all the following ways except .. A. arithmetic equations B. flowcharts C. pseudocode D. words 7. What is displayed when the following program segment is run? A=2,8=4 If (A == 2) AND (8 == 3) Then Write “Statement is true” End if A. “Statement is false” B. “Statement is true” C. Nothing is displayed D. True . Which of the following loop structures is used to repeat a section of code for an unknown number of times until a specific condition is met? A. For loop B. If-else statement C. Infinite loop D. While loop Which of the following expressions will evaluate to true when score = 45? A. score <= 60 AND score <= 100 B. score <= 60 OR score >= 100 C. score >= 60 AND score <= 100 D. score >= 60 OR score >= 100 The following are types of loop structures except A. Do-while loop B. For loop C. If-statement D. While loop Page 2 of 4 1 phe tak of hall wt thee eninge proryran, sensed ps 1 pl faye te pi, Meas Sin wise, spynepaiy St AE ws A compilation i dehnuulny 1 dep haainent eo WT it CL ie Le ee) r 1 dee tared © Initiglized 1) tinned 14 What will be Mopalnyeed iD Uae Ae beter i eae” 1 int A Declare number £5 Wheger 1, COW number © 1, number - Y epee) A Display Wella Wok 4. tnd Loop 6 td A. Hello Helle VW Hello Number © Helle World 1). Helle World 14. In the expronsion (2 4 4)/4 9 (4 1) whim pron wilh crept Cae At ne c° DT 15. All the following are valid identificrs exams A. dollar B. total ©. total number D. value 4 16. A loop that exists invide the body of aewhtaer lorry io caliee ‘A, do while loop B. inside loop C. nested loop D. while loop 17. Which of the following, is used to determine ter Aes Ge otrucion amie 2 om a executed? A. constant B. counter variable C. float D. identifier Pew bas 18. A loop that repeats endlessly because it has no terminating condition is called a(n) A. do while loop B. infinite loop C. nested loop D. while loop 19. What will be displayed if the code below is run? firstNumber = 2, secondNumber = 4 1. Start 2. Declare firstNumber, secondNumber, Average As Integer 3. Display “Prompt user to enter two numbers” 4. Input firstNumber, secondNumber 5. Average = (firstNumber + secondNumber)/2 6. Disploy Average 7.End pop> mas a 0. What will be the output of the following pseudo code? Input f=6,9=9 and set sum=0 Integer n iflo>f) for(n=f:n

You might also like