Font size
WorksheetsPython and SQL Quiz
Total questions: 100
Worksheet time: 50mins
What is the output of print(type(5))?
Python is a:
Compiled Language
Markup Language
Low-level Language
Interpreted Language
Which of the following is a valid variable name in Python?
1name
name_1
class
first-name
What is the result of int('5.3')?
5
Error
5.3
None
What will type(3.0) return?
int
float
double
decimal
Which keyword is used to define a function in Python?
func
define
def
function
What is the output of: x = 10 if x > 5: print("High") else: print("Low")
Low
High
10
None
Which loop is used to iterate over a sequence?
if
switch
for
do
How many times will this loop run? for i in range(3): print(i)
2
3
4
Infinite
Which statement breaks out of the loop?
stop
end
break
exit
Which of the following is a valid while loop?
while x < 10:
until x > 10:
loop x in range(10):
when x < 10 do:
Nested loops are:
Invalid in Python
Used to call functions
Loops inside loops
Only for strings
Which keyword is used to return a value from a function?
break
continue
return
output
Default arguments in Python are defined:
Before the required arguments
After the required arguments
Anywhere
In the function name
What does recursion mean?
Loop inside a loop
A function calling itself
Infinite loop
None
How can you import a module in Python?
use math
require(math)
import math
load(math)
Which of the following is a built-in function?
sum()
append()
insert()
mapreduce()
What does dir() do?
Lists all files
Lists methods and attributes of an object
Creates a directory
Deletes a file
Which data structure is immutable?
List
Set
Tuple
Dictionary
How do you define a dictionary?
{}
[]
()
<>
What is the output of: len([1, 2, 3])?
2
3
1
Error
How do you add an element to a set?
add()
append()
insert()
push()
What is the key-value pair structure of a dictionary?
(key, value)
[key => value]
{key: value}
Which one is a mutable data structure?
Tuple
List
str
int
What mode is used to read a file?
'w'
'r'
'a'
'x'
What does open('file.txt', 'w') do?
Reads file
Appends file
Overwrites or creates file
Deletes file
Which module is used for JSON in Python?
csv
json
data
os
What is used to catch exceptions in Python?
try-except
catch
error handling
raise-catch
Which keyword is used to raise exceptions manually?
error
raise
throw
except
What is a custom exception?
Built-in error
Error ignored
User-defined error class
None
What is a class in Python?
A blueprint for creating objects
A function
A module
An attribute
What is an object in Python?
A type of loop
A variable
An instance of a class
A keyword
Which keyword is used to define a class?
def
class
object
module
What is the purpose of the __init__ method?
To create functions
To initialize object state
To call other classes
To destroy the object
What is inheritance?
Copying code
Accessing modules
Deriving a class from another
Using functions
Which class is inherited?
Base class
Subclass
Abstract class
Object class
What is encapsulation?
Writing loops
Combining data and methods in one unit
Calling multiple functions
None
Which access modifier makes an attribute private?
_name
__name
name
public name
What is polymorphism?
Many methods with same name but different behavior
One function
Many classes with one method
No method
Method overriding happens in:
Same class
Different classes (child overrides parent)
Only modules
None
Which method is called when an object is deleted?
__del__()
__destroy__()
__end__()
__exit__()
How do you achieve abstraction in Python?
Using interfaces
Using abstract keyword
Using abc module and abstract classes
Using private methods
Which SQL statement is used to retrieve data?
GET
SELECT
FETCH
EXTRACT
What does the WHERE clause do?
Deletes data
Filters data
Sorts data
Creates table
What is a primary key?
A unique identifier
A foreign reference
A table name
A row number
Which SQL clause is used to combine rows from two or more tables?
GROUP
JOIN
MERGE
BIND
What does ORDER BY do?
Filters rows
Groups rows
Sorts rows
Deletes rows
Which join returns only matching records from both tables?
LEFT JOIN
RIGHT JOIN
FULL JOIN
INNER JOIN
Which command is used to add a new row?
ADD
INSERT
PUSH
SAVE
How do you delete data from a table?
REMOVE
DROP
DELETE
ERASE
Which statement is used to modify existing data?
UPDATE
MODIFY
CHANGE
ALTER
What does the ALTER command do?
Change table structure
Modify rows
Rename database
View data
Which DBMS is open-source and widely used?
Oracle
MySQL
MS Access
SQL Server
What is a foreign key?
Unique identifier in a table
A field that references a primary key in another table
Duplicate of primary key
A system column
Which library is used to connect Python with MySQL?
sqlite3
mysql.connector
pandas
pyconnect
What method is used to execute a query?
run()
execute()
send()
query()
What method is used to execute a query?
run()
execute()
send()
query()
What is required to connect Python with MySQL?
Only username
Only database
Host, username, password, database
Table only
What is the best way to store student records in a CLI app?
Dictionary
Text file
SQL table
List
CRUD stands for:
Create, Remove, Use, Drop
Create, Read, Update, Delete
Create, Run, Update, Delete
Check, Read, Use, Delete
What does the commit() function do in database operations?
Rollback
Save changes
Exit the app
Clear screen
What does HTTP stand for?
Hyperlink Text Transfer Protocol
Hyper Text Transfer Protocol
High Text Transfer Protocol
Hyper Tool Transfer Protocol
Which of the following is a valid HTTP method?
FETCH
CONNECT
GET
LINK
What does a client send to a server to request a resource?
URL
HTTP Request
Web socket
JSON
What is the purpose of routing in web development?
Redirect URLs
Define how a server responds to a client request
Secure the application
Log the data
Flask is a:
Web server
Python framework
Database
Markup language
What decorator is used to define a route in Flask?
@app.run()
@route()
@app.route()
@flask.route
Which function starts the Flask server?
run()
start()
serve()
launch()
Jinja2 is used for:
Writing backend code
Writing CSS
Writing templates
Connecting to DB
What method is commonly used for submitting form data securely?
GET
POST
PUSH
SUBMIT
What is WTForms in Flask?
A database
A built-in web server
A form handling library
A CSS framework
How do you retrieve form data in Flask?
form.input()
request.input()
request.form
get.form
What is SQLAlchemy?
A MySQL GUI
A Flask template
An ORM for Python
A CSS framework
What does ORM stand for?
Object Related Model
Object Relational Mapping
Online Resource Manager
Open Request Method
What method is used to save an object in SQLAlchemy?
insert()
commit()
execute()
store()
Which file is used to define models in a Flask app?
models.html
views.py
models.py
database.sql
What is the purpose of session in Flask?
To store user preferences in cookies
To maintain user login state
To connect to database
To send emails
Which method is used to protect routes in Flask apps?
@form_validate
@auth_only
@login_required
@post_only
A Task Manager typically requires which of the following features?
Adding and removing users
Login, Add Task, Mark Complete
Web scraping
Payment gateway
Which folder in Flask holds static CSS and JS files?
public
assets
static
styles
What does HTML stand for?
Hyperlink Text Markup Language
Hyper Text Markup Language
Home Tool Markup Language
Hyper Tool Multi Language
Which tag is used to create a table in HTML?
d) 83. Which tag is used to input text in forms? a) b) c) d) 84. What does the a) Links to JavaScript b) Defines a block of text c) Collects user input d) Displays an image 85. Which tag is used for semantic structure? a) b) c) d) 86. The tag is used for: Table heading Table footer Body of table Form layout Which input type is used for selecting files? What does CSS stand for? Creative Style Sheets Cascading Style Sheets Computer Style Sheets Compact Style Syntax Which property is used to change text color? font-color color background-color text-style How do you select an element by ID in CSS? #idname .idname idname @idname What does the display: flex; property do? Adds animation Makes an element float Creates a flex container Centers the text Which CSS property is used for spacing inside an element? margin padding spacing border-spacing What is the default position value in CSS? relative fixed static absolute Which unit is relative to the font size of the element? px % rem em What is the purpose of media queries in CSS? Add audio Apply styles based on screen size Render videos Handle events Bootstrap is a: Database JS compiler CSS framework HTML engine Which class makes Bootstrap grid responsive? .container-full .grid-layout .container .responsive JavaScript is used for: Styling web pages Structuring content Adding interactivity Querying SQL How do you declare a variable in JS? var x = 10; int x = 10; let x: 10; define x 10; What is the output of console.log(typeof "123") in JavaScript? number int string char 100 questions Hamilton College Family Quiz 2 Worksheet • KG - Professional Dev... 100 questions GOKULAM (QUIZZ 8) Worksheet • Professional Development 100 questions 1ST IFRC 2023 Worksheet • Professional Development 100 questions Kewirausahaan Dasar Worksheet • 11th Grade - Professi... 100 questions Pretest menuju guru yang profesional Worksheet • Professional Development 100 questions Product Training Forklift Worksheet • Professional Development 100 questions DAY I--ALE JAN 2022 Worksheet • Professional Development 99 questions Tebak youtuber Minecraft Worksheet • KG - Professional Dev... |
