Consider the three code segments. What is the program output…
Consider the three code segments. What is the program output with execution input of 1111, followed by a second input of 1234? Block-Based Pseudo-Code The pseudocode initializes pin to “0000” and repeats until pin equals “1234”. It displays “Enter PIN”, accepts user input, and checks the value. If correct, it displays “Proceed”; otherwise, it displays “Re-enter PIN” and requests input again. Python Program-Code pin = “0000”while (pin != “1234”): pin = input(“Enter PIN”) if (pin == “1234”): print (“You may proceed”) else: pin = input(“Re-enter PIN”) Text-Based Pseudo-Code pin ← “0000”REPEAT UNTIL (pin == “1234”){ DISPLAY (“Enter PIN”) pin ← INPUT () IF (pin == “1234”) { DISPLAY (“Proceed”) } ELSE { DISPLAY (“Re-enter pin”) pin ← INPUT () }}
Read DetailsThe figure below represents a network of physically linked d…
The figure below represents a network of physically linked devices, labeled A through H. A line between two devices indicates a connection. Devices can communicate only through the connections shown. Device A is connected to devices B, D, and H. Device B is connected to devices A, D, and C. Device C is connected to devices B, D, and F. Device E is connected to devices F and G. Device F is connected to devices C, E, G, and H. Device G is connected to devices E and F. Device H is connected to devices A and F. What is the minimum number of connections that would need to be removed from the network in order for device A to not be able to communicate with device F?
Read DetailsConsider the three code segments. What is the output of the…
Consider the three code segments. What is the output of the programs after they are executed 100 times? Block-Based Pseudo-Code The pseudocode assigns x a random integer from 1 to 5. If x MOD 2 equals 0, it displays “even”; otherwise, it displays “odd”. Python Program-Code from random import*x = randint (1,5)if (x % 2 == 0): print (“even”)else: print (“odd”) Text-Based Pseudo-Code x ← RANDOM (1, 5)IF (x MOD 2 == 0){ DISPLAY (“even”)}Else{ DISPLAY (“odd”)}
Read DetailsA student wrote the following procedure to calculate the sum…
A student wrote the following procedure to calculate the sum of the integers from 1 to 5 . Throughout the block of code there are nested blocks of code, as follows. [begin block] Line 1: PROCEDURE sumOfInts [begin block] Line 2: [begin block] sum ← 0 [end block] Line 3: [begin block] count ← 1 [end block] [begin block] Line 4: REPEAT UNTIL [begin block] count greater than 5 [end block] [begin block] Line 5: [begin block] sum ← sum + count [end block] Line 6: [begin block] count ← count + 1 [end block] [end block] [end block] Line 7: [begin block] RETURN [begin block] sum [end block] [end block] [end block] [end block] The student later decides to modify the procedure to calculate the sum of the integers from 1 to max, which represents any positive integer greater than 1. Which of the following changes should be made to the procedure to meet the student’s goal? I. The procedure should take max as an input parameter. II. The condition in the REPEAT UNTIL block should be changed to count max. III. The condition in the REPEAT UNTIL block should be changed to max 5.
Read Details