Buscar

When studying the structure of if-else statements, we are always told that when we have two possible answers, we should choose the structure of the...

When studying the structure of if-else statements, we are always told that when we have two possible answers, we should choose the structure of the compound if instead of using two simple if structures. Observe the statements below and then choose the answer that supports the use of the compound if instead of the simple if. I - Greater clarity in the code, but it does not affect its efficiency. II - Greater efficiency because it reduces the number of tests in the code. III - Greater efficiency only because the code becomes more readable, since the final result is the same. IV - Only a choice of the developer, since the final result is the same. Only I is correct. II and III are correct. Only II is correct. II and IV are correct. Only IV is correct.

I - Greater clarity in the code, but it does not affect its efficiency.
II - Greater efficiency because it reduces the number of tests in the code.
III - Greater efficiency only because the code becomes more readable, since the final result is the same.
IV - Only a choice of the developer, since the final result is the same.
Only I is correct.
II and III are correct.
Only II is correct.
II and IV are correct.
Only IV is correct.

Essa pergunta também está no material:

algoritmo6b
1 pág.

Algoritmos Universidade Estácio de SáUniversidade Estácio de Sá

💡 1 Resposta

User badge image

Ed Verified user icon

A alternativa correta que suporta o uso do if composto em vez do if simples é a II - Maior eficiência porque reduz o número de testes no código. Com o uso do if composto, o código executa menos testes, o que pode melhorar a eficiência do programa. Além disso, o código também pode se tornar mais legível, o que pode ajudar na manutenção do código.

0
Dislike0

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes

✏️ Responder

SetasNegritoItálicoSublinhadoTachadoCitaçãoCódigoLista numeradaLista com marcadoresSubscritoSobrescritoDiminuir recuoAumentar recuoCor da fonteCor de fundoAlinhamentoLimparInserir linkImagemFórmula

Para escrever sua resposta aqui, entre ou crie uma conta

User badge image

Outros materiais