Created
May 20, 2019 15:59
-
-
Save bryanwillis/540efb493c9f298f6ceeb1e68509547f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Which code do you write if you want to use type inference on a variable x with the value 3? (TypeScript - 30 sec) | |
a. let x = 3; *** | |
b. let x: any = 3; | |
c. let x: dynamic = 3; | |
d. let x: number = 3; | |
A function has to return a string. How can you ensure that it does? (TypeScript - 25 seconds) | |
a. By adding "<string>" behind the return statement | |
b. By adding ": string" behind the parameter list *** | |
c. By adding ": string" behind the return statement | |
d. By adding "<string>" behind the parameter list | |
Given the following code: (TypeScript - 50 seconds) | |
function foo<T>(arg: T): T { | |
return arg; | |
} | |
How would you correctly call the function "foo" and initialize the variable "bar"?: | |
const bar = foo<string>('100'); *** | |
const bar = foo(100 as string); | |
const bar = foo<object>(typeof {}); | |
const bar = foo<number>('100' as number); | |
You need a variable "list" that is an array that can only contain numbers. Which code does the job? (TypeScript 40 seconds) | |
let list: [ : number ]; | |
let list: Array<number>; *** | |
let list: [] : number; | |
let list: int[]; | |
What is transpilation? (TypeScript 30 seconds) | |
Translating code written in a certain language to web binaries | |
Translating code written in a certain language to another language *** | |
Translating code written in a certain language to machine code | |
Translating code written in a certain language to web assembly | |
How does transpilation apply to TypeScript? (TypeScript 30 seconds) | |
TypeScript can't be interpreted by the browser so it's converted to web assembly | |
TypeScript can't be interpreted by the browser so it's converted to JavaScript *** | |
TypeScript typings are transpiled to JavaScript | |
JavaScript typings are transpiled to TypeScript | |
In the following snippet of code, which of the following lines would be added to resolve the promise? (TypeScript 45 seconds) | |
let myPromise = new Promise((resolve, reject) => { | |
// resolve the promise here | |
}); | |
reject(); | |
myPromise(resolve); | |
resolve(); *** | |
myPromise.resolve(); | |
Which of the following declares a new variable that may be assigned either a Book instance or a Magazine instance? (30 Seconds) | |
let readingMaterial: Book | Magazine; *** | |
let readingMaterial: <Book || Magazine>; | |
let readingMaterial: <Book && Magazine>; | |
let readingMaterial: Book & Magazine; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment