
TypeScript Functions Quiz
Authored by A Lakshman
Instructional Technology
Professional Development

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the return type of the function 'greet'?
void
boolean
number
string
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a valid parameter type in TypeScript?
string
float
text
integer
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the '?' signify in the function 'log'?
It indicates an optional parameter.
It indicates a default value.
It indicates a required parameter.
It indicates a return type.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the 'add' function?
To subtract two numbers.
To concatenate two strings.
To return the sum of two numbers.
To log a message.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In the function 'subtract', what are the types of parameters x and y?
string
boolean
number
void
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How would you define a function that takes two numbers and returns their product?
function multiply(a: number, b: number): number { return a * b; }
function multiply(a: string, b: string): number { return a * b; }
function multiply(a: number, b: number): boolean { return a * b; }
function multiply(a: number, b: number): void { return a * b; }
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the function 'log' if called with 'Hello' and 'INFO'?
Hello
[DEBUG] Hello
[INFO] Hello
[ERROR] Hello
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Microsoft
or continue with
%20(1).png)
Apple
Others
Already have an account?