logo

Crowdly

Browser

Add to Chrome

ООП \ Програмування (JS) \ Вовкодав О.В.

Looking for ООП \ Програмування (JS) \ Вовкодав О.В. test answers and solutions? Browse our comprehensive collection of verified answers for ООП \ Програмування (JS) \ Вовкодав О.В. at elr.tnpu.edu.ua.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

Що виведе цей код?
 class Counter {

constructor() {

this.count = 0;

}

increment() {

this.count++;

}

}

const c = new Counter();

c.increment();

c.increment();

console.log(c.count);

0%
0%
100%
0%
View this question
Що таке mixin у JavaScript?
0%
0%
0%
100%
View this question
Що виведе цей код?
 class Temperature {

#celsius;

constructor(c) { this.#celsius = c; }

get fahrenheit() {

return this.#celsius \* 9/5 + 32;

}

set fahrenheit(f) {

this.#celsius = (f - 32) \* 5/9;

}

}

const t = new Temperature(0);

console.log(t.fahrenheit);

0%
0%
100%
0%
View this question
Що виведе цей код?
 class AbstractShape {

constructor() {

if (new.target === AbstractShape) {

throw new Error('Cannot instantiate abstract class');

}

}

area() {

throw new Error('Method area() must be implemented');

}

}

class Rectangle extends AbstractShape {

constructor(w, h) {

super();

this.w = w; this.h = h;

}

area() { return this.w \* this.h; }

}

const r = new Rectangle(4, 5);

console.log(r.area());

0%
0%
0%
100%
View this question
Що відбудеться при виконанні цього коду?
 class BankAccount {

#balance = 0;

deposit(amount) {

this.#balance += amount;

}

getBalance() {

return this.#balance;

}

}

const acc = new BankAccount();

acc.deposit(100);

console.log(acc.getBalance());

console.log(acc.#balance);

100%
0%
0%
0%
View this question
Що виведе цей код?
 class MathUtils {

static square(x) {

return x \* x;

}

}

console.log(MathUtils.square(4));

const m = new MathUtils();

console.log(m.square(4));

100%
0%
0%
0%
View this question
Що таке клас у контексті ООП?
0%
0%
100%
0%
View this question
Що виведе цей код?
 class Engine {

start() { return 'Engine started'; }

}

class Car {

constructor() {

this.engine = new Engine();

}

drive() {

return this.engine.start() + ' - driving';

}

}

const car = new Car();

console.log(car.drive());

100%
0%
0%
0%
View this question
Що виведе цей код?
 class Animal {

speak() {

return 'Some sound';

}

}

class Dog extends Animal {

speak() {

return 'Woof!';

}

}

class Cat extends Animal {

speak() {

return 'Meow!';

}

}

const animals = [new Dog(), new Cat(), new Animal()];

animals.forEach(a =\> console.log(a.speak()));

0%
0%
100%
0%
View this question
Яке ключове слово використовується для оголошення статичного члена класу в JavaScript?
0%
100%
0%
0%
View this question

Want instant access to all verified answers on elr.tnpu.edu.ua?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome