Python_CSE-Quiz-2

Python_CSE-Quiz-2

University

10 Qs

quiz-placeholder

Similar activities

Python list starter

Python list starter

10th Grade - University

12 Qs

Python_programming_quiz

Python_programming_quiz

University

10 Qs

UNIT-1 PYTHON BASICS

UNIT-1 PYTHON BASICS

University

10 Qs

Python функциялары  7 сынып

Python функциялары 7 сынып

12th Grade - University

15 Qs

Python

Python

University

10 Qs

Python Round 2

Python Round 2

University

10 Qs

Quiz3

Quiz3

University

12 Qs

Computational Thinking in Python[Quiz 2]

Computational Thinking in Python[Quiz 2]

University

15 Qs

Python_CSE-Quiz-2

Python_CSE-Quiz-2

Assessment

Quiz

Computers

University

Medium

Created by

ANJALI JAIN

Used 1+ times

FREE Resource

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.

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?