Question: Question 1 (2 points) Python variable names can only be numbers and letters. True False Question 2 (2 points) in Python, what symbol is used









Question 1 (2 points) Python variable names can only be numbers and letters. True False Question 2 (2 points) in Python, what symbol is used for the concatenation operator? O + Os Question 3 (2 points) The value 55.0 would evaluate to the data type. string integer floating point decimal Question 4 (2 points) An interactive shell allows you to enter Python commands that are run immediately. True False Question 5 (2 points) All if statements contain a condition True False Question 6 12 points) The Boolean data type has only two possible values. True False Question 7 (2 points) All if statements are followed by an else statement. True False Question 8 (2 points) In a while loop, the condition is always checked at the end of the loop. True False Question 9 (2 points) A function without a return statement always returns the value None. True False Question 10 (2 points) What would be the output of the following code? amount=100 quantity=10 def caldx); amount=x calc(quantity) print(amount quantity) 10 100 1000 10000 Question 11 (2 points) if you had a function named mixerl in a module named song, how would you call the function after importing song? call song.mixer mixer mixer.song) song.mixer) Question 12 (2 points) A try statement contains the code to execute in case an error occurs in a program True False Question 13 (2 points) A parameter is a variable that an argument is stored in when a function is called. True False Question 14 (2 points) What is the result of the following code? names = ['John Sam 'Maggie', 'Cindy, Mike'] def change/mylist): moreNames = mylist moreNames.remove(Sam) return moreNames moreNames = changelnames) print(names) print(moreNames) O John 'Sam, "Maggie, Cindy: "Mike'] John: "Maggie, Cindy. 'Mike' O John Maggie, Cindy. 'Mike' John. 'Maggie, Cindy. 'Mike'] John Sam. "Maggie, Cindy. 'Mike' John. "Sam. Maggie, Cindy, Mikel An error will occur Question 15 (2 points) Python lists are indicated by square brackets curly braces parentheses commas Question 16 (2 points) The only difference between a list and a tuple is that a list is indicated by square brackets and a tuple is indicated by parentheses. True False Question 17 (2 points) Using multiple assignment notation for lists can only be done if the number of variables and the length of the list are the same. True False Question 18 (2 points) The output of the following code is: cars=['Dodge Ford:Toyota: Honda Buick') printcars(1.01) Dodge Ford an error would be generated Toyota Question 19 (2 points) In Windows, forward slashes (/) are used as separators in paths. True False Question 20 (2 points) Since Linux and Windows use different separators in path names, what method can be used to create file paths in programs that need to work both in Windows and Linux? Ogetowd) method Ojoin() method Opath() method isabs) method Question 21 (2 points) You can change your current working directory by using the chdir) method of the os module. If you try to change to a directory that does not exist, the following will occur: The new folder will be created and your current working directory will be changed. You will be prompted by the program if you wish to create the new folder. The new folder will only be created if you have Administrator rights. A file not found error will occur. Question 22 (2 points) The file path notation ... means this location's parent folder. True False Question 23 (2 points) What is the result of the following code: import os filelist=0 os.chdir/G:\piano') for filename in os.listdinfos.getcwdf)) filelist.append(filename/ print/filelist) A list containing all of the files located in 'G:\piano A string containing all of the files located in C:\piano A list containing all of the files located in C:Windows\Users' An error will occur. Question 24 (2 points) The result of the following code is. errorFile = open('error.txt: w) errorFile.write('Division by Zero') errorFile.close errorFile = open('error.txt' W) errorFile.write('Incorrect Variable Type) errorFile.close errorFile = open('error.txt fileContent = errorFile.read() print/fileContent) Division by Zero Incorrect Variable Type Division by zero Incorrect Variable Type An error will occur. Question 25 (2 points) When using the shelve module to store data, the data is stored in plaintext format. True False Question 26 (2 points) If you had a list named books and you wished to save it as a python program which could be imported to another program, you could use which of the following code? fileObj = open('myBooks.py, w') fileObj.write(books =' + pprint.pprint/books) + ' ') fileObj.closel) O fileObj = open('myBooks.py, Y) fileObj.write(books =' + pprint.pformat(books) + " ") fileObj.closel) fileObj = open('myBooks.py. W) fileObj.write('books =' + pprint.pformat books) + " ") fileObj.close O fileObj = open('myBooks.py, w') fileObj.write(books =' + pprint.pformat(books) + " ") fileObj.closel) Question 27 (2 points) The readlines) method returns a Olist tuple string dictionary Question 28 (2 points) What line of code would be used to see if a file named errorlog.txt existed in the root directory of the D drive? os.path.isdir('D:\errorlog.txt') os.path.isfile('D:Xerrorlog.txt") os.path.fileExists(D:\\errorlog.txt') Oos.isfile('D:\errorlog.txt') Question 29 (2 points) Bash variables are case sensitive. True False Question 30 (2 points) Bash variables are all stored as strings. True False Question 31 (2 points) x=100 y="Tom" Which of the following statements return true? O 12000]) && ][ $name == "Cindy" && (Sjob == "Manager" || Sjob == "Programmer") 11 then echo You may enter! else echo Entry Denied! fi You may enter! Entry Denied Question 41 (2 points) The basic unit of PowerShell functionality is a function Cmdlet parameter Class Question 42 (2 points) PowerShell is similar to Bash and is text based. True False Question 43 (2 points) Using PowerShell, to get a directory listing of the C drive, you would use which of the following Ois dir Get Childltem Path CV Get Child - Path C: Question 44 (2 points) The Write-Host command writes the output to the output stream pipeline console print device Question 45 (2 points) PowerShell variable are case sensitive. True False Question 46 (2 points) in PowerShell, assume that you have a string variable named Sx containing the value "100"? Which if the following could you use to convert $x to an integer? $x = (int)$ $x = int($x) $x = parseInt(5x) $x = Cint($x) Question 47 (2 points) Which of the following would be used in a PowerShell if statement to check to see if the name was equal to "John" and the age was greater than 18? ($name == "John" and Sage > 18) ($name = "john" AND Sage > 18) ($name eg "John" && Sage gt 18) ($name.eq "John" AND Sage gt 18) Question 48 2 points) What would be written to the console with the following code if the user entered 25 as the price and 10 as the quantity? Sprice = Read Host Prompt "What is the price?" Squantity = Read-host - Prompt "What is the quantity?" Stotal = Sprice * Squantity Write Host Object Stotal An error would occur due to type mismatch. 250 25252525252525252525 35 Question 49 (2 points) In PowerShell, the Test Path command returns the contents of a file if the file exists. True OO False Question 50 (2 points) Which of the following PowerShell parameters can be used to execute PowerShell scripts from the Windows command line? -File -Execution Policy -Run -PS
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
