python q3

python q3

University

15 Qs

quiz-placeholder

Similar activities

Arrays and pointers quiz

Arrays and pointers quiz

University

20 Qs

Arrays

Arrays

11th Grade - University

10 Qs

Zenorix 2023

Zenorix 2023

University

20 Qs

Coding Titans

Coding Titans

University

17 Qs

Arrays

Arrays

University

20 Qs

JAVA QUIZ-1

JAVA QUIZ-1

University

10 Qs

Array in C

Array in C

University

10 Qs

Arrays

Arrays

KG - University

10 Qs

python q3

python q3

Assessment

Quiz

Computers

University

Medium

DOK Level 1: Recall

Standards-aligned

Created by

Melissa Guillermo

Used 34+ times

FREE Resource

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()

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?