LPI 102 - Shells, Scripting And Data Management 1- Marcus Vinicius Braga Alcantara

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Viniciusalcantar
V
Viniciusalcantar
Community Contributor
Quizzes Created: 11 | Total Attempts: 5,934
Questions: 80 | Attempts: 471

SettingsSettingsSettings
LPI 102 - Shells, Scripting And Data Management 1- Marcus Vinicius Braga Alcantara - Quiz

.


Questions and Answers
  • 1. 

    Qual o valor da variável especial $$ do shell BASH ?

    • A.

      Contém o valor PID do processo em execução.

    • B.

      Contém a versão do BASH em uso.

    • C.

      Contém o tipo de terminal em uso.

    • D.

      Contém o nome do atual script em execução.

    Correct Answer
    A. Contém o valor PID do processo em execução.
    Explanation
    A variável especial $$ do shell BASH contém o valor PID do processo em execução.

    Rate this question:

  • 2. 

    Qual das instruções abaixo é uma instrução SQL SELECT válida ?

    • A.

      SELECT nome, telefone FROM contatos;

    • B.

      SELECT FROM contatos nome, telefone;

    • C.

      SELECT nome FROM contatos, telefone;

    • D.

      SELECT contatos FROM nome, telefone;

    Correct Answer
    A. SELECT nome, telefone FROM contatos;
    Explanation
    The correct answer is "SELECT nome, telefone FROM contatos;". This is a valid SQL SELECT statement because it selects the columns "nome" and "telefone" from the table "contatos".

    Rate this question:

  • 3. 

    Qual comando que fecha uma estrutura de condição if ?

    • A.

      fi

    • B.

      endfi

    • C.

      end

    • D.

      done

    Correct Answer
    A. fi
    Explanation
    The correct answer is "fi". In shell scripting, "fi" is used to close an if statement. It marks the end of the if block and allows the program to continue executing the code after the if statement.

    Rate this question:

  • 4. 

    Qual comando remove um alias do shell já definido ?

    • A.

      rmalias

    • B.

      rm

    • C.

      delalias

    • D.

      unalias

    Correct Answer
    D. unalias
    Explanation
    The correct answer is "unalias". This command is used to remove an alias that has been previously defined in the shell.

    Rate this question:

  • 5. 

    Qual dos comandos abaixo, irá exibir informações sobre as variáveis de ambiente no seu sistema ?

    • A.

      builtin

    • B.

      join

    • C.

      env

    • D.

      source

    Correct Answer
    C. env
    Explanation
    The command "env" will display information about the environment variables in the system.

    Rate this question:

  • 6. 

    Qual instrução SQL que modifica dados já inseridos em uma tabela ?

    • A.

      WHERE

    • B.

      DELETE

    • C.

      INSERT

    • D.

      UPDATE

    Correct Answer
    D. UPDATE
    Explanation
    The correct answer is UPDATE. The UPDATE statement in SQL is used to modify existing data in a table. It allows you to change the values of one or more columns in a specific row or multiple rows based on a specified condition using the WHERE clause. This statement is commonly used to update records with new values or to correct existing data in a database table.

    Rate this question:

  • 7. 

    Qual arquivo do shell BASH é lido após um logout bem sucedido do sistema ?

    • A.

      ~/.exit

    • B.

      ~/.logout

    • C.

      ~/.bash_profile

    • D.

      ~/.bash_logout

    Correct Answer
    D. ~/.bash_logout
    Explanation
    After successfully logging out of the system, the BASH shell reads the ~/.bash_logout file. This file contains commands or scripts that need to be executed before the user completely logs out of the system. It can be used to clean up temporary files, close connections, or perform any other necessary tasks before the user session ends.

    Rate this question:

  • 8. 

    Qual o comando que torna uma variável do shell como sendo do tipo GLOBAL ?

    Correct Answer
    export
    Explanation
    The command "export" is used to make a shell variable global. When a variable is exported, it can be accessed by other processes or subshells. This allows the variable to be shared and used throughout the entire shell environment, rather than being limited to a specific shell or script.

    Rate this question:

  • 9. 

    Qual o comando que fecha uma estrutura de seleção case ?

    Correct Answer
    esac
    Explanation
    The command "esac" is used to close a case selection structure in shell scripting. The "case" command is used to test a variable against multiple patterns and execute different commands based on the matching pattern. After listing all the patterns and their corresponding commands, the "esac" command is used to indicate the end of the case structure.

    Rate this question:

  • 10. 

    O comando seq -w -s ‘;’ 2 12 exibe qual resultado em tela ?

    • A.

      0;2;4;6;8;10;12

    • B.

      02;03;04;05;06;07;08;09;10;11;12

    • C.

      2;3;4;5;6;7;8;9;10;11;12

    • D.

      02;03;04;05;06;07;08;09;010;011;012

    Correct Answer
    B. 02;03;04;05;06;07;08;09;10;11;12
    Explanation
    The command "seq -w -s ';' 2 12" will display the numbers from 2 to 12 with leading zeros and separated by semicolons. Therefore, the correct answer is "02;03;04;05;06;07;08;09;10;11;12".

    Rate this question:

  • 11. 

    A variável REPLY é utilizada por qual comando quando não definimos uma ?

    • A.

      set

    • B.

      read

    • C.

      goto

    • D.

      if

    Correct Answer
    B. read
    Explanation
    The variable "REPLY" is used by the "read" command when we do not define a specific variable to store the input. The "read" command is used to take input from the user in a shell script, and if no variable is specified, the input is stored in the default variable "REPLY".

    Rate this question:

  • 12. 

    Qual a ordem correta de leitura dos arquivos de configuração do BASH após um login bem sucedido ?

    • A.

      1. ~/.bashrc 2. /etc/profile 3. /etc/bashrc 4. ~/.bash_profile

    • B.

      1. /etc/profile 2. /etc/bashrc 3. ~/.bashrc 4. ~/.bash_profile

    • C.

      1. ~/.bash_profile 2. /etc/profile 3. ~/.bashrc 4. /etc/bashrc

    • D.

      1. /etc/profile 2. ~/.bash_profile 3. ~/.bashrc 4. /etc/bashrc

    Correct Answer
    D. 1. /etc/profile 2. ~/.bash_profile 3. ~/.bashrc 4. /etc/bashrc
    Explanation
    After a successful login, the BASH configuration files are read in the following order: /etc/profile, ~/.bash_profile, ~/.bashrc, and /etc/bashrc.

    Rate this question:

  • 13. 

    Qual comando impede que um arquivo seja sobrescrito pelo caracter de redirecionamento > do shell ?

    • A.

      chmod o=-w

    • B.

      set -o noclobber

    • C.

      chattr +A

    • D.

      enable -n

    Correct Answer
    B. set -o noclobber
    Explanation
    The command "set -o noclobber" prevents a file from being overwritten by the shell redirection character ">". This command sets the noclobber option, which means that if a file already exists, the shell will not overwrite it when using the ">" redirection operator. Instead, it will display an error message. This is useful when you want to avoid accidentally overwriting important files.

    Rate this question:

  • 14. 

    Em qual arquivo posso definir o diretório /opt/bin como sendo parte dos valores de pesquisa da variável PATH ?

    • A.

      /etc/profile

    • B.

      ~/.profile

    • C.

      ~/.bash_login

    • D.

      ~/.bashrc

    Correct Answer(s)
    A. /etc/profile
    B. ~/.profile
    C. ~/.bash_login
    Explanation
    As the question asks about the file where the directory /opt/bin can be defined as part of the search values of the PATH variable, the correct answer is /etc/profile, ~/.profile, and ~/.bash_login. These files are commonly used in Unix-like systems to set environment variables, including the PATH variable. The /etc/profile file is a system-wide configuration file, while ~/.profile and ~/.bash_login are user-specific configuration files. By adding the directory /opt/bin to any of these files, the system will include it in the search path when looking for executable files.

    Rate this question:

  • 15. 

    Qual dos comandos abaixo irá incluir um registro na tabela CLIENTES ?

    • A.

      SELECT

    • B.

      DELETE

    • C.

      UPDATE

    • D.

      INSERT

    Correct Answer
    D. INSERT
    Explanation
    The INSERT command is used to add a new record to a table in a database. In this case, the command "INSERT" is the only option that explicitly states the action of adding a record to the table CLIENTES. The SELECT command is used to retrieve data from a table, the DELETE command is used to remove records from a table, and the UPDATE command is used to modify existing records in a table. Therefore, the correct answer is INSERT.

    Rate this question:

  • 16. 

    Observe o seguinte script (test.sh) conforme a figura abaixo. Qual será o resultado exibido para o usuário após a execução do script com o seguinte argumento; sh test.sh /bin ?

    • A.

      Este script não pode ser executado.

    • B.

      Não será exibido nenhuma mensagem ao usuário.

    • C.

      0

    • D.

      1

    Correct Answer
    C. 0
    Explanation
    The correct answer is 0.

    Rate this question:

  • 17. 

    Em qual arquivo posso definir uma variável global que será utilizada por todos os logins do sistema ? (Especifique o caminho completo do arquivo).

    Correct Answer
    /etc/profile
    Explanation
    The correct answer is /etc/profile. The /etc/profile file is a system-wide configuration file in Unix-like operating systems. It is executed by the login shell for all users upon login. In this file, you can define environment variables that will be available to all users of the system. By setting a variable in this file, it becomes a global variable that can be accessed by any user logging into the system.

    Rate this question:

  • 18. 

    Normalmente nós definimos funções e aliases particular de nosso login em qual arquivo ?

    • A.

      ~/.bash_login

    • B.

      ~/.bash_profile

    • C.

      ~/.bashrc

    • D.

      ~/.profile

    Correct Answer
    C. ~/.bashrc
    Explanation
    The correct answer is ~/.bashrc. This is because ~/.bashrc is the file where we typically define functions and aliases specific to our login in a Bash shell environment. The other options mentioned are also valid files for defining login-specific configurations, but ~/.bashrc is the most commonly used one.

    Rate this question:

  • 19. 

    Qual a diferença entre os comandos SET e ENV ?

    • A.

      SET exibe variáveis do shell corrente e ENV exibe todas as variáveis inclusive as que foram exportadas.

    • B.

      SET define uma variável para ser utilizada e ENV exibe todas as variáveis do Shell.

    • C.

      SET exibe variáveis exportadas e ENV somente as do shell ambiente.

    • D.

      SET e ENV possuem a mesma função. Ambos foram compilados pelo GCC.

    Correct Answer
    A. SET exibe variáveis do shell corrente e ENV exibe todas as variáveis inclusive as que foram exportadas.
    Explanation
    SET and ENV are two different commands used in shell scripting. The SET command displays variables specific to the current shell session, while ENV displays all variables, including those that have been exported. Therefore, the correct answer is that SET displays variables from the current shell session, and ENV displays all variables, including exported ones. The other options provided in the question are incorrect.

    Rate this question:

  • 20. 

    O comando test -x /bin/sync tem qual finalidade ?

    • A.

      Testa se o arquivo existe e tem permissão de leitura.

    • B.

      Testa se o arquivo existe e tem permissão de execução.

    • C.

      Testa se o arquivo existe e tem permissão de escrita.

    • D.

      Testa se o arquivo existe e é um diretório.

    Correct Answer
    B. Testa se o arquivo existe e tem permissão de execução.
    Explanation
    The command "test -x /bin/sync" is used to test if the file "/bin/sync" exists and has execute permission.

    Rate this question:

  • 21. 

    Na confecção de um novo script bash, qual deve ser o valor de sua primeira linha ?

    • A.

      !bash -x

    • B.

      #bash_script

    • C.

      #!/bin/bash

    • D.

      !#/bin/bash

    Correct Answer
    C. #!/bin/bash
    Explanation
    The correct answer is "#!/bin/bash". This is because the "#!" symbol is known as the shebang, and it is used to specify the interpreter that should be used to execute the script. In this case, the shebang specifies that the script should be executed using the bash interpreter.

    Rate this question:

  • 22. 

    Qual o valor da variável especial $! do shell BASH ?

    • A.

      Contém o PID do último processo executado pelo shell.

    • B.

      Contém o nome do último login que acessou o sistema.

    • C.

      O nome da variável é inválido e a mesma não faz parte das variáveis do shell BASH.

    • D.

      Armazena o valor PID do processo init.

    Correct Answer
    A. Contém o PID do último processo executado pelo shell.
    Explanation
    The correct answer is "Contém o PID do último processo executado pelo shell." This means that the variable $! in the BASH shell contains the Process ID (PID) of the last process that was executed by the shell.

    Rate this question:

  • 23. 

    Como eu posso verificar o sucesso ou não de um comando executado ?

    • A.

      Através do comando show_erros que faz parte dos comandos build-in do shell.

    • B.

      Pelo valor escrito em terminal do comando executado.

    • C.

      Através do valor presente na variável $?

    • D.

      Pela mensagem de erro do comando executado.

    Correct Answer
    C. Através do valor presente na variável $?
    Explanation
    The correct answer is "Através do valor presente na variável $?". This is because the value of the $? variable in the shell stores the exit status of the previously executed command. By checking the value of this variable, you can determine whether the command was successful or not.

    Rate this question:

  • 24. 

    Qual o comando incorporado ao shell BASH que lista todos os alias definidos ?

    Correct Answer
    alias
    Explanation
    The correct answer is "alias". In the BASH shell, the "alias" command is used to list all the aliases that have been defined. Aliases are shortcuts or alternate names for commands, allowing users to create their own custom commands or abbreviations for frequently used commands. By using the "alias" command, users can see a list of all the aliases they have set up in their BASH shell.

    Rate this question:

  • 25. 

    Qual o comando que remove uma variável definida no shell corrente ?

    Correct Answer
    unset
    Explanation
    The "unset" command is used to remove a defined variable in the current shell. It allows the user to unset or delete the value and attributes associated with a variable, making it no longer available for use in the shell.

    Rate this question:

  • 26. 

    Qual das alternativas abaixo pode ser utilizada para criar uma função chamada "palavra" que contenha as seguintes sequencias de comandos; cd /home/root ; echo "Linha Acrescentada" >> teste_func

    • A.

      palavra() { cd /home/root; echo "Linha Acrescentada" >> teste_func; }

    • B.

      palavra { cd /home/root; echo "Linha Acrescentada" >> teste_func; }

    • C.

      palavra[] { cd /home/root echo "Linha Acrescentada" >> teste_func; }

    • D.

      N.D.A

    Correct Answer
    A. palavra() { cd /home/root; echo "Linha Acrescentada" >> teste_func; }
    Explanation
    The correct answer is the first option, "palavra() { cd /home/root; echo "Linha Acrescentada" >> teste_func; }". This is because it correctly defines a function named "palavra" and includes the desired sequence of commands within the curly braces. The "cd /home/root" command changes the directory to "/home/root", and the "echo "Linha Acrescentada" >> teste_func" command appends the string "Linha Acrescentada" to the file "teste_func".

    Rate this question:

  • 27. 

    Quais os dois arquivos agindo em conjunto compõem o ambiente de login de um usuário em uma instalação padrão do Linux?

    • A.

      /etc/profile

    • B.

      /etc/.login

    • C.

      /etc/bashrc

    • D.

      ~/.bash_profile

    • E.

      /etc/.profile

    Correct Answer(s)
    A. /etc/profile
    D. ~/.bash_profile
    Explanation
    The correct answer is /etc/profile and ~/.bash_profile. In a standard Linux installation, these two files work together to compose the user's login environment. The /etc/profile file contains system-wide environment variables and settings that are applied to all users. The ~/.bash_profile file is a user-specific file that allows customization of the user's login environment, such as setting user-specific environment variables and executing specific commands upon login. These two files work in conjunction to provide a personalized login environment for each user.

    Rate this question:

  • 28. 

    Você está criando um script em que precisa testar se um comando foi executado corretamente. Como você testa corretamente o "exit status" do comando executado?

    • A.

      if [ "$#" -eq "0" ]

    • B.

      if [ "$?" -eq "0" ]

    • C.

      if [ "$#" == 0 ]

    • D.

      if [ "$?" == "0"]

    • E.

      if [ $@ -eq 0 ]

    Correct Answer
    B. if [ "$?" -eq "0" ]
    Explanation
    The correct answer is "if [ "$?" -eq "0" ]". In shell scripting, the "$?" variable holds the exit status of the previously executed command. By comparing it to "0" using the "-eq" operator, we can determine if the command executed successfully.

    Rate this question:

  • 29. 

    Como um processo indica ao shell que encerrou com uma condição de erro?

    • A.

      Imprime uma mensagem de erro em stderr.

    • B.

      Imprime uma mensagem de erro em stdout.

    • C.

      Termina com a variável de código de saída com um valor zero.

    • D.

      Termina com a variável de código de saída com um valor diferente de zero.

    • E.

      Causa uma falta de segmentação.

    Correct Answer
    D. Termina com a variável de código de saída com um valor diferente de zero.
    Explanation
    When a process ends with a condition of error, it indicates this to the shell by terminating with the exit code variable having a value different from zero.

    Rate this question:

  • 30. 

    A instrução if [ -n "$NOME"]; then ... será verdadeira se

    • A.

      A variável $NOME contiver um número.

    • B.

      A variável $NOME possuir um ou mais caracteres.

    • C.

      A variável $NOME for nula.

    • D.

      Essa instrução nunca será verdadeira.

    Correct Answer
    B. A variável $NOME possuir um ou mais caracteres.
    Explanation
    The correct answer is "A variável $NOME possuir um ou mais caracteres." This is because the condition "-n $NOME" checks if the variable $NOME is not empty, meaning it has one or more characters. If the variable is not empty, the condition will be true.

    Rate this question:

  • 31. 

    Qual comando pode ser utilizado para listar as funções definidas em um shell bash?

    Correct Answer
    typeset -f
    declare -f
    set
    Explanation
    The correct answer is "typeset -f, declare -f, set". These commands can be used to list the functions defined in a bash shell. The "typeset -f" command lists all the function names and their definitions. The "declare -f" command also lists the function names and their definitions. The "set" command displays all the shell functions along with other shell variables and environment variables.

    Rate this question:

  • 32. 

    Você está olhando para um novo script que você recebeu do administrador sênior. Dentro do script você nota uma linha que inicia com #! seguido por um caminho para um binário. Para esta linha o interpretador de comandos irá:

    • A.

      Ignorar o script.

    • B.

      Usar esse binário para interpretar o script .

    • C.

      Usar esse binário para compilar o script.

    • D.

      Esta linha é somente um comentário.

    Correct Answer
    B. Usar esse binário para interpretar o script .
    Explanation
    A linha que começa com #! seguido por um caminho para um binário é chamada de shebang. Essa linha indica qual interpretador de comandos deve ser usado para executar o script. Portanto, a resposta correta é "Usar esse binário para interpretar o script".

    Rate this question:

  • 33. 

    Temos o bash script "~/myscript" mostrado de acordo com a figura. Ao executar o script comforme a seguir: "./myscript alfa beta gamma delta" O que será mostrado no stdout?  

    • A.

      Alfa

    • B.

      Beta

    • C.

      Gamma

    • D.

      Delta

    Correct Answer
    C. Gamma
    Explanation
    When the script is executed with the given command "./myscript alfa beta gamma delta", it will display "gamma" on the stdout. This is because the script is using the positional parameters "$3" to access the third argument passed to it, which is "gamma". Hence, "gamma" will be printed as the output.

    Rate this question:

  • 34. 

    A primeira linha de um shell script deve sempre conter dois caracteres no início desta linha. Quais são eles?

    Correct Answer
    #!
    Explanation
    The first line of a shell script should always start with the characters #!. This is known as the shebang or hashbang and it is used to specify the interpreter that should be used to execute the script. In this case, the #! indicates that the script should be interpreted by the shell.

    Rate this question:

  • 35. 

    Você está escrevendo um script e gostaria de testar o estado de saída deste processo. Qual das opções abaixo é verdadeira?

    • A.

      O valor de saída normal difere.

    • B.

      Você não pode testar o valor de saída normal.

    • C.

      O valor de saída normal é de $EXIT.

    • D.

      O valor de saída normal é 0.

    Correct Answer
    D. O valor de saída normal é 0.
    Explanation
    The correct answer is "O valor de saída normal é 0." This is because in programming, a return value of 0 typically indicates a successful execution or completion of a process. Therefore, if you want to test the exit status of a process, you would check if the return value is 0 to determine if it exited normally.

    Rate this question:

  • 36. 

    Você quer realizar uma pesquisa em uma base recorrente executando uma série de comandos. Você irá definir a série de comandos disponíveis a partir do início de sua sessão para executar no shell atual. Escolha a melhor solução:

    • A.

      Criar um programa shell.

    • B.

      Criar uma função.

    • C.

      Usar a seta para cima em seu terminal para encontrar os comandos.

    • D.

      Usar o built-in do Bash! função a ser executada na última iteração do comando pelo mesmo nome.

    Correct Answer
    B. Criar uma função.
    Explanation
    A melhor solução é criar uma função. Isso permitirá que você defina uma série de comandos que serão executados em sequência sempre que você chamar essa função. Dessa forma, você pode reutilizar essa função sempre que precisar executar a mesma série de comandos, tornando o processo mais eficiente e automatizado.

    Rate this question:

  • 37. 

    Digite o caminho completo e o nome do arquivo de configuração global onde geralmente contém o sistema de configuração PATH, umask e ulimit: 

    Correct Answer
    /etc/profile
    Explanation
    The correct answer is "/etc/profile". This is because the file "/etc/profile" is the standard location for the global configuration file that contains system-wide configuration settings such as the PATH, umask, and ulimit. By editing this file, administrators can set environment variables and define system-wide behavior for all users on the system.

    Rate this question:

  • 38. 

    Qual comando exclui a variável de ambiente FOOBAR?

    • A.

      unset FOOBAR

    • B.

      del $FOOBAR

    • C.

      export FOOBAR

    • D.

      export FOOBAR=

    Correct Answer
    A. unset FOOBAR
    Explanation
    The correct answer is "unset FOOBAR." This command is used to remove or delete the environment variable named FOOBAR.

    Rate this question:

  • 39. 

    Qual arquivo será usado para configurar o shell bash interativo de um usuário?

    • A.

      ~/.int_bash

    • B.

      .bashrc

    • C.

      .profile

    • D.

      .bash

    Correct Answer
    B. .bashrc
    Explanation
    The correct answer is .bashrc. This file is used to configure the interactive shell for a user in the bash environment. It contains settings and configurations specific to the user's shell session, such as aliases, environment variables, and shell options. When a user logs in or opens a new shell, the .bashrc file is automatically executed, allowing the user to customize their shell environment according to their preferences.

    Rate this question:

  • 40. 

    Quais são os dois arquivos no diretório home de um usuário que são usados para personalizar o ambiente bash?

    • A.

      bash e .bashrc

    • B.

      bashrc e bash_conf

    • C.

      bashrc e bashprofile

    • D.

      .bashrc e .bash_profile

    • E.

      bash.conf e .bash_profile

    Correct Answer
    D. .bashrc e .bash_profile
    Explanation
    The correct answer is .bashrc and .bash_profile. These two files are used to customize the bash environment for a user. The .bashrc file contains specific configurations and settings for the bash shell, such as aliases, functions, and environment variables. It is executed every time a new shell is opened. On the other hand, the .bash_profile file is executed only during the login process and can be used to set up environment variables and execute commands or scripts. Together, these files allow users to personalize their bash environment according to their preferences.

    Rate this question:

  • 41. 

    Onde são definidos aliases de linha de comando para um usuário ? Digite o caminho completo e o nome do arquivo para o usuário conectado no momento.

    Correct Answer
    ~/.bashrc
    Explanation
    The aliases for command line are defined in the file ~/.bashrc. This file is specific to the user currently connected and it contains various settings and configurations for the Bash shell. By editing this file, users can define their own custom aliases for commands, making it easier to execute frequently used commands or to create shortcuts for longer commands.

    Rate this question:

  • 42. 

    Um usuário deseja modificar sua variável de ambiente PATH, o arquivo que você deve dizer-lhe para editar em seu diretório home. Escreva somente o nome, nenhum caminho.

    Correct Answer
    .bash_profile
    Explanation
    The correct answer is ".bash_profile". The user wants to modify their PATH environment variable, and they should edit the ".bash_profile" file in their home directory. This file is responsible for setting up the user's environment when they log in, including defining variables like PATH.

    Rate this question:

  • 43. 

    Considerando a consulta abaixo, o que é mostrado na coluna SALARY quando um valor NULL é retornado?

    • A.

      0

    • B.

      NULL

    • C.

      SPACES

    • D.

      nothing

    Correct Answer
    A. 0
    Explanation
    Quando um valor NULL é retornado, o que é mostrado na coluna SALARY é o valor 0.

    Rate this question:

  • 44. 

    Para qual tarefa será mais apropriado usar o comando DISTINCT?

    • A.

      Identificar linhas duplicadas na tabela.

    • B.

      Identificar quais colunas possuem dados únicos.

    • C.

      Eliminar colunas duplicadas na tabela.

    • D.

      Eliminar linhas duplicadas no resultado.

    Correct Answer
    D. Eliminar linhas duplicadas no resultado.
    Explanation
    O comando DISTINCT é mais apropriado para eliminar linhas duplicadas no resultado. Quando usado em uma consulta, o comando DISTINCT garante que apenas uma instância de cada valor único seja retornado, eliminando assim as linhas duplicadas.

    Rate this question:

  • 45. 

    Para qual tarefa você precisará usar o operador BETWEEN?

    • A.

      Consulta de tabelas com valores desconhecidos.

    • B.

      Consulta de tabelas para uma faixa de valores.

    • C.

      Consulta de tabelas para um tipo de caracte.

    • D.

      Consulta de tabelas para valores específicos de uma lista.

    Correct Answer
    B. Consulta de tabelas para uma faixa de valores.
    Explanation
    O operador BETWEEN é usado para consultar tabelas para uma faixa de valores. Isso significa que você pode usar o operador BETWEEN para recuperar registros de uma tabela onde um determinado valor está dentro de um intervalo específico. Por exemplo, se você quiser selecionar todos os registros de uma tabela onde o valor de uma coluna esteja entre 10 e 20, você pode usar o operador BETWEEN para realizar essa consulta.

    Rate this question:

  • 46. 

    Em um comando SELECT, qual cláusula poderá ser usada para excluir linhas, antes de agrupá-las?

    • A.

      INTO

    • B.

      WHERE

    • C.

      HAVING

    • D.

      ORDER BY

    Correct Answer
    B. WHERE
    Explanation
    The WHERE clause in a SELECT statement can be used to filter and exclude specific rows before grouping them. It allows you to specify conditions that the rows must meet in order to be included in the result set. By using the WHERE clause, you can effectively eliminate certain rows from the query result before applying any grouping operations.

    Rate this question:

  • 47. 

    Quais as duas cláusulas contém uma subquery? (Escolha duas opções).

    • A.

      WHERE

    • B.

      SELECT

    • C.

      HAVING

    • D.

      ORDER BY

    • E.

      GROUP BY

    Correct Answer(s)
    A. WHERE
    C. HAVING
    Explanation
    The correct answer is WHERE and HAVING. These two clauses in a SQL query allow for the inclusion of subqueries, which are queries nested within the main query. The WHERE clause is used to filter the rows returned by the query based on specified conditions, and it can include a subquery to further refine the results. The HAVING clause is used to filter the results of a GROUP BY query based on specified conditions, and it can also include a subquery to further filter the grouped data.

    Rate this question:

  • 48. 

    Quais valores serão mostrados na consulta abaixo?

    • A.

      Somente nomes de tabelas suas.

    • B.

      Somente nomes de objetos seus.

    • C.

      Somente nomes de todos os objetos que você possui acesso.

    • D.

      Somente nomes de todas tabelas que você possui acesso.

    Correct Answer
    D. Somente nomes de todas tabelas que você possui acesso.
    Explanation
    The correct answer is "Somente nomes de todas tabelas que você possui acesso." This means that the query will only display the names of all the tables that you have access to.

    Rate this question:

  • 49. 

    Na ordem de escrita de uma query, a cláusula order by deve vir depois de qual cláusula abaixo?

    • A.

      GROUP BY

    • B.

      WHERE

    • C.

      HAVING

    • D.

      FROM

    Correct Answer
    B. WHERE
    Explanation
    A cláusula ORDER BY deve vir depois da cláusula WHERE na ordem de escrita de uma query. A cláusula WHERE é usada para filtrar os registros que atendem a determinada condição, enquanto a cláusula ORDER BY é usada para ordenar os registros resultantes da consulta de acordo com uma determinada coluna. Portanto, primeiro é necessário filtrar os registros com a cláusula WHERE e, em seguida, ordená-los com a cláusula ORDER BY.

    Rate this question:

  • 50. 

    De acordo com as informações fornecidas abaixo escreva a instrução SQL que irá listar todos os CDs.

    Correct Answer
    select * from cds;
    Explanation
    The given answer is already the correct SQL statement to list all the CDs. It selects all columns from the table "cds", which will display all the records in the table.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Oct 09, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jul 19, 2016
    Quiz Created by
    Viniciusalcantar
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.