Search Header Logo

python q3

Authored by Melissa Guillermo

Computers

University

DOK Level 1: Recall covered

Used 34+ times

python q3
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How do you slice a Python array `arr` to get the first three elements?

`arr[0:2]`

`arr[0:4]`

`arr[:3]`

`arr[1:3]`

Tags

DOK Level 1: Recall

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How do you add multiple items (e.g., [4, 5, 6]) to the end of a Python array `arr`?

`arr.append([4, 5, 6])`

`arr.extend([4, 5, 6])`

`arr.add([4, 5, 6])`

`arr.insert([4, 5, 6])`

Tags

DOK Level 1: Recall

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the purpose of an array in Python?

To perform mathematical operations

To define functions

To store multiple values in one variable

To create loops

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What method is used to add an element at the end of an array in Python?

append()

extend()

copy()

clear()

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be the output-

f=open('abc.txt','a')

text="xyz"

f.write(text)

f.close()

Writing into the file without erasing old content

Writing into the file by erasing old content

reading from the file without erasing old content

reading from the file by erasing old content

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Mode in the following program to open file for writing in a mode where new data will be added at the end of old data

file =open("poem.txt","__")

r

w

a

r+

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which function read single line at a time?

read()

read(n)

readline()

readlines()

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?