Python_CSE-Quiz-2

Python_CSE-Quiz-2

University

10 Qs

quiz-placeholder

Similar activities

BCA

BCA

University

10 Qs

Tin 8/1

Tin 8/1

KG - University

10 Qs

Prework Etapa 1 - Bogotá

Prework Etapa 1 - Bogotá

University

10 Qs

Jaringan Nirkabel - Pertemuan 3

Jaringan Nirkabel - Pertemuan 3

University

10 Qs

Information Technology & Business Canvas Model

Information Technology & Business Canvas Model

University

13 Qs

GIS Unit-1

GIS Unit-1

University

15 Qs

Microcontroller

Microcontroller

11th Grade - University

10 Qs

Input, output and storage de

Input, output and storage de

8th Grade - Professional Development

14 Qs

Python_CSE-Quiz-2

Python_CSE-Quiz-2

Assessment

Quiz

Computers

University

Practice Problem

Medium

Created by

ANJALI JAIN

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be the output of the following Python code?

a=[1,2,3,4,5,6,7,8,9]
print(a[::2])

[1,2]

[8,9]

[1,3,5,7,9]

[1,2,3]

2.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

The code below is manipulating a Python list using the slicing operator. What will be the output?
a=[1,2,3,4,5,6,7,8,9]
a[::2]=10,20,30,40,50,60
print(a)

valueError: attempt to assign a sequence of size 6 to an extended slice of size 5

[10, 2, 20, 4, 30, 6, 40, 8, 50, 60]

[1, 10, 3, 20, 5, 30, 7, 40, 9, 50, 60]

none

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be the output of the following code snippet?

a=[1,2,3,4,5]
print(a[3:0:-1])

Syntax error

[4, 3, 2]

[4, 3]

[4, 3, 2, 1]

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

def f(value, values):
    v = 1
    values[0] = 44
t = 3
v = [1, 2, 3]
f(t, v)
print(t, v[0])

1 44

31

3 44

11

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the correct command to shuffle the given Python list?

fruit.shuffle()

shuffle(fruit)

random.shuffle(fruit)

random.shuffleList(fruit)

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

arr = [[1, 2, 3, 4],
       [4, 5, 6, 7],
       [8, 9, 10, 11],
       [12, 13, 14, 15]]
for i in range(0, 4):
    print(arr[i].pop())

1 2 3 4

1 4 8 12

4 7 11 15

12,13,14,15

7.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which of the following statements given below is/are true about a Python tuple?

Tuples have structure, and lists have an order

Tuples are homogeneous, and lists are heterogeneous

none

All of them.

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?

Discover more resources for Computers