Python_CSE-Quiz-2

Python_CSE-Quiz-2

University

10 Qs

quiz-placeholder

Similar activities

Computational Thinking in Python[Quiz 3]

Computational Thinking in Python[Quiz 3]

University

15 Qs

Función CONTAR

Función CONTAR

KG - Professional Development

10 Qs

Quiz Microprogramming

Quiz Microprogramming

University

15 Qs

Logika Fuzzy

Logika Fuzzy

University

10 Qs

BB

BB

University

10 Qs

Redes Vlan

Redes Vlan

University

15 Qs

Tree and Planar Graph

Tree and Planar Graph

University

10 Qs

STM10163_T1:INTRODUCTION TO DATABASE CONCEPT

STM10163_T1:INTRODUCTION TO DATABASE CONCEPT

University

10 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