Search Header Logo

ONE 6th FORM Python

Authored by Lorna Jarrett

Computers

11th Grade

Used 1+ times

ONE 6th FORM Python
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

14 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the primary purpose of a function in Python?

To store data

To perform a specific task and return a result

To create a new data type

To organise code into classes

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In object-oriented programming, what is encapsulation?

The ability to define multiple methods with the same name

The concept of hiding the internal state and requiring all interaction to be performed through an object's methods

The process of creating a new class from an existing class

The ability to use a class in multiple programs

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a method to get user input in Python?

input()

read()

scan()

fetch()

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code snippet? ```python def add_numbers(a, b): return a + b result = add_numbers(3, 5) print(result) ```

35

8

15

Error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is NOT a built-in data type in Python?

List

Stack

Tuple

Dictionary

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct syntax to define a class in Python?

`class MyClass:`

`def MyClass:`

`create MyClass:`

`new MyClass:`

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you ensure that a user inputs a number in Python?

Use `int(input())` and handle exceptions

Use `float(input())` without handling exceptions

Use `str(input())` and convert later

Use `input()` and assume the user will input correctly

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?