Python Exam

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

When accepting data in client-server communication, what is the meaning of recv(2048) A the length of the encryption key used in the meetings B: The limit for the amount of bytes to accept C: Receiving time in miliseconds D:The limit for the amount of words to accept

B: The limit for the amount of byte to accept

What would you use to convert one Python Data type to another? A: Casting B: Melting C: Moving D: Jumping

A: Casting

Which of the following operators in python will produce a modulo of two provided numbers?

%

dictionary = {"list": 1,2,3,4} dictionary[list]. append ([4, 5, 6]) for value in dictionary: print(value)

"list"

Difference between Tuple and List

tuple cannot be edited, tuples use paranthesis() and lists use square brackets[]

While performing the Echo Communication home project, the command socket.accept() crashed the script. What could be the problem?

A: The accept() command was not assigned with two variables

You wrote a calculator script that accepts user input from input(). In order to make the code work properly, which of the following must be done to get mathematical results?

A: input() should be converted to int for create mathematical operators

for I in range (1, 10, 4): if i = = 9: word = Bla" print(word) What is the output of this code?

Bla

Which of the following demonstrates a dictionary structure? A: x = {"David, "Cooper", 35} B: X = ("David", "Cooper, 35) C: X = {"firstname"; "David", "lastname", "Cooper, "age"; 35} D: None of these choices

C: X = {"firstname"; "David", "lastname", "Cooper, "age"; 35}

Which commands would you use to gracefully exit in case of an error?

Catch and Exit

What would be the output of the following code? names = ['Dave', 'john' 'Ben', 'Jud'] for the name in names; print(name) if name = = 'ben' break else: print ("All names were printed!") A: Dave, john, ben, jud, all names were printed B: Dave, John, Ben,All names were printed C: Dave, John D: Dave, john, Ben

D: Dave, john, Ben

what is the purpose of the None keyword in python?

Define a null variable or object

you installed PyCharm and started writing a little script that prints out "I love hacking with Python". however, PyCharm won't alllow running the script, what can be the solution to the problem?

Setting an interpreter

of the following, which is not an advantage of an interpreter compared to a compiler

Speed

what type of variable is the 'x' in the following code? x='15'

String

Which of the following is NOT a Python data structure?

Switch

What did the programmer forget in the following code? import dateline Myfile = open("myfile.txt", "r") print(Myfile.read()) Date = datetime.datetime.now() print("\n", Date.time())

The file needs to be closed to remove the security risk

What happens when running the following code? with open("Myfile.txt", "w") as file: file.write("Hello world")

hllo world is written inside myfile.txt

you wrote a script that dumps pdfs files from a chosen website into your desktop, However, the code crashes with an error. What is the most suitable approach to solve the problem?

implement a try-except statement

num_list = 1, 2, 3, 4 for num in num_list: num_list.append(num) print(num) what is the output of this code?

infinite loop

How would you assign a tuple to variable myTuble?

myTuble = (1, 2, 'name', 'time' )


Ensembles d'études connexes

Pediatric NCLEX Practice Questions (Exam 1)

View Set

AP Language Chapter 2 Terms w/ Examples

View Set

TestOut PC Pro: 1.2 Hardware Basics

View Set

Operations Management Final Exam Practice Problems

View Set

Microeconomics Exam #1 Test Review

View Set