Mastering Python Basics

Mastering Python Basics

University

25 Qs

quiz-placeholder

Similar activities

kuis pertama

kuis pertama

University

20 Qs

FD Theory Python 2

FD Theory Python 2

11th Grade - University

20 Qs

MIDTERM EXAM (CSPL)

MIDTERM EXAM (CSPL)

University

20 Qs

Week 6 Quiz

Week 6 Quiz

University

20 Qs

Day 10 - ONLINE TEST - PL03 PYTHON PROGRAMMING

Day 10 - ONLINE TEST - PL03 PYTHON PROGRAMMING

University

20 Qs

Quiz1_7A

Quiz1_7A

2nd Grade - Professional Development

20 Qs

CodeHS Basic Data Structures in Python

CodeHS Basic Data Structures in Python

University - Professional Development

26 Qs

Python Functions and File Operations Quiz

Python Functions and File Operations Quiz

University

20 Qs

Mastering Python Basics

Mastering Python Basics

Assessment

Quiz

Computers

University

Hard

Created by

VedaSri Tutorials

Used 1+ times

FREE Resource

25 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What are the basic data types in Python?

int, float, str, boolean, list, tuple

int, float, str, bool, list, tuple, set, dict

char, float, array, dict

int, float, str, bool, array, dict

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you declare a variable in Python?

set variable_name to value

You declare a variable in Python by using the syntax: variable_name = value.

variableName.value

variable_name : value

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between a list and a tuple?

A list can only contain numbers, while a tuple can contain any data type.

A list is mutable and defined with [], while a tuple is immutable and defined with ().

A list is immutable and defined with [], while a tuple is mutable and defined with ().

A list is defined with {}, while a tuple is defined with []

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you create a dictionary in Python?

You can create a dictionary using square brackets, like this: my_dict = ['key1': 'value1', 'key2': 'value2'].

Dictionaries are created with parentheses, for example: my_dict = ('key1', 'value1', 'key2', 'value2').

You can only create a dictionary by importing the dict module.

You can create a dictionary in Python using curly braces, like this: my_dict = {'key1': 'value1', 'key2': 'value2'}.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the 'if' statement in Python?

To define a function in Python.

To create a loop that iterates over a list.

The purpose of the 'if' statement in Python is to execute code conditionally based on a boolean expression.

To declare a variable in Python.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you define a function in Python?

function_name: parameters

function_name(parameters) =>

def function_name(parameters):

function_name{parameters}

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the syntax for a 'for' loop in Python?

for variable in (sequence)

for variable in sequence[]

for variable in sequence:

for (variable : sequence)

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?