Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
BCSF13M004
BCSF13M036
9. class Bird {
Bird () {
console.log(I am Bird);
}
10.
11.
12.
13.
14.
}
What will be output of : var obj=new Bird();?
a. Error
b. I am Bird
c. Bird am I
d. None of these
class MyClass {
var a=12;
}
var obj=new MyClass();
console.log(Value of a= +a);
What is the output of above code?
a. Error
b. Value of a =12
c. A is private and cannot be accessed
d. None of the above
Class MyClass{
a:number;
func(){
}
}
Which of following is true?
a. func is public and a is private
b. func is public and a is protected
c. both are public
d. both are private
Which of the following is not true about typescript?
a. It supports inheritance.
b. It supports abstract classes.
c. It supports interfaces.
d. None of the above.
Which of the following is correct syntax for making a static variable in typescript?
a. static st:string;
b. st:string:static;
c. static(st:string);
d. none of the above
Which of the following is correct way of inheriting in typescript?
a. class B:A{}
b. class B inherits A{}
c. class B: class A{}
15.
16.
17.
18.
19.
20.
Answers:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
c
a
c
d
d (As there is an error in line 1 of the code)
d
d (As a have type function)
c
d (constructor keyword is used to built constructor and not a function with same name as class)
a (var cannot be used inside class)
c
d
b
d
d (Transpiller)
d (error cannot convert number to string)
a
c
a
d
References:
https://www.typescriptlang.org/