Monster Tutorial PCL1

Monster Tutorial PCL1

University

9 Qs

quiz-placeholder

Similar activities

R variable Data Type and Flow Control Quiz

R variable Data Type and Flow Control Quiz

University

12 Qs

PHP nulmeting

PHP nulmeting

8th Grade - Professional Development

14 Qs

COMPUTER HARDWARE OUTPUT

COMPUTER HARDWARE OUTPUT

1st Grade - Professional Development

10 Qs

SO-750

SO-750

University

10 Qs

Comandos do Terminal Linux

Comandos do Terminal Linux

4th Grade - Professional Development

10 Qs

GET CONNECTED REDES E INTERNET

GET CONNECTED REDES E INTERNET

University

10 Qs

T02: Python - The Basics

T02: Python - The Basics

University

10 Qs

assemblyLanguageChap3

assemblyLanguageChap3

University

10 Qs

Monster Tutorial PCL1

Monster Tutorial PCL1

Assessment

Quiz

Computers

University

Practice Problem

Medium

Created by

Maritina Panagiotopoulou

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...

9 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct syntax to define a function in Python?

function myFunc():

def myFunc()

create myFunc():

def myFunc():

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to create a class in Python?

class MyClass()

def MyClass():

class MyClass:

class MyClass{}:

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which list comprehension produces a list of squares for numbers from 1 to 5?

[x*x for x in range(6)]

[x**2 for x in range(1, 6)]

[x^2 for x in range(5)]

[square(x) for x in range(5)]

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What does the regex ^a...s$ match?

Any five-letter string starting with 'a' and ending with 's'

A string 'a' followed by any three characters and 's'

Any string with 'a' at the beginning and 's' at the end

A string that has an 'a' and 's' separated by any three characters

5.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

How do you access the value associated with the key 'name' in a Python dictionary d?

d('name')

d[name]

d.get('name')

d{name}

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

grep -P '^(?=.*\bword1\b)(?=.*\bword2\b).*' myfile.txt

What is the purpose of this command?

To find lines in myfile.txt that contain both word1 and word2 in any order.

To replace occurrences of word1 with word2 in myfile.txt.

To display lines in myfile.txt that start with word1 and end with word2.

To count the occurrences of either word1 or word2 in myfile.txt.

7.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Access the last 4 letters of a string, ensuring the operation is only performed if the string is at least 6 characters long

word[-4:] if len(word) >= 6 else None

word[-6:-2]

word[:4] if len(word) >= 6

word[-4:] if len(word) > 4 else None

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