GoConqr has a new look! Let us know what you think.

Quiz

Quiz: TypeScript. Interfaces and Classes.

Deleted user 3 questions Updated 30 Apr 2017

Take the quiz

Questions in this quiz (3)

  1. 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.
    1. Alet fullname = getFullName({ title: "Mr", firstname: "John", surname: "Doe" });
      console.info(fullname);
    2. Blet myName = { title: "Mr", firstname: "John", surname: "Doe" }
      let fullname = getFullName(myName);
      console.info(fullname);
    3. Clet myName: Person = { firstname:"Johnathan", surname: "Doe" }
      myName.firstname = "John";
      let fullname = getFullName(myName);
      console.info(fullname);
    4. Dlet myName: Person = { middlename:"John", surname: "Doe" }
      let fullname = getFullName(myName);
      console.info(fullname);
  2. 2Which of the following keywords can be used in TypeScript to implement interface and inheritance. Choose all that appy.
    1. Aimplements
    2. Binherits
    3. Csuper
    4. Dbase
    5. Eextends
  3. 3Which of the following is possible to do in TypeScript? Choose all that apply.
    1. Aclass implements interface
    2. Bclass extends interface
    3. Cinterface extends interface
    4. Dinterface extends class
    5. Einterface implements class
    6. Finterface implements interface

Information

Description
User has deleted their subject information Quiz on Quiz: TypeScript. Interfaces and Classes., created by Deleted user on 30/04/2017.
Author
Deleted user
Language
English
Views
26
History
Created on 30 Apr 2017 · updated on 30 Apr 2017

Feedback

What is it about?

What do you think of the new look?

How do you like it?