Cyber Sleuth Tier 1

Cyber Sleuth Tier 1

University

15 Qs

quiz-placeholder

Similar activities

Linux Tools for Developers

Linux Tools for Developers

University

15 Qs

IntraSympo Round One

IntraSympo Round One

University

20 Qs

Tutorial 5 Quiz

Tutorial 5 Quiz

University

14 Qs

Python Programming

Python Programming

University

20 Qs

Operating System Quiz

Operating System Quiz

University

20 Qs

Python Lists

Python Lists

University

20 Qs

Web Development and Programming

Web Development and Programming

University

20 Qs

JAVA BootCamp - Day 2

JAVA BootCamp - Day 2

University

20 Qs

Cyber Sleuth Tier 1

Cyber Sleuth Tier 1

Assessment

Quiz

Computers

University

Hard

Created by

Asymmetric Club

Used 7+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Media Image

What will be the output of the following code?

[1, 2]

[2,3]

[3,4]

[3,4,5]

Answer explanation

The slicing a[2:4] returns elements from index 2 up to (but not including) index 4.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to open a file for reading in Python?

file = open('filename.txt', 'w')

file = open('filename.txt', 'r')

file = open('filename.txt', 'a')

file = open('filename.txt', 'x')

Answer explanation

The mode 'r' opens the file for reading.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given the dictionary

d = {'one': 1, 'two': 2, 'three': 3},

what is the result of d.get('four')?

None

KeyError

0

4

Answer explanation

The get() method returns None if the key is not found and no default value is provided.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will be the output of the following code?

a: 1 b: 5 c: 10

a: 1 b: 2 c: 10

a: 1 b: 2 c: 5

a: 1 b: 5 c: 2

Answer explanation

The function call func(1, 2) assigns 1 to a and 2 to b, using the default value 10 for c.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What is the output of the following code snippet?

[1, 2, 3]

[1, 2, 3, 4]

[2]

None

Answer explanation

b is a reference to a, so changes to b affect a

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a mutable data type in Python?

int

str

tuple

list

Answer explanation

Lists are mutable, meaning their elements can be changed.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you create a set in Python?

s = {}

s = set([])

s = []

s = ()

Answer explanation

set([]) creates an empty set. {} creates an empty dictionary.

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?