NEW
Font size
WorksheetsQuiz Trivia
Total questions: 50
Worksheet time: 29mins
In object-oriented programming, what is the purpose of inheritance?
Combine multiple classes into one
Create a blueprint for objects and allow reuse of code
Limit access to class members
Implement polymorphism
What does the forEach() method do in JavaScript?
Adds a new element to the end of an array
Removes the first element from an array
Executes a provided function once for each array element
Sorts the elements of an array
What does the `print()` function do in Python?
Take user input
Print information to the console
Perform mathematical operations
Define a variable
What is the purpose of the `try` and `except` blocks in Python?
Create a loop
Handle exceptions
Define a function
Open a file
Which method is used to add an element to the end of a list in Python?
append()
insert()
extend()
add()
What is the result of the expression `5 / 2` in Python?
2.5
2
2.0
3
What does the `with` statement do in Python?
Create a new instance of a class
Open a file and automatically close it when done
Define a context manager
Indicate the end of a block of code
Which of the following is a correct way to declare a variable in Python?
variable x = 5;
int x = 5;
x = 5;
var x = 5;
What is the purpose of the `__init__` method in a Python class?
Initialize a variable with a default value
Create an instance of the class
Define a static method
Override a parent class method
How do you declare a constant in PHP?
define_constant()
const()
define()
set_constant()
What does CSS stand for?
Computer Style Sheets
Creative Style Sheets
Cascading Style Sheets
Colorful Style Sheets
What does HTML stand for?
Hyper Transfer Markup Language
Hyper Text Markup Language
Hyperlinks and Text Markup Language
High Tech Markup Language
Which keyword is used to declare variables in JavaScript?
var
int
string
let
What does the CSS property "display: none;" do?
Hides the element
Changes the display style to block
Displays the element as inline
Removes the padding of the element
Which HTML tag is used for creating an unordered list?
<ul>
<ol>
<li>
<list>
How do you concatenate two strings in PHP?
using the . operator
using the + operator
using the & operator
using the : operator
What is the correct HTML tag for inserting a line break?
br
h1
b
u
What is the purpose of the `for` loop in Python?
Execute a block of code while a condition is true
Iterate over a sequence of elements
Define a function
Handle exceptions
What is the correct HTML for creating a hyperlink to an external website?
<a href="http://www.example.com">Example</a>
<a link="http://www.example.com">Example</a>
<hyperlink>http://www.example.com</hyperlink>
Which HTML tag is used to define a table row?
<table-row>
<row>
<tr>
<tablerow>
Which tag is used to define the header of a section or document in HTML5?
<head>
<h1>
<header>
<section>
What is JavaScript primarily used for?
Server-side programming
Styling web pages
Adding interactivity to web pages
Creating databases
How do you start a session in PHP?
session_start()
start_session()
begin_session()
init_session()
Which CSS property is used to change the background color of an element?
background-color
color
bg-color
bgcolor
What does the `isNaN()` function do in JavaScript?
Checks if a value is a number
Converts a string to a number
Checks if a value is not a number
Returns the square root of a number
What does the
Defines the document type and version of HTML
Creates a new HTML document
Specifies the document's background color
Declares the document as public or private
What is the purpose of the `lambda` function in Python?
Define a multiline function
Create anonymous functions
Access the global scope
Implement decorators
Which method is used to add a new element to the end of an array in JavaScript?
append()
push()
add()
insert()
Which CSS property is used to change the text color of an element?
font-color
text-color
color (Correct)
font-style
What does the `typeof` operator do in JavaScript?
Checks if a variable is defined
Returns the data type of a variable
Converts a string to uppercase
Checks if two variables are equal
Which tag is used to define a hyperlink in HTML?
<link>
<a>
<href>
<hyper>
Which function is used to output data in PHP?
print()
echo()
display()
output()
What does the CSS property "float" do?
Makes an element float above other elements
Floats an element to the left or right of its container
Adds a shadow effect to an element
Changes the font size of an element
What is the purpose of the <img> tag in HTML?
Insert an image
Insert a hyperlink
Insert a paragraph
Insert a table
Which of the following is used to comment multiple lines in PHP?
/* */
//
#
[]
Which CSS property is used to control the spacing between lines of text?
line-height
spacing
text-spacing
line-spacing
What does DOM stand for in JavaScript?
Document Object Model
Data Object Model
Document Order Model
Display Object Model
Which PHP function is used to redirect the user to another page?
header()
redirect()
location()
go()
What does the `$_GET` superglobal variable in PHP do?
Retrieves data sent in the request body
Retrieves data sent via URL parameters
Retrieves data from a form with the POST method
Retrieves data from a file upload
Which CSS property is used to make text italic?
text-decoration
font-style
text-style
italicize
Which of the following is NOT a valid data type in JavaScript?
boolean
float
string
object
Which keyword is used to exit a loop in JavaScript?
break
stop
exit
end
Which CSS property is used to set the width of an element?
size
width
length
set-width
What does PHP stand for?
Personal Home Page
Hypertext Preprocessor
Preprocessed Hypertext Page
Private Home Page
What is the correct HTML for creating a checkbox input field?
<input type="check">
<input type="checkbox">
<checkbox>
<input style="checkbox">
What is the purpose of the `===` operator in JavaScript?
Assignment
Equality comparison (strict equality)
Type conversion
Logical OR operation
How can you include an external CSS file in an HTML document?
<import css="style.css">
<link rel="stylesheet" href="style.css">
<style src="style.css">
<css src="style.css">
Which of the following tags is used to start and end a PHP code block?
<?php ?>
<% %>
<?= ?>
<? ?>
Which PHP function is used to connect to a MySQL database?
connect()
db_connect()
mysql_connect()
mysqli_connect()
What is the output of `console.log(10 + "20")` in JavaScript?
30
"1020"
1020
Error
