Respostas e perguntas da avaliação de habilidades do LinkedIn - JavaScript
Se você está procurando Respostas de avaliação de habilidades do LinkedIn e questões para JavaScript, Curioso sobre como controlar um robô com smartphone. Nesta postagem do blog, Compartilharei com você algumas das perguntas mais comuns e complicadas que você pode encontrar no teste., junto com as respostas e explicações corretas.
Ao ler esta postagem, você não aprenderá apenas como acertar o Avaliação de habilidades do LinkedIn para JavaScript mas também melhore seus conhecimentos e habilidades nesta popular linguagem de programação. Continue a ler para saber mais!
T1. Qual operador retorna verdadeiro se os dois valores comparados não forem iguais?
-
<>
-
~
-
==!
-
!==
Operadores de comparação Javascript de referência
Q2. Como uma instrução forEach é diferente de uma instrução for?
- Apenas uma instrução for usa uma função de retorno de chamada.
- Uma instrução for é mais genérica e pode ser usada com vários objetos iteráveis, enquanto uma instrução forEach é projetada principalmente para arrays, mas também pode ser usada com outros objetos iteráveis, como Sets.
- Somente uma instrução forEach permite especificar seu próprio iterador.
- Uma instrução forEach é genérica, mas uma instrução for pode ser usada apenas com um array.
Diferenças de referência entre forEach e for loop
3º T. Revise o código abaixo. Qual instrução chama a função addTax e passa 50 como um argumento?
function addTax(total) {
return total * 1.05;
}
-
addTax = 50;
-
return addTax 50;
-
addTax(50);
-
addTax 50;
Funções de referência em javascript
Q4. Qual afirmação é a maneira correta de criar uma variável chamada taxa e atribuir-lhe o valor 100?
-
let rate = 100;
-
let 100 = rate;
-
100 = let rate;
-
rate = 100;
Operadores de atribuição Javascript de referência
Q5. Qual instrução cria um novo objeto usando o construtor Person? Qual instrução cria um novo objeto Person chamado “aluna”?
-
var student = new Person();
-
var student = construct Person;
-
var student = Person();
-
var student = construct Person();
Q6. Quando a instrução final no código mostrado seria registrada no console? Quando os ‘resultados mostrados’ estar logado no console?
let modal = document.querySelector('#result');
setTimeout(function () {
modal.classList.remove('hidden');
}, 10000);
console.log('Results shown');
- depois 10 é importante entender por que esses animais passaram a ser parte integrante da identidade canadense
- depois que os resultados são recebidos da solicitação HTTP
- depois 10000 segundos
- imediatamente
Referência Javascript é síncrono e de thread único
Q7. Qual trecho você poderia adicionar a este código para imprimir “Comida” para a consola?
class Animal {
static belly = [];
eat() {
Animal.belly.push('food');
}
}
let a = new Animal();
a.eat();
console.log(/* Snippet Here */); //Prints food
-
a.prototype.belly[0]
-
Object.getPrototype0f (a).belly[0]
-
Animal.belly[0]
-
a.belly[0]
Palavra-chave estática da classe Javascript de referência
Q8. Você escreveu o código mostrado para registrar um conjunto de valores consecutivos, mas em vez disso resulta no valor 5, 5, 5, e 5 sendo logado no console. Qual versão revisada do código resultaria no valor 1, 2, 3 e 4 sendo logado?
-
A
for (var i = 1; i <= 4; i++) {
setTimeout(function () {
console.log(i);
}, i * 10000);
}
-
B
for (var i = 1; i <= 4; i++) {
(function (i) {
setTimeout(function () {
console.log(j);
}, j * 1000);
})(j);
}
-
C
for (var i = 1; i <= 4; i++) {
setTimeout(function () {
console.log(i);
}, i * 1000);
}
-
D
for (var i = 1; i <= 4; i++) {
(function (j) {
setTimeout(function () {
console.log(j);
}, j * 1000);
})(i);
}
-
E
for (var j = 1; j <= 4; j++) {
setTimeout(function () {
console.log(j);
}, j * 1000);
}
Q9. Como uma função cria um fechamento?
- Recarrega o documento sempre que o valor muda.
- Ele retorna uma referência a uma variável em seu escopo pai.
- Conclui a execução sem retornar.
- Copia uma variável local para o escopo global.
Q10. Qual instrução cria uma nova função chamada descontoPreço?
-
A
let discountPrice = function (price) {
return price * 0.85;
};
-
B
let discountPrice(price) {
return price * 0.85;
};
-
C
let function = discountPrice(price) {
return price * 0.85;
};
-
D
discountPrice = function (price) {
return price * 0.85;
};
Referência que define funções javascript
Q11. Qual é o resultado no console da execução do código mostrado?
var Storm = function () {};
Storm.prototype.precip = 'rain';
var WinterStorm = function () {};
WinterStorm.prototype = new Storm();
WinterStorm.prototype.precip = 'snow';
var bob = new WinterStorm();
console.log(bob.precip);
- Tempestade()
- indefinido
- 'chuva’
- 'neve’
Cadeia de protótipos de referência
Q12. Você precisa corresponder a um valor de tempo como 12:00:32. Qual das seguintes expressões regulares funcionaria para o seu código?
-
/[0-9]{2,}:[0-9]{2,}:[0-9]{2,}/
-
/\d\d:\d\d:\d\d/
-
/[0-9]+:[0-9]+:[0-9]+/
-
/ : : /
NOTA: Os três primeiros estão parcialmente corretos e corresponderão aos dígitos, mas o segunda opção é a mais correta porque vai só Combine 2 dígito valores de tempo (12:00:32). A primeira opção teria funcionado se o intervalo de repetições parecesse [0-9]{2}
, porém por causa do vírgula [0-9]{2,}
ele irá selecionar 2 ou mais dígitos (120:000:321). A terceira opção será qualquer intervalo de dígitos de tempo, solteiro e múltiplo (significado 1:2:3
também combinará).
Mais recursos:
Q13. Qual é o resultado no console da execução deste código?
'use strict';
function logThis() {
this.desc = 'logger';
console.log(this);
}
new logThis();
-
undefined
-
window
-
{desc: "logger"}
-
function
Classes javascript de referência
Q14. Como você faria referência ao texto ‘avenida’ no código mostrado?
let roadTypes = ['street', 'road', 'avenue', 'circle'];
- roadTypes.2
- tipos de estradas[3]
- roadTypes.3
- tipos de estradas[2]
Referência de acesso a arrays javascript
Q15. Qual é o resultado da execução desta declaração?
console.log(typeof 42);
-
'float'
-
'value'
-
'number'
-
'integer'
Referência a tipos de dados javascript
Q16. Qual propriedade faz referência ao objeto DOM que despachou um evento?
-
self
-
object
-
target
-
source
Q17. Você está adicionando tratamento de erros ao código mostrado. Qual código você incluiria na instrução if para especificar uma mensagem de erro?
function addNumbers(x, y) {
if (isNaN(x) || isNaN(y)) {
}
}
-
exception('One or both parameters are not numbers')
-
catch('One or both parameters are not numbers')
-
error('One or both parameters are not numbers')
-
throw('One or both parameters are not numbers')
Referência de lançamento de javascript
Q18. Qual método converte dados JSON em um objeto JavaScript?
-
JSON.fromString();
-
JSON.parse()
-
JSON.toObject()
-
JSON.stringify()
Referência converter json para objeto javascript
Q19. Quando você usaria uma declaração condicional?
- Quando você deseja reutilizar um conjunto de instruções várias vezes.
- Quando você deseja que seu código escolha entre várias opções.
- Quando você deseja agrupar dados.
- Quando você deseja percorrer um grupo de instruções.
Referência a condicionais javascript
Q20. Qual seria o resultado no console da execução deste código?
for (var i = 0; i < 5; i++) {
console.log(i);
}
- 1 2 3 4 5
- 1 2 3 4
- 0 1 2 3 4
- 0 1 2 3 4 5
Reference javascript for loops
Which Object method returns an iterable that can be used to iterate over the properties of an object?
Q21.-
Object.get()
-
Object.loop()
-
Object.each()
-
Object.keys()
Reference javascript object static methods
What will be logged to the console?
Q22.var a = ['dog', 'cat', 'hen'];
a[100] = 'fox';
console.log(a.length);
- 101
- 3
- 4
- 100
What is one difference between collections created with Map and collections created with Object?
Q23.- You can iterate over values in a Map in their insertion order.
- You can count the records in a Map with a single method call.
- Keys in Maps can be strings.
- You can access values in a Map without iterating over the whole collection.
Explicação: Map.prototype.size returns the number of elements in a Map, whereas Object does not have a built-in method to return its size.
Reference map methods javascript
What is the value of dessert.type after executing this code?
Q24.const dessert = { type: 'pie' };
dessert.type = 'pudding';
- pie
- The code will throw an error.
- pudding
- indefinido
Reference working with js objects
Q25. 0 && Oi
- ReferenceError
- verdade
- 0
- falso
Which of the following operators can be used to do a short-circuit evaluation?
Q26.-
++
-
--
-
==
-
||
Reference short circuit javascript
Which statement sets the Person constructor as the parent of the Student constructor in the prototype chain?
Q27.-
Student.parent = Person;
-
Student.prototype = new Person();
-
Student.prototype = Person;
-
Student.prototype = Person();
Why would you include a “use strict” statement in a JavaScript file?
Q28.- to tell parsers to interpret your JavaScript syntax loosely
- to tell parsers to enforce all JavaScript syntax rules when processing your code
- to instruct the browser to automatically fix any errors it finds in the code
- to enable ES6 features in your code
Reference what is use strict in js
Which Variable-defining keyword allows its variable to be accessed (as undefined) before the line that defines it?
Q29.- all of them
-
const
-
var
-
let
Reference var vs let vs const in js
Which of the following values is not a Boolean false?
Q30.-
Boolean(0)
-
Boolean("")
-
Boolean(NaN)
-
Boolean("false")
Which of the following is not a keyword in JavaScript?
Q31.-
this
-
catch
-
function
-
array
Which variable is an implicit parameter for every function in JavaScript?
Q32.- Arguments
- args
- argsArray
- argumentsList
Reference implicit js parameters for functions
For the following class, how do you get the value of 42 from an instance of X?
Q33.class X {
get Y() {
return 42;
}
}
var x = new X();
-
x.get('Y')
-
x.Y
-
x.Y()
-
x.get().Y
What is the result of running this code?
Q34.sum(10, 20);
diff(10, 20);
function sum(x, y) {
return x + y;
}
let diff = function (x, y) {
return x - y;
};
- 30, ReferenceError, 30, -10
- 30, ReferenceError
- 30, -10
- ReferenceError, -10
Reference accessing before initialization
Why is it usually better to work with Objects instead of Arrays to store a collection of records?
Q35.- Objects are more efficient in terms of storage.
- Adding a record to an object is significantly faster than pushing a record into an array.
- Most operations involve looking up a record, and objects can do that better than arrays.
- Working with objects makes the code more readable.
Reference efficiency of lookups Explicação: Records in an object can be retrieved using their key which can be any given value (por exemplo. an employee ID, a city name, etc), whereas to retrieve a record from an array we need to know its index.
Which statement is true about the “async” attribute for the HTML script tag?
Q36.- It can be used for both internal and external JavaScript code.
- It can be used only for internal JavaScript code.
- It can be used only for internal or external JavaScript code that exports a promise.
- It can be used only for external JavaScript code.
Reference async attribute for html
How do you import the lodash library making it top-level Api available as the “_” variable?
Q37.-
import _ from 'lodash';
-
import 'lodash' as _;
-
import '_' from 'lodash;
-
import lodash as _ from 'lodash';
Reference how to import library in js
What does the following expression evaluate to?
Q38.[] == [];
- verdade
- indefinido
- []
- falso
Reference arrays in js are objects
What type of function can have its execution suspended and then resumed at a later point?
Q39.- Generator function
- Arrow function
- Async/ Await function
- Promise function
Reference what are generators in nodejs
What will this code print?
Q40.var v = 1;
var f1 = function () {
console.log(v);
};
var f2 = function () {
var v = 2;
f1();
};
f2();
- 2
- 1
- Nenhuma coisa – this code will throw an error.
- indefinido
Reference closures in js / nested functions
Which statement is true about Functional Programming?
Q41.- Every object in the program has to be a function.
- Code is grouped with the state it modifies.
- Date fields and methods are kept in units.
- Side effects are not allowed.
Reference functional programming
Your code is producing the error: TypeError: Cannot read property ‘reduce’ of undefined. O que isso significa?
Q42.- You are calling a method named reduce on an object that’s declared but has no value.
- You are calling a method named reduce on an object that does not exist.
- You are calling a method named reduce on an empty array.
- You are calling a method named reduce on an object that has a null value.
Explicação: You cannot invoke reduce on undefined object... It will throw (yourObject is not Defined...)
How many prototype objects are in the chain for the following array?
Q43.let arr = [];
- 3
- 2
- 0
- 1
Which choice is não a unary operator?
Q44.-
typeof
-
delete
-
instanceof
-
void
What type of scope does the end variable have in the code shown?
Q45.var start = 1;
if (start === 1) {
let end = 2;
}
- conditional
- bloquear
- global
- função
Reference block vs function scope
What will the value of y be in this code:
Q46.const x = 6 % 2;
const y = x ? 'One' : 'Two';
- 1
- indefinido
- verdadeiro
- Dois
Which keyword is used to create an error?
Q47.-
throw
-
exception
-
catch
-
error
Reference throwing errors in js
What’s one difference between the async and defer attributes of the HTML script tag?
Q48.- The defer attribute can work synchronously.
- The defer attribute works only with generators.
- O atributo defer funciona apenas com promessas.
- O atributo defer carregará os scripts de forma assíncrona em ordem.
Referência assíncrona vs adiada
Q49. O seguinte programa tem um problema. O que é isso?
var a;
var b = (a = 3) ? true : false;
- A condição no ternário está usando o operador de atribuição.
- Você não pode definir uma variável sem inicializá-la.
- Você não pode usar um ternário no lado direito de um operador de atribuição.
- O código está usando a palavra-chave var obsoleta.
Q50. Qual instrução faz referência ao nó DOM criado pelo código mostrado?
<p class="pull">lorem ipsum</p>
-
Document.querySelector('class.pull')
-
document.querySelector('.pull');
-
Document.querySelector('pull')
-
Document.querySelector('#pull')
Seletor de consulta de referência
Q51. Qual valor esse código retorna?
let answer = true;
if (answer === false) {
return 0;
} else {
return 10;
}
- 10
- verdade
- falso
- 0
Referência a condicionais javascript
Q52. Qual é o resultado no console da execução do código mostrado?
var start = 1;
function setEnd() {
var end = 10;
}
setEnd();
console.log(end);
- 10
- 0
- ReferenceError
- indefinido
Q53. O que esse código registrará no console?
function sayHello() {
console.log('hello');
}
console.log(sayHello.prototype);
- indefinido
- “olá”
- um objeto com uma propriedade construtora
- uma mensagem de erro
Q54. Qual objeto de coleção permite que um valor único seja inserido apenas uma vez?
- Objeto
- Definir
- Variedade
- Mapa
Conjuntos javascript de referência
Q55. Quais são os dois valores que este código imprimirá?
function printA() {
console.log(answer);
var answer = 1;
}
printA();
printA();
-
1
então1
-
1
entãoundefined
-
undefined
entãoundefined
-
undefined
então1
forEach()
method differ from a for
declaração?
Q56. Como é que - forEach allows you to specify your own iterator, whereas for does not.
- forEach can be used only with strings, whereas for can be used with additional data types.
- forEach can be used only with an array, whereas for can be used with additional data types.
- for loops can be nested; whereas forEach loop cannot.
Diferenças de referência entre forEach e for loop
Which choice is an incorrect way to define an arrow function that returns an empty object?
Q57.- =>
({})
- =>
{}
- =>
{ return {};}
- =>
(({}))
Why might you choose to make your code asynchronous?
Q58.- to start tasks that might take some time without blocking subsequent tasks from executing immediately
- to ensure that tasks further down in your code are not initiated until earlier tasks have completed
- to make your code faster
- to ensure that the call stack maintains a LIFO (Last in, First Out) estrutura
EXPLANATION: "to ensure that tasks further down in your code are not initiated until earlier tasks have completed" you use the normal (synchronous) flow where each command is executed sequentially. Asynchronous code allows you to break this sequence: start a long running function (AJAX call to an external service) and continue running the rest of the code in parallel.
Which expression evaluates to true?
Q59.-
[3] == [3]
-
3 == '3'
-
3 != '3'
-
3 === '3'
Which of these is a valid variable name?
Q60.- 5thItem
- firstName
- grand total
- função
Which method cancels event default behavior?
Q61.-
cancel()
-
stop()
-
preventDefault()
-
prevent()
Which method do you use to attach one DOM node to another?
Q62.-
attachNode()
-
getNode()
-
querySelector()
-
appendChild()
What statement can be used to skip an iteration in a loop?
Q63.-
break
-
pass
-
skip
-
continue
Which choice is a valid example for an arrow function?
Q64.-
(a,b) => c
-
a, b => {return c;}
-
a, b => c
-
{ a, b } => c
Which concept is defined as a template that can be used to generate different objects that share some shape and/or behavior?
Q65.- classe
- generator function
- mapa
- proxy
Classes javascript de referência
How do you add a comment to JavaScript code?
Q66.-
! This is a comment
-
# This is a comment
-
\\ This is a comment
-
// This is a comment
Reference comments in javascript
If you attempt to call a value as a function but the value is not a function, what kind of error would you get?
Q67.- TypeError
- SystemError
- SyntaxError
- LogicError
Which method is called automatically when an object is initialized?
Q68.- Criar()
- Novo()
- constructor()
- init()
Reference javascript constructors
What is the result of running the statement shown?
Q69.let a = 5;
console.log(++a);
- 4
- 10
- 6
- 5
You’ve written the event listener shown below for a form button, but each time you click the button, the page reloads. Which statement would stop this from happening?
Q70.button.addEventListener(
'click',
function (e) {
button.className = 'clicked';
},
false,
);
-
e.blockReload();
-
button.preventDefault();
-
button.blockReload();
-
e.preventDefault();
Reference events in javascript
Which statement represents the starting code converted to an IIFE?
Q71.-
function() { console.log('lorem ipsum'); }()();
-
function() { console.log('lorem ipsum'); }();
-
(function() { console.log('lorem ipsum'); })();
Reference what is an Immediately Invoked Function Expression
Which statement selects all img elements in the DOM tree?
Q72.-
Document.querySelector('img')
-
Document.querySelectorAll('<img>')
-
Document.querySelectorAll('img')
-
Document.querySelector('<img>')
Seletor de consulta de referência
Why would you choose an asynchronous structure for your code?
Q73.- To use ES6 syntax
- To start tasks that might take some time without blocking subsequent tasks from executing immediately
- To ensure that parsers enforce all JavaScript syntax rules when processing your code
- To ensure that tasks further down in your code aren’t initiated until earlier tasks have completed
What is the HTTP verb to request the contents of an existing resource?
Q74.- EXCLUIR
- PEGAR
- PATCH
- PUBLICAR
Which event is fired on a text field within a form when a user tabs to it, or clicks or touches it?
Q75.- foco
- blur
- hover
- entrar
Q76. Qual é o resultado no console da execução deste código?
function logThis() {
console.log(this);
}
logThis();
- função
- indefinido
- Function.prototype
- janela
Reference what is the javascript window
Which class-based component is equivalent to this function component?
Q77.const Greeting = ({ name }) => <h1>Hello {name}!</h1>;
-
class Greeting extends React.Component { render() { return <h1>Hello {this.props.name}!</h1>; } }
-
class Greeting extends React.Component { constructor() { return <h1>Hello {this.props.name}!</h1>; } }
-
class Greeting extends React.Component { <h>Hello {this.props.name}!</h>; } }
-
class Greeting extends React.Component { render({ name }) { return <h1>Hello {name}!</h1>; } }
What is the output of this code?
Q79.var obj;
console.log(obj);
-
ReferenceError: obj is not defined
-
{}
-
undefined
-
null
Reference working with objects
How would you use the TaxCalculator to determine the amount of tax on $50?
Q80.class TaxCalculator {
static calculate(total) {
return total * 0.05;
}
}
- calcular(50);
- new TaxCalculator().calcular($50);
- TaxCalculator.calculate(50);
- new TaxCalculator().calcular(50);
Funções de referência em javascript
What is wrong with this code?
Q81.const foo = {
bar() {
console.log('Hello, world!');
},
name: 'Albert',
age: 26,
};
- The function bar needs to be defined as a key/value pair.
- Trailing commas are not allowed in JavaScript.
- Functions cannot be declared as properties of objects.
- Nenhuma coisa, there are no errors.
What will be logged to the console?
Q82.console.log('I');
setTimeout(() => {
console.log('love');
}, 0);
console.log('Javascript!');
- .
I
Javascript!
love
- .
love
I
Javascript!
-
The output may change with each execution of code and cannot be determined.
-
.
I
love
Javascript!
Referência https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#reasons_for_delays_longer_than_specified especially see the ‘late timeouts’ seção.
What will this code log to the console?
Q83.const foo = [1, 2, 3];
const [n] = foo;
console.log(n);
- 1
- indefinido
- NaN
- Nenhuma coisa–this is not proper JavaScript syntax and will throw an error.
Reference array deconstruction
How do you remove the property name from this object?
Q84.const foo = {
name: 'Albert',
};
- delete name from foo;
- delete foo.name;
- del foo.name;
- remove foo.name;
Reference working with objects
map()
e a forEach()
methods on the Array prototype?
Q85. Qual é a diferença entre o - There is no difference.
- o
forEach()
method returns a single output value, whereas themap()
method performs operation on each value in the array. - The map() method returns a new array with a transformation applied on each item in the original array, whereas the
forEach()
method iterates through an array with no return value. - o
forEach()
method returns a new array with a transformation applied on each item in the original array, whereas themap()
method iterates through an array with no return value.
Which concept does this code illustrate?
Q86.function makeAdder(x) {
return function (y) {
return x + y;
};
}
var addFive = makeAdder(5);
console.log(addFive(3));
- overloading
- closure
- currying
- overriding
Which tag pair is used in HTML to embed JavaScript?
Q87.-
<script></script>
-
<js></js>
-
<javascript></javascript>
-
<code></code>
If your app receives data from a third-party API, which HTTP response header must the server specify to allow exceptions to the same-origin policy?
Q88.- Security-Mode
- Access-Control-Allow-Origin
- Different-Origin
- Same-Origin
Reference Cross-Origin Resource Sharing
What is the output of this code?
Q89.let rainForests = ['Amazon', 'Borneo', 'Cerrado', 'Congo'];
rainForests.splice(0, 2);
console.log(rainForests);
-
["Amazon","Borneo","Cerrado","Congo"]
-
["Cerrado", "Congo"]
-
["Congo"]
-
["Amazon","Borneo"]
Which missing line would allow you to create five variables(1,dois,três,quatro,five) that correspond to their numerical values (1,2,3,4,5)?
Q90.const numbers = [1, 2, 3, 4, 5];
//MISSING LINE
-
const [one,two,three,four,five]=numbers
-
const {one,two,three,four,five}=numbers
-
const [one,two,three,four,five]=[numbers]
-
const {one,two,three,four,five}={numbers}
What will this code print?
Q91.const obj = {
a: 1,
b: 2,
c: 3,
};
const obj2 = {
...obj,
a: 0,
};
console.log(obj2.a, obj2.b);
- Nenhuma coisa, it will throw an error
- 0 2
- indefinido 2
- indefinido 2
Which line could you add to this code to print “jaguar” para a consola?
Q92.let animals = ['jaguar', 'eagle'];
//Missing Line
console.log(animals.pop()); //Prints jaguar
-
animals.filter(e => e === "jaguar");
-
animals.reverse();
-
animals.shift();
-
animals.pop();
Reference Javascript Array pop()
shift() – removes the FIRST element of an array and returns the removed item.
pop() – removes the LAST element of an array and returns the removed item.
reverse() – reverses the order of the elements in an array.
filtro() – get every element in the array that meets the condition.
What line is missing from this code?
Q93.//Missing Line
for (var i = 0; i < vowels.length; i++) {
console.log(vowels[i]);
//Each letter printed on a separate line as follows;
//a
//e
//i
//o
//u
}
-
let vowels = "aeiou".toArray();
-
let vowels = Array.of("aeiou");
-
let vowels = {"a", "e", "i", "o", "u"};
-
let vowels = "aeiou";
What will be logged to the console?
Q94.const x = 6 % 2;
const y = x ? 'One' : 'Two';
console.log(y);
- indefinido
- 1
- verdade
- Dois
Nota: this question is same with Q46.
Reference ternary operator js
How would you access the word It from this multidimensional array?
Q95.let matrix = [["You","Can"],["Do","It"],["!","!","!"]];
-
matrix[1[2]]
-
matrix[1][1]
-
matrix[1,2]
-
matrix[1][2]
What does this code do?
Q96.const animals = ['Rabbit', 'Dog', 'Cat'];
animals.unshift('Lizard');
- It adds “Lizard” to the start of the animals array.
- It adds “Lizard” to the end of the animals array.
- It replaces “Rabbit” com “Lizard” in the animals array.
- It replaces “Cat” com “Lizard” in the animals array.
What is the output of this code?
Q97.let x = 6 + 3 + '3';
console.log(x);
- 93
- 12
- 66
- 633
Which statement can take a single expression as input and then look through a number of choices until one that matches that value is found?
Q98.- senão
- quando
- E se
- interruptor
Which statement prints “roar” para a consola?
Q99.var sound = 'grunt';
var bear = { sound: 'roar' };
function roar() {
console.log(this.sound);
}
-
bear.bind(roar);
-
roar.bind(bear);
-
roar.apply(bear);
-
bear[roar]();
Which choice is a valid example of an arrow function, assuming c is defined in the outer scope?
Q100.-
a, b => { return c; }
-
a, b => c
-
{ a, b } => c
-
(a,b) => c
Which statement correctly imports this code from some-file.js?
Q101.//some-file.js
export const printMe = (str) => console.log(str);
-
import printMe from './some-file';
-
import { printMe } from './some-file';
-
import default as printMe from './some-file';
-
const printMe = import './some-file';
Reference importing libraries in javascript
What will be the output of this code?
Q102.const arr1 = [2, 4, 6];
const arr2 = [3, 5, 7];
console.log([...arr1, ...arr2]);
-
[2, 3, 4, 5, 6, 7]
-
[3,5,7,2,4,6]
-
[3, 5, 7, 2, 4, 6]
-
[[2, 4, 6], [3, 5, 7]]
-
[2, 4, 6, 3, 5, 7]
Which method call is chained to handle a successful response returned by fetch()
?
Q103. -
done()
-
then()
-
finally()
-
catch()
Which choice is not an array method?
Q104.-
array.slice()
-
array.shift()
-
array.push()
-
array.replace()
Which JavaScript loop ensures that at least a singular iteration will happen?
Q105.- do…while
- forEach
- enquanto
- para
What will be logged to the console?
Q106.console.log(typeof 'blueberry');
-
string
-
array
-
Boolean
-
object
What is the output that is printed when the div containing the text “Click Here” is clicked?
Q107.//HTML Markup
<div id="A">
<div id="B">
<div id="C">Click Here</div>
</div>
</div>
//JavaScript
document.querySelectorAll('div').forEach((e) => {
e.onclick = (e) => console.log(e.currentTarget.id);
});
- C B A
- UMA
- C
- A B C
What will this code log to the console?
Q108.const myNumbers = [1, 2, 3, 4, 5, 6, 7];
const myFunction = (arr) => {
return arr.map((x) => x + 3).filter((x) => x < 7);
};
console.log(myFunction(myNumbers));
-
[4,5,6,7,8,9,10]
-
[4,5,6,7]
-
[1,2,3,4,5,6]
-
[4,5,6]
Funções de referência em javascript
What does this code print to the console?
Q109.let rainForestAcres = 10;
let animals = 0;
while (rainForestAcres < 13 || animals <= 2) {
rainForestAcres++;
animals += 2;
}
console.log(animals);
- 2
- 4
- 6
- 8
Reference MDN JavaScript Looping code
YOU GOT THIS” para a consola?
Q110. Qual trecho você poderia adicionar a este código para imprimir “let cipherText = [...'YZOGUT QGMORTZ MTRHTILS'];
let plainText = '';
/* Missing Snippet */
console.log(plainText); //Prints YOU GOT THIS
- UMA
for (let key of cipherText.keys()) {
plainText += key % 2 === 0 ? key : ' ';
}
- B
for (let [index, value] of cipherText.entries()) {
plainText += index % 2 !== 0 ? value : '';
}
- C
for (let [index, value] of cipherText.entries()) {
plainText += index % 2 === 0 ? value : '';
}
- D
for (let value of cipherText) {
plainText += value;
}
- Reference MDN JavaScript Destructuring
- Reference MDN JavaScript Array entries
- Reference MDN JavaScript Remainder/Modulo
Which Pokemon will be logged to the console?
Q111.var pokedex = ['Snorlax', 'Jigglypuff', 'Charmander', 'Squirtle'];
pokedex.pop();
console.log(pokedex.pop());
- Charmander
- Jigglypuff
- Snorlax
- Squirtle
Explicação: The pop() method removes the last element from an array and returns that element. This method changes the length of the array.
Which statement can be used to select the element from the DOM containing the text “The LinkedIn Learning library has great JavaScript courses” from this markup?
Q112.<h1 class="content">LinkedIn Learning</h1>
<div class="content">
<span class="content">The LinkedIn Learning library has great JavaScript courses!</span>
</div>
- document.querySelector(“div.content”)
- document.querySelector(“span.content”)
- document.querySelector(“.contente”)
- document.querySelector(“div.span”)
Which value is not falsey?
Q113.-
[]
-
undefined
-
0
-
null
What line of code causes this code segment to throw an error?
Q114.const lion = 1;
let tiger = 2;
var bear;
++lion;
bear += lion + tiger;
tiger++;
-
line 5, because lion cannot be reassigned a value
-
line 6, because the += operator cannot be used with the undefined variable bear
-
line 5, because the prefix (++) operator does not exist in JavaScript
-
line 3, because the variable bear is left undefined
What will be the value of result
after running this code?
Q115. const person = { name: 'Dave', age: 40, hairColor: 'blue' };
const result = Object.keys(person).map((x) => x.toUpperCase());
- It will throw a TypeError.
-
["Name", "Age", "HairColor"]
-
["DAVE", 40, "BLUE"]
-
["NAME", "AGE", "HAIRCOLOR"]
Which snippet could you insert to this code to print “nadar” para a consola?
Q116.let animals = ["eagle", "osprey", "salmon"];
let key = animal => animal === "salmon";
if(/* Insert Snippet Here */){
console.log("swim");
}
-
animals.every(key)
-
animals.some(key).length === 1
-
animals.filter(key) === true
-
animals.some(key)
Reference Array.prototype.some
What is the output of this code?
Q117.class RainForest {
static minimumRainFall = 60;
}
let congo = new RainForest();
RainForest.minimumRainFall = 80;
console.log(congo.minimumRainFall);
-
undefined
-
None of these answers, as static is not a feature in Javascript.
-
60
-
80
How can you attempt to access the property a.b
em obj
without throwing an error if a is undefined?
Q118. let obj = {};
-
obj?.a.b
-
obj.a?.b
-
obj[a][b]
-
obj.?a.?b
Reference Optional chaining (?.)
What happens when you run this code?
Q119.if (true) {
var x = 5;
const y = 6;
let z = 7;
}
console.log(x + y + z);
- It will throw a
ReferenceError
sobrex
. - It will print
18
. - It will print
undefined
. - It will throw a
ReferenceError
sobrey
.
What does this code print to the console?
Q120.const x = [1, 2];
const y = [5, 7];
const z = [...x, ...y];
console.log(z);
-
[1,2,5,7]
-
[[1, 2], [5, 7]]
-
[2,7]
-
[2,1,7,5]
Given this code, which statement will be evaluated as false?
Q121.const a = { x: 1 };
const b = { x: 1 };
-
a['x'] === b['x']
-
a != b
-
a === b
-
a.x === b.x
What will this code log to the console?
Q122.console.log(typeof 41.1);
-
Nothing. It resuults in a ReferenceError.
-
decimal
-
float
-
number
What is the output of this code?
Q123.let scores = [];
scores.push(1, 2);
scores.pop();
scores.push(3, 4);
scores.pop();
score = scores.reduce((a, b) => a + b);
console.log(score);
-
3
-
4
-
6
-
7
What does this code print to the console?
Q124.let bear = {
sound: 'roar',
roar() {
console.log(this.sound);
},
};
bear.sound = 'grunt';
let bearSound = bear.roar;
bearSound();
-
Nothing is printed to the console.
-
grunt
-
undefined
-
roar
What is the output of this code?
Q125.var cat = { name: 'Athena' };
function swap(feline) {
feline.name = 'Wild';
feline = { name: 'Tabby' };
}
swap(cat);
console.log(cat.name);
- indefinido
- Wild
- Tabby
- Athena
What will this code output to the log?
Q126.var thing;
let func = (str = 'no arg') => {
console.log(str);
};
func(thing);
func(null);
- null no arg
- no arg no arg
- null null
- no arg null
What will this code print to the console?
Q127.const myFunc = () => {
const a = 2;
return () => console.log('a is ' + a);
};
const a = 1;
const test = myFunc();
test();
- a is 1
- a is undefined
- It won’t print anything.
- a is 2
What will this code print to the console?
Q128.const myFunc = (num1, num2 = 2, num3 = 2) => {
return num1 + num2 + num3;
};
let values = [1, 5];
const test = myFunc(2, ...values);
console.log(test);
- 8
- 6
- 2
- 12
Which code would you use to access the Irish flag?
Q129.var flagsJSON =
'{ "countries" : [' +
'{ "country":"Ireland" , "flag":"🇮🇪" },' +
'{ "country":"Serbia" , "flag":"🇷🇸" },' +
'{ "country":"Peru" , "flag":"🇵🇪" } ]}';
var flagDatabase = JSON.parse(flagsJSON);
- flagDatabase.countries[1].flag
- flagDatabase.countries[0].flag
- flagDatabase[1].flag
- flagsJSON.countries[0].flag
Which snippet allows the acresOfRainForest variable to increase?
Q130.let conservation = true;
let deforestation = false;
let acresOfRainForest = 100;
if (/* Snipped goes here */){
++acresOfRainForest;
}
- conservação && !desmatamento
- !desmatamento && !conservação
- !conservação || desmatamento
- desmatamento && conservação || desmatamento
Which of these evaluate to true?
Q131.- Boolean(“falso”)
- Boolean(“”)
- Boolean(0)
- Boolean(NaN)
How would you add a data item named animal with a value of sloth to local storage for the current domain?
Q132.- LocalStorage.setItem(“animal”,”sloth”);
- document.localStorage.setItem(“animal”,”sloth”);
- localStorage.setItem({animal:”sloth”});
- localStorage.setItem(“animal”,”sloth”);
What value is printed to the console after this code execute?
Q133.let cat = Object.create({ type: 'lion' });
cat.size = 'large';
let copyCat = { ...cat };
cat.type = 'tiger';
console.log(copyCat.type, copyCat.size);
- tiger large
- lion undefined
- undefined large
- lion large
What does this code print to the console?
Q134.let animals = [{ type: 'lion' }, 'tiger'];
let clones = animals.slice();
clones[0].type = 'bear';
clones[1] = 'sheep';
console.log(animals[0].type, clones[0].type);
console.log(animals[1], clones[1]);
- bear bear tiger sheep
- lion bear sheep sheep
- bear bear tiger tiger
- lion bear tiger sheep
What will be the output of the following code?
Q135.a=5;
b=4;
alert(a++(+(+(+b))));
- 18
- 10
- 9
- 20
Q136. Qual trecho você poderia adicionar a este código para imprimir “{“tipo”: “Tigre siberiano”}” para a consola?
let cat = { type: "tiger", size: "large" };
let json = /* Snippet here */;
console.log(json); // print {"type":"tiger"}
-
cat.toJSON("type");
-
JSON.stringify(cat, ["type"]);
-
JSON.stringify(cat);
-
JSON.stringify(cat, /type/);
Which document method is not used to get a reference to a DOM node?
Q137.- document.getNode();
- document.getElementsByClassName();
- document.querySelectorAll();
- document.querySelector();
In JavaScript, all objects inherit a built-in property from a ****___****.
Q138.- node
- instance variable
- prototype
- accessor
Which of the following are not server-side Javascript objects?
Q139.- Date
- FileUpload
- Função
- Tudo acima
What will be the output of the following code snippet?
Q140.const obj1 = { first: 20, second: 30, first: 50 };
console.log(obj1);
- primeiro: 30 , é importante entender por que esses animais passaram a ser parte integrante da identidade canadense: 50
- primeiro: 50 , é importante entender por que esses animais passaram a ser parte integrante da identidade canadense: 30
- primeiro: 30 , é importante entender por que esses animais passaram a ser parte integrante da identidade canadense: 20
- Nenhuma das acima
Which object in Javascript doesn’t have a prototype?
Q141.- Base Object
- All objects have prototype
- None of the objects have prototype
- Nenhuma das acima
What does … operator do in JS?
Q142.- Used to spread iterables to individual elements
- Describe datatype of undefined
- No such operator exists
- Nenhuma das acima
Q143. How to stop an interval timer in Javascript?
- clearInterval
- clearTimer
- intervalOver
- Nenhuma das acima
Q144. What will be the output of the following code snippet?
print(typeof NaN);
- Objeto
- Number
- Corda
- Nenhuma das acima
Q145. What will be the output of the following code snippet?
<script type="text/javascript">a = 5 + "9"; document.write(a);</script>
- Compilation Error
- 14
- Runtime Error
- 59
Q146. Which of the following methods can be used to display data in some form using Javascript?
- document.write()
- console.log()
- window.alert()
- all of the above
Q147. What value is assigned to total after this code executes?
function sum(num1, num2 = 2, num3 = 3) {
return num1 + num2 + num3;
}
let values = [1, 5];
let total = sum(4, ...values);
- 10
- 6
- 7
- 8
Q148. Which statement is applicable to the defer attribute of the HTML <roteiro> tag?
- defer allows the browser to continue processing the page while the script loads in the background.
- defer causes the script to be loaded from the backup content delivery network (CDN).
- defer blocks the browser from processing HTML below the tag until the script is completely loaded.
- defer lazy loads the script, causing it to download only when it is called by another script on the page.
Referência: defer html script attribute
Q149. Which method of a class is called to initialize an object of that class?
- init()
- Criar()
- Novo()
- constructor()
Referência: constructor method
Q150. Which expression evaluates to true?
- Boolean(NaN)
- Boolean(0)
- Boolean(“falso”)
- Boolean(“”)
Q151. How would you check if the word “pot” is in the word “potato”?
- “pot”.índice de(“potato”) !== -1
- “potato”.includes(“Pot”)
- “potato”.includes(“pot”)
- “potato”.Associado engenheiro de segurança do Microsoft AZ-500 Azure(“pot”);
Referência: String.prototype.includes()
Q152. Which collection object allows a unique value to be inserted only once?
- Mapa
- Variedade
- Definir
- Objeto
Referência: developer.mozilla Set
Q153. How would you change the color of this header to pink?
<h2 id="cleverest">girls</h2>
- document.getElementByName(“cleverest”).style.color = “cor de rosa”;
- document.getElementsByTagName(“H2”).style.color = “cor de rosa”;
- document.getElementByName(“H2”).style.color = “cor de rosa”;
- document.getElementById(“cleverest”).style.color = “cor de rosa”;
Referência: W3Schools HTML DOM Style color Property
Q154. Which line is missing from this code if you expect the code to evaluate to true?
var compare = function (test1, test2) {
// Missing line
};
compare(1078, '1078'); // yields true
-
test1==test2;
- return test1===test2;
- return test1==test2;
- return test1!=test2;
Q155. What is the output of this code?
if (true) {
var first = 'You';
}
function fScope() {
var second = 'got this!';
}
fScope();
console.log(first);
console.log(second);
- Você
indefinido - Você
ReferenceError - indefinido
indefinido - Você
got this!
Referência: W3schools JS Scoping
Q156. What is the output for the code given below?
console.log('hello' + 'world');
- helloworld!
- helloworld !
- hello world!
- hello world !
Q157. What is the output of this code?
console.log(10 + 10);
- 10
- 20
- 30
- 40
Q158. Events related to the browser window can be handled by?
- Onclicks
- Janela
- querySelector
- Nenhuma das acima
Q159. How do you define a function in JavaScript?
- function myFunction() {}
- def myFunction() {}
- var myFunction = () => {}
- func myFunction() {}
Q160. Your code is producing the error: TypeError: Cannot read property ‘reduce’ of undefined. O que isso significa?
- You are calling a method named reduce on an object that’s declared but has no value.
- You are calling a method named reduce on an object that does not exist.
- You are calling a method named reduce on an empty array.
- You are calling a method named reduce on an object that has a null value.
Q161. Which of the following methods can be used to display data in some form using Javascript?
- document.write()
- console.log()
- window.alert()
- all of the above
Q162. Which document method is not used to get a reference to a DOM node?
- document.getNode();
- document.getElementsByClassName();
- document.querySelectorAll();
- document.querySelector();
Q163. Which of these is a valid variable name?
- 5thItem
- firstName
- grand total
- função
Q164. What function is used in JavaScript to schedule a function to run after a specified number of milliseconds?
- setTimeout()
- setInterval()
- delay()
- Eu incluí alguns exemplos concretos como recursos que você pode querer ler para um conhecimento mais aprofundado()
Q165. Which of the following is a server-side Java Script object?
- Função
- Arquivo
- FileUpload
- Date
Q166. Which statement best describes the var keyword’s scope in JavaScript?
- Block scope
- Function scope
- Global scope
- Instance scope
Q167. What will be logged to the console?
const foo = () => console.log('First');
const bar = () => setTimeout(() => console.log('Second'), 0);
foo();
bar();
console.log('Third');
- Segundo, Primeiro, Terceiro
- Primeiro, Terceiro, Segundo
- Primeiro, Segundo, Terceiro
- Terceiro, Primeiro, Segundo
Q168. What will be the output of running this code?
function scream(words) {
return words.toUpperCase() + '!!!';
}
scream('yay');
- YAY!!!
- ReferenceError
- Undefined
- TypeError
Deixe uma resposta
Você deve Conecte-se ou registro para adicionar um novo comentário .