TypeScript
TypeScript
a) function myFunction() { }
b) myFunction = function() { }
a) parse()
b) toInteger()
c) parseInt()
d) convertToInt()
Answer: c) parseInt()
a) if (condition) { }
b) when (condition) { }
c) case (condition) { }
d) condition { }
Answer: a) if (condition) { }
Answer: b) To output a value from the function and end its execution
b) "null" is assigned explicitly by the developer, while "undefined" is assigned by the JavaScript
engine.
c) "null" represents an empty value, while "undefined" indicates the absence of a value or
uninitialized variable.
d) "null" is a reserved keyword and cannot be used in JavaScript, while "undefined" is used to
terminate loops.
Answer: c) "null" represents an empty value, while "undefined" indicates the absence of a value or
uninitialized variable.
b) "call" is used to invoke functions with an array of arguments, while "apply" is used with a single
argument.
c) "call" is used to invoke functions with a single argument, while "apply" is used with an array of
arguments.
d) "call" and "apply" are used to invoke functions on different data types in JavaScript.
Answer: b) "call" is used to invoke functions with an array of arguments, while "apply" is used with a
single argument.
c) To concatenate strings.
Write a function that takes two arrays as input and returns their intersection (common elements).
Given a string, write a JavaScript function to count the occurrences of each character in the string.
Write a JavaScript program to find the sum of all prime numbers between 1 and N.
Write a function to flatten a nested array in JavaScript.
Given an array of integers, write a function to find the second smallest element.
Write a program to find the factorial of a given number using recursion in JavaScript.
c) Database management
a) var
b) let
c) const
a) // This is a comment
c) /* This is a comment */
d) ## This is a comment
a) alert()
b) log()
c) print()
d) console.log()
Answer: d) console.log()