Intro to Python for Security

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Code that is read from left to right and top to bottom while checking and executing each line in the process uses which of the following methods? A. Interpretation B. Compilation C. Encapsulation D. Obfuscation

A. Interpretation PY-01-P1 Slide 9

What should be added to the following function to print the value 20? x = 10 def func(): x = 20 func() print(x) A. The command "global x" B. The command "main x" C. The command "self x" D. The command "pass x"

A. The command "global x"

What will the value of X be? X = 10 if True and False: X += 10 print(X) A. 20 B. 10 C. The code is erroneous D. X cannot be a variable

B. 10

Which of the following should be used to iterate over a list and print its items separately? A. While loop B. For loop C. If condition D. Dictionary

B. For loop PY-03-P1 slide 6

When sending text via the socket library to a server, why should the text be encoded? A. The data must be encoded to ASCII. B. The data must be encoded with SHA. C. It must be passed as a byte object. D. Because it's code.

C. It must be passed as a byte object.

What will happen when you run the following code? with open("MyFile.txt", "w") as file: file.write("Hello World") A. "Hello World" will be appended to the file. B. An error will occur because "w" allows reading the file. C. The file will be overwritten with "Hello World". D. An error will occur because an exception was not added.

C. The file will be overwritten with "Hello World".

What is the purpose of the following expression: If __name__ == "__main__" A. To check the name of the file. B. To make sure the first function in the file is executed. C. To check if the file is the main file in the project. D. To check if the file is imported or directly executed.

C. To check if the file is the main file in the project.

What will the output of the following code? counter = 0 for i in range(0, 10, 4): break counter += 1 print(counter) A. 10 B. 2 C. 3 D. 0

D. 0

What will happen when the following code is executed? if True: print("Hello") A. It will print the word Hello. B. It won't run because "if" wasn't invoked. C. It won't run because it can't understand "True". D. It will display an indentation error.

D. It will display an indentation error.

When creating client-server communication scripts, which one should be executed first? A. Both must be executed at the same time. B. The client. C. It doesn't matter. D. The server.

D. The server.


संबंधित स्टडी सेट्स

SENTENCES : Fragments, identifying

View Set

college personal finance semester test

View Set

Chapter 4, 5 & 6 Nutrition- Kelly Owen

View Set

4.5 Maritime Empires Maintained and Developed

View Set

Choisissez (entourez) la bonne réponse

View Set