Python Final

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

Which one is the proper for loop syntax in Python?

for i in range(1, n):

How to define a static method in Python?

using @staticmethod decorator

What is the result of 5 & 3 in binary?

1

An object is an BLANK of a class.

Instance

The self keyword in Python is used to refer to the BLANK of an object within a class.

Instance

Is Python code compiled or interpreted?

both compiled and interpreted

There are three major pillars on which object-oriented programming relies: BLANK, inheritance, and abstraction (= polymorphism).

encapsulation

To define a tuple containing the values 1, 2, and 3, you would write:

(1,2,3)

Which of the following operators is used for exponentiation in Python?

**

Which operator is used for string concatenation in Python?

+

In object-oriented programming, BLANK is the process of creating objects that inherit properties and behaviors from a class.

Inheritance

What is the result of 3 <<2 in binary?

12

What is a tuple in Python?

An ordered collection of elements, immutable and indexed.

In object-oriented programming, an BLANK is a blueprint for creating objects.

Class

The BLANK statement is used to skip the current iteration of a loop and proceed to the next iteration.

Continue

In a Python dictionary, keys must be:

Immutable

Which one is not an advantage of encapsulation of object-oriented programming?

Sensitive

What is the purpose of the break statement in Python?

To terminate the current loop and continue with the next iteration.

In Python, how can you emulate a "switch-case" statement?

Using if-elif-else statements

Is Python case sensitive when dealing with identifiers?

Yes

In Python, to create a child class that inherits from a parent class, you use the keyword BLANK

class

Python is usually called an BLANK language, however, it combines compiling and interpreting. When we execute a Python source code with extension BLANK compiles it into a bytecode. The bytecode is a low-level platform-independent representation of the source code with BLANK format, however, it is not the binary machine code and cannot be run by the target machine directly. In fact, it is a set of instructions for a virtual machine which is called the Python BLANK.

compiled, pyc, binary, compiler

Encapsulation is the concept of bundling BLANK and methods into a single unit.

data

To emulate a switch-case statement in Python, you can use a series of BLANK statements to perform different actions based on the value of an input.

if-elif-else

Which type of Programming does Python support?

object-oriented programming, structured programming, functional programming d) all of the mentioned

To add a new key-value pair 'age: 25' to an existing dictionary named person, you would use the following code:

person ['age] = 25

To access the value associated with a key 'name' in a dictionary named person, you would write:

person['name']

The double underscore prefix before an attribute or method name in Python is used to indicate BLANK access.

private

Which access modifier in Python allows an attribute or method to be accessed only within its own class and derived classes?

protected.

In Python, the default access modifier for class members is BLANK.

public


Ensembles d'études connexes

EMT Class - Ch 7 quiz: Life span Development

View Set

Wiley Ch 10 - Muscular Tissue (complete)

View Set

Organizational Behavior Final Exam

View Set

Money, Inflation, Quantity Theory

View Set

Nutrition Chapter 5: fats and lipids

View Set