Quiz
Quiz: TypeScript. Interfaces and Classes.
Fragen in diesem Quiz (3)
1Consider the following interface and function:
interface Person {
readonly firstname: string;
middlename?: string;
surname: string;
}
function getFullName(p: Person): string {
if (p.middlename !== null && p.middlename !== undefined)
{
if (p.firstname !== null && p.firstname !== undefined)
{
return `${p.firstname} ${p.middlename} ${p.surname}`;
}
else
{
return `${p.middlename} ${p.surname}`;
}
}
else
{
return `${p.firstname} ${p.surname}`;
}
}
Which of the following code snippets will output "Joe Doe"? Select all that apply.- Alet fullname = getFullName({ title: "Mr", firstname: "John", surname: "Doe" });
console.info(fullname); - Blet myName = { title: "Mr", firstname: "John", surname: "Doe" }
let fullname = getFullName(myName);
console.info(fullname); - Clet myName: Person = { firstname:"Johnathan", surname: "Doe" }
myName.firstname = "John";
let fullname = getFullName(myName);
console.info(fullname); - Dlet myName: Person = { middlename:"John", surname: "Doe" }
let fullname = getFullName(myName);
console.info(fullname);
- Alet fullname = getFullName({ title: "Mr", firstname: "John", surname: "Doe" });
2Which of the following keywords can be used in TypeScript to implement interface and inheritance. Choose all that appy.
- Aimplements
- Binherits
- Csuper
- Dbase
- Eextends
3Which of the following is possible to do in TypeScript? Choose all that apply.
- Aclass implements interface
- Bclass extends interface
- Cinterface extends interface
- Dinterface extends class
- Einterface implements class
- Finterface implements interface
Informationen
- Beschreibung
- Der Nutzer hat seine Fachbereichs-Information gelöscht. Quiz am Quiz: TypeScript. Interfaces and Classes., erstellt von Gelöschter Nutzer am 30/04/2017.
- Autor
- Gelöschter Nutzer
- Sprache
- English
- Aufrufe
- 26
- Verlauf
- Erstellt am 30 Apr 2017 · aktualisiert am 30 Apr 2017
- Schlagwörter