#1
Which keyword is used to declare a constant in JavaScript?
const
ExplanationDefines a constant variable that cannot be reassigned.
#2
What is the purpose of the 'this' keyword in JavaScript?
To refer to the current class instance
ExplanationRefers to the current object.
#3
Which of the following is a valid way to comment out multiple lines in Python?
/* This is a comment */
ExplanationInvalid syntax; use '#' for single-line comments.
#4
In JavaScript, what is the purpose of the 'setTimeout' function?
To delay the execution of a function
ExplanationExecutes a function after a specified delay.
#5
What is the purpose of the '===' operator in JavaScript?
Value equality without type coercion
ExplanationChecks strict equality without type conversion.
#6
What does the '==='' operator check for in JavaScript?
Value equality without type coercion
ExplanationChecks if two values are equal in value and type.
#7
In Python, what is the purpose of the 'pass' statement?
To indicate an empty block of code
ExplanationActs as a placeholder for future code.
#8
In Python, what does the 'yield' keyword do?
Returns a value from a function and saves its state
ExplanationPauses the function and retains its state.
#9
What is the purpose of the 'extends' keyword in Java?
To create a subclass
ExplanationEstablishes inheritance between classes.
#10
What is the purpose of the 'NaN' (Not a Number) value in JavaScript?
To indicate a numerical error or undefined result
ExplanationRepresents an invalid number.
#11
In Java, what is the 'final' keyword used for?
To declare a variable constant
ExplanationPrevents reassignment of variables.
#12
Which of the following is a logical operator in Python?
||
ExplanationLogical OR operator.
#13
What is the purpose of the 'finally' block in a try-catch statement in Java?
To execute code regardless of whether an exception is thrown or not
ExplanationGuarantees execution of code, irrespective of exceptions.
#14
In Python, how do you open a file in binary mode?
file = open('filename.txt', 'rb')
ExplanationOpens a file in binary mode for reading.
#15
What is the purpose of the 'try' block in a try-catch statement in Java?
To execute code regardless of whether an exception is thrown or not
ExplanationEncloses code that might throw an exception.
#16
What is the purpose of the 'super()' function in Python?
To call a method from the superclass
ExplanationInvokes a method from the parent class.
#17
In Java, what is the 'volatile' keyword used for?
To indicate that a variable may be changed by multiple threads
ExplanationEnsures visibility of changes to variables across threads.
#18
Which of the following is not a valid variable name in Python?
123variable
ExplanationInvalid due to starting with a number.
#19
What does the acronym SQL stand for?
Structured Query Language
ExplanationLanguage for managing relational databases.
#20
What is the purpose of the 'self' keyword in Python?
To refer to the current instance of a class
ExplanationReferences the instance of the class.
#21
In CSS, what does the 'box-sizing' property control?
The model used to calculate the size of an HTML element
ExplanationDefines how the size of an element is calculated.
#22
In Python, what does the '__init__' method do in a class?
It initializes the class attributes
ExplanationCalled when a class is instantiated to initialize its attributes.
#23
Which CSS property is used to control the spacing between lines of text?
line-height
ExplanationSpecifies the height of each line of text.
#24
In Python, what does the 'assert' statement do?
Asserts the truth of an expression
ExplanationChecks if a condition is true; raises an error if false.
#25
Which of the following is a pseudo-class selector in CSS?
:hover
ExplanationUsed to define a special state of an element.