Search Header Logo

Tutorat_8

Authored by Maritina Panagiotopoulou

Computers

University

Used 1+ times

Tutorat_8
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

8 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In Python, what is the primary purpose of a class?

To define the data type of a variable

To create instances of objects with specific attributes and methods

To provide a way to format strings

To define the encoding of Unicode characters

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements about F-strings in Python is correct?

F-strings are used for defining classes

F-strings are a way to format strings with variable values

F-strings are used for defining Unicode characters

F-strings are not supported in Python

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is true about methods in programming classes?

Methods are standalone functions not associated with any class

Methods define the behavior of objects in a class and are common to all objects of that class

Methods are unique for each object and cannot be shared between objects

Methods in a class are only for displaying object properties

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

How is a function defined in Python?

By using the function keyword

With the def keyword followed by the function's name and parameters

Functions in Python do not need to be defined

Using the return statement before writing the function body

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the findall() method return in Python?

A single match of the pattern

A dictionary containing all matches

The first group of matches in the pattern

A list of the entire matches of the pattern

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the outcome when using (?:...) in a regex pattern with findall()?

It captures the group and returns it as part of the result

The part of the pattern inside (?:...) is not captured but affects the matches

It causes an error in the findall() method

findall() ignores the entire regex pattern

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do functions affect the control flow in a Python program?

The control flow jumps to the function's code when called and returns after execution.

Functions prevent the program from executing any code.

Functions do not affect control flow in Python.

Control flow is interrupted permanently once a function is called.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers