Diagnostic Test

You might also like

Download as pdf
Download as pdf
You are on page 1of 9
10122122, 9:55 AM Programming 3 Diagnostic Quiz Programming 3 Diagnostic Quiz he intention is to get a feel of your current knowledge and understanding in Programming Hi, Maria Yuki. When you submit this form, the owner will see your name and email address. * Required 1 Which of the following is the closest description of the problem that the code solves? * (1 Point) SET x T0 0 WHILE x < § DO RECEIVE v FROM (INTEGER) KEYBOARD IF v = 3 THEN SET x TOx+1 END IF END WHILE Read in five numbers Read in the value 3 five times. 7 Read in and add up five numbers Read in numbers until a 3 is received itps:iforms office. comipagesiresponsepage aspxid=cYWp TercOUIPsOvdXclp-SdtYLDjZ8)MIADs4208VUMKNUMDFWNDK4VKMAW)RZS)IFOQzk 19 10122122, 9:55 AM Programming 3 Diagnostic Quiz What is the output of the code below? * (1 Point) void Main() { int result = Compute(S, 3); DISPLAY("The result is " + result); a int Compute(int a, int b) { RETURN Increment(a) + Increment (b); } int Increment(int a) { RETURN a + a5 a; The result is 8 The result is 10 The result is 13 The result is 16 The result is 11 What will the computer display after it has executed the following code? * (1 Point) SET a 107 SET b T09 SET a TO b SEND a TO DISPLAY True itpsiorms office. comipagesiresponsepage aspxid=cYWp TercOUIPsCvdXclp-SdtYLD28)MIADsaZ08VUMKNUMDFWNDKAVKMAW)RZS\IFQzk... 218 10122122, 9:55 AM Programming 3 Diagnostic Quiz False 7 9 v 4 What will the program display after an input of -1? * (1 Point) RECEIVE x FROM (INTEGER) KEYBOARD IF x > 3 THEN SEND “Boo” TO DISPLAY ELSE SEND “-hoo” TO DISPLAY ENDIF SEND “!” TO DISPLAY 1 Boo “hol Boo-hoo Which code fragment, inserted in the position indicated between the WHILE and the DO keywords would ensure that the following loop body was only executed 3 times? * (1 Point) itpssiorms offic. comipagesiresponsepage aspxid=cYWp TercOUIPsvdXclp-SdrtYLD28)MIAD$aZ08VUMKNUMDFWNDKAVKMAW)RZSWIFQzk... 3/8 10122122, 9:55 AM Programming 3 Diagnostic Quiz SEI x 10 0 WHILE DO What will the following code output? * (1 Point) SET count TO 0 SET x T0 9 WHILE x > 7 DO SET count TO count + 1 Sele 0 Xe ed END WHILE SEND count TO DISPLAY itps:iorms office. comipagesiresponsepage.aspxid=cYWp TercOUPsvdXclp-SdtYLDZ8)MIAD$aZ08VUMKNUMDFWNDKAVKMAW)RZS\IFQzk... 4/8 10122122, 9:55 AM Programming 3 Diagnostic Quiz What will the following code output? * (1 Point) SET count TO 0 SET output TO “” WHILE count < 3 DO SET count TO count + 1 SET output TO output & “x” END WHILE SEND output TO DISPLAY no output The following code has been written to input 10 numbers and add them up and write out the total. Do you think it's ok, or if not, which line will be the cause of the first compiler or run-time error? * (1 Point) #1 FOR LoopCount FROM 1 TO 10 DO #2 RECEIVE nextNumber FROM (INTEGER) KEYBOARD #3 SET total TO total + nextNumber #4 END FOR #5 SEND nextNumber TO DISPLAY No error Line 1 itps:iorms office. comipagesiresponsepage aspxid=cYWp TercOUIPsvdXclp-SdrtYLDj28)MIAD$aZ08VUMKNUMDFWNDKAVKMAW)RZS\IFQzk... 5/8 10122122, 9:55 AM Programming 3 Diagnostic Quiz Line 2 lines Line 4 Line 5 Which code fragment will successfully complete the following program which prints each wizards name one after the other. * (1 Point) SET marauders TO [“Padfoot”, “Moony”, “Wormtail”, “Pro SET wizard T0 0 REPEAT length(marauders) TIMES SEND TO DISPLAY SET wizard TO wizard + 1 END REPEAT marauders[1] marauders marauders{wizard] 7 marauders{"Prongs"] Padfoot What will the computer display after executing the following program if the user enters the number 3 for the first receive and 4 for the second? * (1 Point) itpssiorms office. comipagesiresponsepage aspxid=cYWp TercOUIPsvdXclp-SdtYLDj28)MIAD$4Z08VUMKNUMDFWNDKAVKMAW)RZSJIFQzk... 6/8 10722822, 955 AM Programming 3 Diagnoste Quiz RECEIVE a FROM (INTEGER) KEYBOARD RECEIVE b FROM (INTEGER) KEYBOARD SET b TO a SET a TO b SEND a TO DISPLAY SEND b TO DISPLAY 34 43 3B 44 30 04 Rate your programming skills * kee Given the variables ‘harry’ and ‘hermione’ that contains 5.4 and 5.6 respectively, which represent their height, what will be the output of the following code? * (1 Point) itpsiorms office. compagesiresponsepage.aspxid=cYWp TercOUPsQvdXclp-SdtYLDx28)MIAD$aZ08VUMKNUMDFWNDKAVKMAW)RZS\IFQzk... 7/8 10122122, 9:55 AM Programming 3 Diagnostic Quiz IF harry > hermione THEN SEND "Harry is taller" TO DISPLAY ELSE SEND "Hermione is taller" TO DISPLAY END Harry is taller Hermione is taller 7 Harry is taller Hermione is taller We need to determine whether someone is of working age. For this purpose we can start working when we are 16 and stop working when we are 65. We have the following if statement. Assuming that the person's age is held in the variable personsAge, which is the best Boolean expression for this if statement? * (1 Point) IF THEN ELSE END IF personsAge < 16 OR personsAge >= 65 personsAge < 16 OR personsAge > 65 personsAge >= 16 AND personsAge < 65 personsAge >= 16 AND personsAge <=65 itps:iorms office. comipagesiresponsepage aspxid=cYWp TercOUIPsvdXclp-SdtYLDj28)MIADsaZ08VUMKNUMDFWNDKAVKMAW)RZS\IFQzk... 8/8 10122122, 9:55 AM Programming 3 Diagnostic Quiz (Send me an email receipt of my responses ‘This content is created by the owner of the form. The data you submit will be sent to the form owner. Microsoft is not responsible forthe privacy or security practices ofits customers, including those of this form owner. Never give out your password Powered by Microsoft Forms | Privacy and cookies | Terms of use itpssiorms offic. compagesiresponsepage.aspxid=cYWp TercOUPsQvdXclp-SdtYLDjx28)MIAD$aZ08VUMKNUMDFWNDKAVKMAW)RZS\IFQzk... 918

You might also like