Python

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Given the following code what will be the output of the final print class Sales: def_init_(self, id): self.id=id id = 100 val = sales(123) print(val.id)

123

Given the following: str1 = "Hello"str2 = "World" Which of the following will generate the output: 'HelloWorld' ?

>>print(str1, str2)

Which of the following represents a distinctly identifiable entity in the real world?

An object

In Tkinter vocabulary, the word that describes how the instantiated item appears is called...

Attributes

For the XOR cypher, compared values are converted to binary because that makes it easier to compare text with text

False

In Tkinter, a label is an object but the frame which contains the label is not an object

False

In Tkinter, it is possible to associate multiple windows with a single frame.

False

In a Caesar Cypher, the base character list MUST be in alphabetical order.

False

In a Caesar cypher, when using upper case and lower case characters in the base character list, the lower case characters must precede the upper case characters.

False

Multiplicative cyphers are solved by changing they key evaluation from multiplication to division

False

One of the weaknesses of the Caesar Cypher is that spaces cannot be substituted thus revealing 1- and 2- character words in the encryption.

False

Python allows for GUIs but they are very privative in nature, inflexible, and not dynamic; similar to command line interfaces.

False

Tkinter interface looks very similar to Windows 10 interfaces

False

When creating a Tkinter widget, all widget properties must be identified with appropriate values.

False

While lambda is an anonymous function, it still requires a return statement

False

In Python 3.8, the GUI software Tkinter is always already available

False, you must import tkinter components to access them

In Tkinter, a window size can be effectively controlled with the inclusion of...

Frame

Widgets in Tkinter bear a strong resemblance to created objects in...

HTML XML Desktop Applications software such as .NET -All of these

Given the following: str1 = "Hello"str2 = "World"str3 = "How are you?" print("{} {}".format(str1, str2, str3)) What will display?

Hello World

Given the following: str = "Hello"print(str + "5") What will display?

Hello5

Given the following: str = "Hello"print(str * 3) What will display?

HelloHelloHello

Given the following: str1 = "Hello"str2 = "World"str3 = "How are you?" print("{} {} {}".format(str1, str2)) What will display?

IndexError

Given the Tkinter code: root = Tk() which of the following will create a label displaying a text?

Label = Label(root, text="This is text")Label.pack()

Multiplicative Cypher is superior to Caesar Cypher because

Multiplicative has different shift values for each character Multiplicative allows for significantly more key values than Caesar

Given the following: str1 = Hellostr2 = World Which of the following will generate the output: Hello World ?

None of these

Assume child is a subclass of Parent. Parent has an _init method. Which of the following will invoke the _init_ method in Parent from Child

Parent._init_(self) super()._init_()

n what environment will the following print command work? print "Hello", "World"

Python 2, all versions

Under which versions of Python will the following command fail? (Choose 2) str = "hello"print(f"{str}")

Python 3.5 Python 2

In which of the following cyphers is the decryption key always the same as the encryption key

ROT-13

Caesar Cyphers are easy to hack because...

The base character list is limited and shift value possibilities are finite

A lambda function can have multiple arguments but only one expression.

True

Caesar Cypher is solved by changing the original shift from plus to minus, or minus to plus

True

In Tkinter, it is possible to associate multiple frames with a single window.

True

In a Caesar Cypher, the sequence of the base character list is immaterial so long as both the sender and the receiver share the same sequence.

True

Tkinter is Object Oriented

True

When creating a Tkinter widget, all widget properties can carry their default values.

True

Given the following: str = "Hello"print(str % 3) What will display?

TypeError

Given the following: str = "Hello"print(str - 3) What will display?

TypeError

What is the output of the following: s= "\t\tWelcome\n" print(s.strip())

Welcome

Which of the following is the common term for the "thing" placed on a GUI form?

Widget

In Python, which symbol is used for XOR?

^

Which of the following is required to create a new instance of the class

a constructor

In Python 2, which of the following is NOT a base encoding?

base 100

Which of the following keywords mark the beginning of the class definition

class

The maketrans() function translate values of cyphers into plain text

false

The translate() function is useful for converting currency.DOLLARS into currency.EUROS

false

Given the following code, what will display? double = lambda x: x * 2print(double(5))

10

In Python, which symbol is used for exponentation?

**

Which of the following represents a template, blueprint, or contract that defines objects of the same type?

Class

Given the following code, which of these statements is TRUE? class A: def __init__(self, i = 0): self.i = i class B(A): def __init__(self, j = 0):self.j = j def main():b = B()print(b.i)print(b.j) main()

Class B inherits A, but the data field "i" in A is not inherited.

To create print enhancements such as next line and tab, Python uses the back-slash ("\") character for print control. Which of the following words describes this feature?

Escape character

The original Greatest Common Divisor algorithm was discovered by.

Euclid's

A lambda function can have multiple arguments and multiple expressions.

False

A lambda function can have one argument but multiple expressions

False

In Tkinter, a window's default will...

make a window that is only as big as it needs to be

Given the following: print(str1, str2) Which of the following describes the "(str1, str2)"?

parameter list

Given the following name = "Jane" Which of the following format directive commands will display properly?

print("My name is: %s" % name)

Given the following code, which of these statements is TRUE? class A: def __init__(self, i = 0): self.i = i class B(A): def __init__(self, j = 0):self.i = 5 self.j = j def main():b = B()print(b.i)print(b.j) main()

print(B.i) will display int 5

Given the following: str1 = "Hello"str2 = "World" Which of the following will generate the output: HelloWorld ?

print(str1 + str2)

Given the following: str1 = "Hello"str2 = "World" Which of the following will generate the output: Hello World ?

print(str1, str2)

In a Caesar Cypher, the key must be known by both the sender and the receiver. That makes Caesar [blank] encryption

synchronous

For the XOR cypher, compared values are converted to binary because that makes it easier to compare bits with bits

true

The maketrans() method creates a table between two lists

true

In Python 2, the following command is valid: val = base64.b64decode("hello") How is the same command written in Python 3?

val = base64.b64decode(b"hello")

Which of the following statements is most accurate for the declaration x = Circle()

x contains a reference to a circle object


Kaugnay na mga set ng pag-aaral

Chapter 13: Monopolistic Competition

View Set

Verbal, Dramatic, and Situational Irony

View Set

Chapter 10 - Ethical and Societal Considerations of Data Analytics

View Set

Multiple Choice Questions on John 1:1-18

View Set

Chapter 20, The Circulatory System: Blood vessels and Circulation

View Set