
Monster Tutorial PCL1

Quiz
•
Computers
•
University
•
Medium
Maritina Panagiotopoulou
Used 1+ times
FREE Resource
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
8.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How would you insert the word 'Fröhliche' with the part-of-speech (PoS) tag 'ADJA' into an existing dictionary my_hash
my_hash.append({'Fröhliche': 'ADJA'})
my_hash['Fröhliche'] = 'ADJA'
my_hash.add('Fröhliche', 'ADJA')
my_hash.insert(0, {'Fröhliche': 'ADJA'})
9.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Given a verticalized word list (one word per line) in a file named my_text.txt, which UNIX command combination is used to calculate an alphabetically sorted list of all unique word types in this file?
grep -o '\w+' my_text.txt | sort | uniq -c
sort -u my_text.txt
my_text.txt | sort | uniq
cat my_text.txt | sort | uniq
Similar Resources on Wayground
10 questions
UNIX

Quiz
•
1st Grade - Professio...
10 questions
P2-Regular Expressions

Quiz
•
University
10 questions
Comandos básicos do Linux (gerência de arquivos)

Quiz
•
University
8 questions
File Processing

Quiz
•
University
12 questions
Fundamentos de Shell Script

Quiz
•
11th Grade - University
11 questions
Surprise

Quiz
•
University
10 questions
Visual Programming

Quiz
•
University
8 questions
Da Vinci

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Would you rather...

Quiz
•
KG - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
10 questions
The Constitution, the Articles, and Federalism Crash Course US History

Interactive video
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
16 questions
Water Modeling Activity

Lesson
•
11th Grade - University
10 questions
ACT English prep

Quiz
•
9th Grade - University