Python Basics Challenge

Python Basics Challenge

University

15 Qs

quiz-placeholder

Similar activities

Python Revision

Python Revision

University

10 Qs

Mastering Python Fundamentals

Mastering Python Fundamentals

University

10 Qs

Python Basics

Python Basics

University

10 Qs

MLP - ICTAK Skill Quiz - Coding Skills

MLP - ICTAK Skill Quiz - Coding Skills

University

10 Qs

Finite Automata

Finite Automata

University

10 Qs

Basic of Programming - Quiz 02

Basic of Programming - Quiz 02

University - Professional Development

15 Qs

2021_DASPRO_Pertemuan4

2021_DASPRO_Pertemuan4

University

10 Qs

Python Quiz - BPLCK105B

Python Quiz - BPLCK105B

University

20 Qs

Python Basics Challenge

Python Basics Challenge

Assessment

Quiz

Computers

University

Hard

Created by

Vrinda Vrinda

Used 1+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What are the basic data types in Python?

int, float, str, bool

char, list, tuple, dict

string, number, boolean, object

int, float, array, set

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you declare a variable in Python?

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

let variable_name = value

var variable_name = value

variable_name : value

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between a list and a tuple?

A list is mutable; a tuple is immutable.

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

A list is a fixed size; a tuple can grow or shrink in size.

A list is created using parentheses; a tuple is created using square brackets.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you convert a string to an integer in Python?

Use str(int) to convert an integer to a string.

Use int(string) to convert a string to an integer.

Apply float(string) to convert a string to a float.

Use eval(string) to convert a string to an integer.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

To import modules in Python.

To define a function in Python.

To execute code conditionally based on a boolean expression.

To create a loop in Python.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you create a for loop in Python?

foreach i in range(5): print(i)

for (i = 0; i < 5; i++) { print(i); }

for i in range(5): print(i)

for i in range(5) print(i)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the expression 5 + 3 * 2?

11

10

8

16

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?