O GoConqr está de visual novo! Conte para nós o que você achou.

Quiz

Conditional statements self assesment quiz

Usuário eliminado 8 perguntas Atualizado em 22 fev 2019

Fazer o quiz

Perguntas do quiz (8)

  1. 1Which of the following values evaluate eventually to false?
    1. A22
    2. B0
    3. C'undefined'
    4. D!false
  2. 2What does the following code produce as a message?

    var numOfChoice = 3;

    switch(numOfChoice) {
    case 1:
    console.log(`You have selected ${numOfChoice}');
    break;
    case 2:
    console.log(`You have selected ${numOfChoice}');
    break;
    case 3:
    console.log(`You have selected ${numOfChoice}');
    default:
    console.log(`You have selected nothing!');
    1. AYou have selected 3
    2. BYou have selected nothing!
    3. Cerror! A break keyword is missing.
    4. DYou have selected 3
      You have selected nothing!
  3. 3When is it appropriate to use a switch-case syntax in favor of if-else statements?
    1. AThere is no case at all, if else syntax is more precise and less error prone.
    2. BWhen we want to check multiple times if a variable holds a specific value.
    3. CIn any case. Switch cases provide a better and cleaner syntax to work with.
    4. DIn case we want to compare a variable if is greater or lower than a specific value.
  4. 4What does the following code produce as a message to console?

    var choice = 5;

    if (choice == 2) {
    console.log(2);
    } else {
    console.log(choice);
    }else if (choice == 5) {
    console.log('You have selected 5 pieces');
    }
    1. A2
    2. BYou have selected 5 pieces.
    3. CThe number of your choice.
    4. DSyntax error.
  5. 5Imagine we are having 10 numbers from 1 to 10. 1, 2, 3, 4, 5, 6, 7, ,8 ,9, 10.

    For everyone of these numbers we run the following statement:
    if (num % 2 !== 0 ) {
    // Do something here
    }

    Under which numbers will this condition be executed?
    1. Anone
    2. Ball
    3. C2, 4, 6, 8, 10
    4. D1, 3, 5, 7, 9
  6. 6Given that we have these variables:

    var money = 2;
    var drink = 5;
    var inMood = true;
    var freeTime = true;

    if (money - drink > 0 || !inMood && freetime) {
    console.log('Go out for a drink');
    } else {
    console.log('Stay in');
    }

    Will i go for a drink or what?
    1. AOf course i do. Party animal rules.
    2. BNope. Misery at it's best.
  7. 7What is the outcome of this statement?

    var playFootball = true;

    !playFootball ? console.log('I told you, you can't play today!') : console.log('Play freely without fear');
    1. AI told you, you can't play today!
    2. BPlay freely without fear
  8. 8Select one of the following statements that is wrong.
    1. AIn if else statements, it is a good practice to check the more unique condition first and then the more general.
    2. BThere is no limit to how many 'if else' statements we can put as alternatives to an if block.
    3. CDefault option is mandatory inside a switch case block.
    4. D'Else' statement is mandatory as alternative to an 'if' block.

Informações

Descrição
O usuário eliminou as informações de disciplina Quiz sobre Conditional statements self assesment quiz, criado por Usuário eliminado em 06-09-2018.
Autor
Usuário eliminado
Idioma
English
Visualizações
98
Histórico
Criado em 6 set 2018 · atualizado em 22 fev 2019

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?