CSCI 1103 Columbus State Community College Python Exam Practice
QUESTION 1What is the index value of the first item on a list? A.-1B.0C.1D.It depends on how many items are on the list.1 points QUESTION 2What discount rate will be applied to the purchase_price in this code snippet?A..01 (1%).B..02 (2%).C..05 (5%).D..10 (10%).E.No discount will be applied.F.There is at least one syntax error in this code, therefore, the code will not run.1 points QUESTION 3What does Uncle Bob Martin believe to be true about code? Choose all correct answers.A.Code has changed very little. The pace of evolutionary gains in the field are due to the evolution of the hardware—not the programming languages.B.Code has evolved at an incredible pace over the years and it is because of these developments in code that the industry itself has made the advances that it has.C.Uncle Bob compares coding to the work that was done by scribes in ancient cultures.D.Uncle Bob believes that the best programmers are those who have a mathematics background. 1 points QUESTION 4What is the purpose of the ‘import’ statement in Python?A.The ‘import’ statement allows us to retrieve a stream of data from a website.B.The ‘import’ statement allows us to read the contents of a text file into a variable.C.The ‘import’ statement allows us to include a library of other code and functionality to be used by the program we are writing.D.The Python language does not support the ‘import’ statement.1 points QUESTION 5What is meant by computer-generated random numbers being "pseudorandom"?A.‘Pseudorandom’ is the name of the algorithm that Python uses to generate random numbers.B.Pseudorandom numbers are numbers that are generated by a math library written in the pseudocode programming language.C.The Python programming language is not capable of generating pseudorandom numbers.D.Pseudo randomness means that the numbers generated by any algorithm are not truly random; they follow a pattern that can be known. 1 points QUESTION 6What is a floating-point rounding error?A.A rounding error occurs when there are more digits than a floating-point number allows. The leftover digits are omitted, and the number is rounded.B.There is no such concept as “rounding errors” in floating-point numbers because floating-point numbers can represent any value, no matter how large it is.C.Rounding errors occur when a programmer applies the wrong rounding function to a variable type that doesn’t support rounding.D.Rounding errors occur only with variables that contain Boolean values.1 points QUESTION 7Put the following hardware in chronological order of when they were created (from earliest to most recent). - A. B. C. D. E. F. G. H. I. Apple-1
- A. B. C. D. E. F. G. H. I. ENiAC
- A. B. C. D. E. F. G. H. I. IBM PC
- A. B. C. D. E. F. G. H. I. IBM System/360
- A. B. C. D. E. F. G. H. I. DEC VAX
- A. B. C. D. E. F. G. H. I. Apple Macintosh
- A. B. C. D. E. F. G. H. I. Raspberry PI
- A. B. C. D. E. F. G. H. I. Cray-1 Supercomputer
- A. B. C. D. E. F. G. H. I. The British Bombe 1 points QUESTION 8What is the result of the following code snippet? A.JessicaB.FerretC.This code will not run because you cannot mix data-types. Here we have four strings and a floating-point number. This is not allowed in a Python list.D.You will receive a run-time error. 2 points QUESTION 9Your friend is writing a Python program to randomly provide the user with an inspiring quote. Unfortunately, your friend is a terrible programmer, and you promised to help them with their program. Basically, there is a list of inspirational sayings in the code, and the program enters a loop and gives the user a random quote. The program is then supposed to ask the user if they want another quote. If they answer anything other than ‘y’ the program ends. There’s one more requirement, the program needs to automatically adjust the maximum random numbers value returned to match the total number of quotes. Below is the code that was written. You are to copy the code shown below (between the start and end lines) into your Python editor or IDE, fix the code so that it works, and copy the correct code into the essay box below. Make sure to test the code fully to ensure it is truly working. ***** Start of Code *****# sayings must be a list of sayingssayings = 'Today will be a wonderful day!','You are going to realize your dreams!','Soon your ideas will be appreciated by others!','Doors are opening because of your hard work!','Your dreams are about to come true.'count_sayings = 10get_saying = true# enter into a loop while the user wants to continue to playwhile get_saying = true:saying_index = randint(0, count_sayings) # get a random index valueprint('\n')print('----- Your Saying for Today -----')print(sayings) # print the random sayingprint('\n')user_response = 'Would you like another inspirational saying? (y/n) 'if response = 'y':saying = False;#print final message as the game play ends.print('Thank you for playing, please come again.')***** End of Code ***** Running correctly, the output from your application should appear as follows: -- Font family --Andale MonoArialArial BlackBook AntiquaComic Sans MSCourier NewGeorgiaHelveticaImpactSymbolTahomaTerminalTimes New RomanTrebuchet MSVerdanaWebdingsWingdings-- Font size --1 (8pt)2 (10pt)3 (12pt)4 (14pt)5 (18pt)6 (24pt)7 (36pt)-- Format --HeadingSub Heading 1Sub Heading 2ParagraphFormatted Code-- Font family ---- Font size --Path: pWords:05 points QUESTION 10What will be the result of the following code snippet?A.[‘Kelsey’, ‘Alex’, ‘David’]B.[‘Phoebe’, ‘Alex’, ‘Kelsey’]C.[‘Kelsey’, ‘Phoebe’, ‘Alex’]D.This code contains a syntax error and will not run.2 points QUESTION 11Uncle Bob Martin talks about “professionalism” in the field. What does Uncle Bob believe we must do to professionalize the field of computer science? A.We must hire only those individuals who are college educated. We raise the bar of the profession by ensuring an educational standard is met by all who call themselves programmers.B.We must develop and establish the rules ethics, and disciplines in the field that programmer must follow. Otherwise, this will be forced upon us by politicians after some program or programmer kills many people through their bad code.C.We must go back to the 60s when it was mature people who were recruited from the fields of mathematics, physics, and other sciences. Their knowledge and maturity will raise the professional bar for everyone else.D.We must develop a certification exam and require all programmers in the profession to take and pass the exam before they can practice their craft. This would be no different than a CPA, Lawyer, or a Doctor. 1 points QUESTION 12What is the maximum number of items that can be placed on a list?A.Theoretically, there is no limit to the number of items that can be placed on a list.B.The maximum number of items that can be placed on a list is 32 million.C.The maximum number of items that can be placed on a list is 64 million.D.The numbers of items that can be placed on a list depends on the data-types for those items. Strings have a lower max limit than do numeric data-types. 1 points QUESTION 13How can I know how many items are in a list?A.The only way to know is to loop through all the items in a list and count them.B.You can use the numberOf() function to return the number of items in a list.C.You can use the list_items() function to return the number of items in a list.D.You can use the len() function to return the number of items in a list.1 points QUESTION 14Floating-point numbers are understood by the computer as?A.Base-10 numbers.B.Scientific notation.C.Integers.D.Hexadecimal values.1 points QUESTION 15What is a Boolean?A.Boolean is a data-type having only two values: True and False.B.Boolean is a data-type having three values: True, False, and NULL (or no value).C.Boolean, though true and false, does not exist in the Python language.D.Boolean is a conditional statement.1 points QUESTION 16In the history of computing, what is a Raspberry PI?A.Raspberry PI is a programming language used primarily for micro devices.B.Raspberry PI was the nickname given to the computations used by NASA.C.The Raspberry PI is a credit card-sized computer popular with students and hobbyists.D.It’s a pie. 1 points QUESTION 17If I know how many times a loop needs to iterate, which loop is the best choice?A.The for loop.B.The while loop.C.The for each loop.D.The switch statement.1 points QUESTION 18In this history of computing what made the ENIAC computer so revolutionary?A.ENIAC is the forefather of today’s all electric, digital computer.B.ENIAC was the first personal computer to be built.C.ENIAC was the name given to Intel’s first general-purpose microchip.D.The ENIAC name comes from an early science fiction story and was used to help decode enemy messages during the second world war.1 points QUESTION 19The statements under (that belong to) an if condition, elif condition, or else condition are all indented. Why is this important?A.The indenting is a style guide for Python. It’s not required but strongly encouraged in the Python language.B.Indenting is required by Python to show that statements belong to or are contained within a parent statement like the if, elif, or else.C.Indenting is the way we comment our code in Python. If code is indented, it is commented out.D.You should never indent your code in Python. It is not allowed and will cause errors.1 points QUESTION 20What is a list used for in Python?A.Lists are a data structure in Python that is capable of holding any number of numeric values. However, lists cannot contain string data.B.Lists are libraries of code that can be included in our programs.C.Lists are not used in Python.D.Lists allow us to represent/hold multiple values (more than one) in a single variable.1 points QUESTION 21In the history of computing, how was the term ‘computer’ originally used?A.‘Computer’ is a term used always for a machine that performs repetitive calculations.B.‘Computer’ was originally a term used for machines that manufactured textiles.C.‘Computer’ was the term used for early census-taking devices.D.‘Computer’ was previously a job title, mostly women who performed repetitive calculations. 1 points QUESTION 22How do you comment your code in Python?A.Use double slash characters: // to begin a comment.B.Use the hash character: # to begin a comment.C.Indent your line. By indenting you are telling the compiler to ignore that particular line of code.D.Python does not allow the use of comments in code. Everything in a program is treated as code and logic.1 points QUESTION 23What will be the result of the following code snippet?A.Any random integer value from 0 through 10.B.Any random integer value from 1 through 9.C.Any random range of numbers (integers and floating point) from 0 through 10.D.Any random integer value from 0 through 9.1 points QUESTION 24What will be the result of the following code snippet?A.This will print ‘current value equals: ‘ plus the value of the current_value variable 10 times.B.This will not run because I did not initialize the variable current_value before the start of the while loop.C.This will not run because there is a syntax error in the code.D.This is an example of an infinite loop.2 points QUESTION 25I want to test the values of two variables with each other to determine if they are not the same (no equal to), what operator would I use in the if statement? A.==B.< or >C.=D.!=