LPI 102 - Shells, Scripting And Data Management 2- 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: 72 | Attempts: 235

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

.


Questions and Answers
  • 1. 

    Qual é a diferença entre os comandos test -e path e test -f path ?

    • A.

      O test com opção -f para um arquivo regular. O test com opção -e para um arquivo vazio .

    • B.

      O test opção -f para um arquivo regular . O test com opção -e para um arquivo executável.

    • C.

      Eles são opções equivalentes com o mesmo comportamento.

    • D.

      Ambas as opções verifica a existência do caminho. A opção -f também confirma que ele é um arquivo regular.

    Correct Answer
    D. Ambas as opções verifica a existência do caminho. A opção -f também confirma que ele é um arquivo regular.
    Explanation
    The correct answer explains that both options (-e and -f) check for the existence of the path. However, the -f option also confirms that the path is a regular file.

    Rate this question:

  • 2. 

    Qual das seguintes consultas SQL conta o número de ocorrências para cada valor do campo ORDER_TYPE na tabela orders?

    • A.

      SELECT order_type, COUNT(*) FROM orders WHERE order_type=order_type;

    • B.

      SELECT AUTO_COUNT FROM orders COUNT order_type;

    • C.

      SELECT COUNT(*) FROM orders ORDER BY order_type;

    • D.

      SELECT order_type, COUNT(*) FROM orders GROUP BY order_type;

    • E.

      COUNT(SELECT order_type FROM orders);

    Correct Answer
    D. SELECT order_type, COUNT(*) FROM orders GROUP BY order_type;
    Explanation
    This query selects the order_type column and counts the number of occurrences for each value in the ORDER_TYPE field in the orders table. The GROUP BY clause is used to group the results by order_type, allowing the COUNT(*) function to count the occurrences for each distinct value.

    Rate this question:

  • 3. 

    Você percebe que executa uma série de comandos com certa frequência. Você deseja que esta série de comandos esteja disponível em seu login para executar no shell atual.

    • A.

      Criar um programa em shell

    • B.

      Criar uma função

    • C.

      Usar a seta para cima no BASH para localizar o comando

    • D.

      Usar a função ! embarcada do BASH para executar a última iteração do comando pelo menos nome

    Correct Answer
    B. Criar uma função
    Explanation
    The correct answer is to create a function. By creating a function, you can define a series of commands that can be easily executed whenever needed. This allows you to have the series of commands available in your login and execute them in the current shell.

    Rate this question:

  • 4. 

    Quais comandos exibe somente as funções disponíveis em um shell bash? (Selecione 2 respostas)

    • A.

      set

    • B.

      declare -f

    • C.

      function

    • D.

      typeset -f

    Correct Answer(s)
    B. declare -f
    D. typeset -f
    Explanation
    The "declare -f" and "typeset -f" commands are used to display only the available functions in a bash shell. The "set" command displays all shell variables and functions, not just the functions. The "function" command is not a valid command in bash. Therefore, the correct answers are "declare -f" and "typeset -f".

    Rate this question:

  • 5. 

    Qual dos seguintes é a melhor maneira para listar todas as variáveis de shell definidas?

    • A.

      env

    • B.

      env -a

    • C.

      echo $ENV

    • D.

      set

    Correct Answer
    D. set
    Explanation
    The "set" command is the best way to list all the shell variables defined. It displays all the variables, including environment variables, local variables, and shell functions. The "env" command lists only the environment variables, while "env -a" lists all variables, including environment variables and shell variables, but it is not the best option as it includes unnecessary information. The "echo $ENV" command only displays the value of the "ENV" environment variable, not all variables.

    Rate this question:

  • 6. 

    O que irá realizar o seguinte comando: "export PATH = $PATH: $APPLICATIONS"

    • A.

      Todos os usuários do NFS podem montar os aplicativos diretamente.

    • B.

      Atualiza o caminho com o diretório de aplicativos.

    • C.

      Atualiza o caminho com o valor de $APPLICATIONS.

    • D.

      Caminho de mudanças para o diretório de aplicativos.

    Correct Answer
    C. Atualiza o caminho com o valor de $APPLICATIONS.
    Explanation
    This command will update the PATH variable by adding the value of $APPLICATIONS to it. The $PATH represents the current value of the PATH variable, and the $APPLICATIONS represents the value of the APPLICATIONS variable. By using the command "export PATH=$PATH:$APPLICATIONS", the PATH variable will be updated to include the value of $APPLICATIONS, allowing the system to search for executables in that directory.

    Rate this question:

  • 7. 

    Que saída produzirá a seguinte sequência de comandos? echo '1 2 3 4 5 6' | while read a b c ; do echo resultado: $c $b $a; done

    • A.

      resultado: 6 5 4 3 2 1

    • B.

      resultado: 3 4 5 6 2 1

    • C.

      resultado: 1 2 3 4 5 6

    • D.

      resultado: 6 5 4

    • E.

      resultado: 3 2 1

    Correct Answer
    B. resultado: 3 4 5 6 2 1
    Explanation
    The given command "echo '1 2 3 4 5 6' | while read a b c ; do echo resultado: $c $b $a; done" reads the input "1 2 3 4 5 6" and assigns the values to variables a, b, and c. Then, it echoes the result in the format "resultado: $c $b $a". So, the output will be "resultado: 3 4 5 6 2 1".

    Rate this question:

  • 8. 

    Você está usando uma aplicação que você deseja que apareça na tela de outro computador. Qual variável de ambiente você deveria definir ou editar para conseguir isso?

    • A.

      DISPLAY

    • B.

      SCREEN

    • C.

      REMOTE_XWINDOW

    • D.

      REMOTE

    Correct Answer
    A. DISPLAY
    Explanation
    To display an application on another computer's screen, you need to set or edit the "DISPLAY" environment variable. This variable specifies the display server's address where the application should be shown. By setting the "DISPLAY" variable to the appropriate value (e.g., IP address or hostname of the remote computer), the application will be able to appear on the desired screen.

    Rate this question:

  • 9. 

    Para testar um script em shell chamado meuscript, a variável de ambiente FOOBAR deve ser removida temporariamente. Como isto pode ser feito?

    • A.

      unset -v FOOBAR

    • B.

      env -i FOOBAR meuscript

    • C.

      set -a FOOBAR=""

    • D.

      env -u FOOBAR meuscript

    Correct Answer
    D. env -u FOOBAR meuscript
    Explanation
    To temporarily remove the environment variable FOOBAR in order to test a shell script called meuscript, the command "env -u FOOBAR meuscript" can be used. This command unsets the value of the FOOBAR variable for the duration of executing the meuscript script.

    Rate this question:

  • 10. 

    Qual o benefício que proporciona um alias?

    • A.

      Ele esconde o comando que você está executando de outros.

    • B.

      Ele fornece pesquisas mais rápidas para comandos.

    • C.

      Ele evita ter que digitar comandos longos.

    • D.

      Ele cria uma cópia local de um arquivo de outro diretório.

    Correct Answer
    C. Ele evita ter que digitar comandos longos.
    Explanation
    An alias provides the benefit of avoiding the need to type long commands. By creating a shorter alias for a command, users can save time and effort by simply using the alias instead of typing out the entire command. This can be particularly useful for frequently used or complex commands, as it allows for quicker and more efficient execution.

    Rate this question:

  • 11. 

    Um usuário reclamou que programas iniciados a partir de HOME não define a utilização de seu editor de texto favorito. Qual dos seguintes arquivos você deve editar para alterar isso?

    • A.

      .bash_rc

    • B.

      ~/bash.conf

    • C.

      .bashrc

    • D.

      .editor

    Correct Answer
    C. .bashrc
    Explanation
    The correct answer is ".bashrc". This file is a script that is executed whenever a new interactive shell is started. By editing this file, the user can customize their shell environment, including setting the default editor for programs started from the home directory.

    Rate this question:

  • 12. 

    Que saída produzirá o seguinte comando seq 10?

    • A.

      Um fluxo contínuo de números a aumentar em incrementos de 10 até ser interrompido.

    • B.

      Os números de 1 a 10 com um número por linha.

    • C.

      O número 10 para a saída padrão.

    • D.

      Os números de 0 a 9 com um número por linha.

    Correct Answer
    B. Os números de 1 a 10 com um número por linha.
    Explanation
    The command "seq 10" will produce the numbers from 1 to 10, with each number on a separate line.

    Rate this question:

  • 13. 

    Qual será o resultado produzido pelo seguinte comando: "seq 1 5 20" ?

    • A.

      1 6 1 1 1 6

    • B.

      1 5 10 15

    • C.

      1 2 3 4

    • D.

      2 3 4 5

    • E.

      5 10 15 20

    Correct Answer
    A. 1 6 1 1 1 6
  • 14. 

    Quando nós logamos em um sistema linux, o shell bash é iniciado com um shell de login. Este shell procura por quatro arquivos de inicialização para processar seus comandos na seguinte orden:

    • A.

      /etc/profile --> ~/.bash_profile --> ~/.bash_login --> ~/.profile

    • B.

      ~/.profile --> /etc/profile ~/.bash_login --> ~/.bash_logout

    • C.

      ~/etc/profile --> ~/.bash_login --> ~/.bash_profile --> ~/.bash_logout

    • D.

      ~/etc/profile --> ~/.bashrc --> ~/.bash_login --> ~/.bash_logout

    Correct Answer
    A. /etc/profile --> ~/.bash_profile --> ~/.bash_login --> ~/.profile
    Explanation
    When we log in to a Linux system, the bash shell is started with a login shell. This shell looks for four initialization files to process its commands in the following order: /etc/profile, ~/.bash_profile, ~/.bash_login, and ~/.profile. The answer provided lists the correct order of these files for the shell to process.

    Rate this question:

  • 15. 

    Quando o bash é iniciado interativamente, ele não processa o arquivo /etc/profile, em vez disso ele tenta executar o arquivo _________ no diretório atual do usuário.

    Correct Answer
    .bashrc
    Explanation
    When the bash is started interactively, it does not process the file /etc/profile. Instead, it tries to execute the file ".bashrc" in the current directory of the user.

    Rate this question:

  • 16. 

    Ao encerrar a sessão do shell, o bash executa as instruções contidas no arquivo ~/.bash_logout, se o mesmo existir.

    • A.

      Verdadeiro

    • B.

      Falso

    Correct Answer
    A. Verdadeiro
    Explanation
    When closing the shell, the bash executes the instructions contained in the file ~/.bash_logout, if it exists.

    Rate this question:

  • 17. 

    Quando o bash é inicializado em uma sessão como shell interativo, mas não se tratando como uma sessão X), o bash busca instruções dos arquivos ______ e ______ se os mesmos existirem.

    • A.

      ~/bash_login e ~/bash_logout

    • B.

      /etc/profile e ~/.bashrc

    • C.

      /etc/bash.bashrc e ~/.bashrc

    • D.

      N.D.A

    Correct Answer
    C. /etc/bash.bashrc e ~/.bashrc
    Explanation
    When bash is initialized in an interactive shell session (excluding an X session), it looks for instructions from the files /etc/bash.bashrc and ~/.bashrc if they exist. The /etc/bash.bashrc file contains system-wide bash initialization instructions, while the ~/.bashrc file contains user-specific bash initialization instructions. By checking these files, bash can execute any commands or configurations specified in them to set up the shell environment correctly for the user.

    Rate this question:

  • 18. 

    Bash, o shell padrão, usa o script de inicialização _________ para shells "interativos", e o _________ para shells de "login".

    • A.

      /etc/profile e /etc/bash.bashrc

    • B.

      /etc/bash.bashrc e /etc/profile

    • C.

      /etc/profile e ~/.bash_login

    • D.

      N.D.A

    Correct Answer
    B. /etc/bash.bashrc e /etc/profile
    Explanation
    The correct answer is "/etc/bash.bashrc e /etc/profile". In Bash, the "/etc/bash.bashrc" file is used for "interactive" shells, while the "/etc/profile" file is used for "login" shells. These files contain initialization scripts that are executed when a shell is started, providing settings and configurations for the shell environment.

    Rate this question:

  • 19. 

    Para o bash, é útil ativar “preenchimento automático” no arquivo _________ (Simplesmente descomentando algumas linhas).

    Correct Answer
    /etc/bash.bashrc
    Explanation
    The correct answer is "/etc/bash.bashrc". In the given question, it is mentioned that enabling "auto-completion" in the bash is useful by uncommenting some lines in the file "/etc/bash.bashrc". This file is a system-wide configuration file for bash, and uncommenting the necessary lines in this file allows the user to activate the auto-completion feature.

    Rate this question:

  • 20. 

    Os usuários geralmente querem configurar seu login e shell interativo de maneira similar. Para fazer isso, eles escolhem interpretar (ou “fonte”) o contéudo de ~/.bashrc no arquivo ~/.bash_profile. É possível fazer a mesma coisa com arquivos comuns a todos os usuários (referenciando _________ a partir de _________).

    • A.

      A afirmativa está equivocada.

    • B.

      /etc/profile a partir de ~/.bashrc

    • C.

      /etc/bash.bashrc a partir de /etc/profile

    • D.

      N.D.A

    Correct Answer
    C. /etc/bash.bashrc a partir de /etc/profile
    Explanation
    Os usuários geralmente querem configurar seu login e shell interativo de maneira similar. Para fazer isso, eles escolhem interpretar (ou "fonte") o conteúdo de ~/.bashrc no arquivo ~/.bash_profile. É possível fazer a mesma coisa com arquivos comuns a todos os usuários referenciando /etc/bash.bashrc a partir de /etc/profile.

    Rate this question:

  • 21. 

    O que a seguinte linha de comando irá retornar: echo "eu sou o usuário: $USER" ?

    • A.

      Irá retornar o seguite texto: eu sou o usuário: root

    • B.

      Irá retornar um erro de sintaxe.

    • C.

      Irá retornar o texto: "eu sou o usuário:" seguido do nome do "usuário atual"

    • D.

      N.D.A

    Correct Answer
    C. Irá retornar o texto: "eu sou o usuário:" seguido do nome do "usuário atual"
    Explanation
    The given correct answer states that the command "echo "eu sou o usuário: $USER"" will return the text "eu sou o usuário:" followed by the name of the current user. This is because "$USER" is a special variable that holds the name of the current user in Unix-like operating systems. Therefore, when the command is executed, it will replace "$USER" with the actual username and display the complete sentence.

    Rate this question:

  • 22. 

    Estou criando um shell script e necessito redirecionar a saída de um comando à uma variável. Qual das alternativas é verdadeira para realizar tal procedimento?

    • A.

      O comando deve está entre chaves. Ex: PROCESSOS_ATUAIS={ps aux}

    • B.

      O comando deve está entre colchetes. Ex: PROCESSOS_ATUAIS=[ps aux]

    • C.

      O comando deve está entre aspas simples. Ex: PROCESSOS_ATUAIS='ps aux'

    • D.

      O comando deve está entre crases. Ex: PROCESSOS_ATUAIS=`ps aux`

    • E.

      N.D.A

    Correct Answer
    D. O comando deve está entre crases. Ex: PROCESSOS_ATUAIS=`ps aux`
    Explanation
    The correct answer is "O comando deve está entre crases. Ex: PROCESSOS_ATUAIS=`ps aux`". This is because using backticks or crases around a command in shell scripting allows the output of that command to be assigned to a variable. In this case, the command "ps aux" will be executed and the output will be stored in the variable PROCESSOS_ATUAIS.

    Rate this question:

  • 23. 

    Estou escrevendo um shell script onde necessito realizar uma operação matemática e atribuir seu resultado à uma variável. Qual das alternativas corresponde a sintaxe correta desta tarefa? (Selecione 2 respostas).

    • A.

      RESULT=$[2+6]

    • B.

      RESULT=&[2+6]

    • C.

      RESULT=$((2+6))

    • D.

      RESULT=${2+6}

    Correct Answer(s)
    A. RESULT=$[2+6]
    C. RESULT=$((2+6))
    Explanation
    The correct answer is "RESULT=$[2+6], RESULT=$((2+6))". The first option "RESULT=$[2+6]" uses the square brackets syntax to perform the mathematical operation and assign the result to the variable RESULT. The second option "RESULT=$((2+6))" uses double parentheses to perform the mathematical operation and assign the result to the variable RESULT.

    Rate this question:

  • 24. 

    Este shell script irá retornar qual dos valores abaixo?

    • A.

      O resultado é 30

    • B.

      30

    • C.

      O resultado é: 30

    • D.

      Retornará um erro.

    Correct Answer
    C. O resultado é: 30
    Explanation
    The given shell script will return the value "O resultado é: 30".

    Rate this question:

  • 25. 

    Existe um problema ao se realizar operações matemáticas com o shell bash: Seus operadores só suportam aritmética de números inteiros. Segue um exemplo de um shell script que realiza uma operação de divisão, onde o valor correto a ser retornado seria 4,5, porém o bash irá retonar o valor de número 4. Uma alternativa a ser utilizada para tal problema seria utilizar a calculadora interna do bash (bc).

    • A.

      Verdadeiro

    • B.

      Falso

    Correct Answer
    A. Verdadeiro
    Explanation
    The given statement is true. The explanation states that there is a problem when performing mathematical operations with the bash shell because its operators only support arithmetic with integers. It provides an example of a shell script that performs a division operation, where the correct value to be returned would be 4.5, but the bash shell will return the integer value of 4 instead. The explanation suggests using the internal calculator of bash (bc) as an alternative solution to this problem.

    Rate this question:

  • 26. 

    Quando o comando "echo $?" retorna a saída igual a 1, qual das seguintes afirmações é verdadeira ?

    • A.

      É o ID do processo do comando echo.

    • B.

      É o ID do processo do shell atual.

    • C.

      É o valor de saída do comando executado imediatamente antes do echo.

    • D.

      É o valor de saída do comando de echo.

    Correct Answer
    C. É o valor de saída do comando executado imediatamente antes do echo.
    Explanation
    When the command "echo $?" returns an output equal to 1, it indicates that the command executed immediately before the echo command had an exit status of 1. The exit status is a value returned by a command to the shell, indicating whether the command executed successfully or encountered an error. Therefore, in this case, the correct answer is that it is the exit value of the command executed immediately before the echo command.

    Rate this question:

  • 27. 

    Qual dos seguintes arquivos, quando existentes, afetam o comportamento do shell Bash ? (Escolha duas respostas corretas.)

    • A.

      ~/.bashconf

    • B.

      ~/.bashrc

    • C.

      ~/.bashdefaults

    • D.

      ~/.bash_etc

    • E.

      ~/.bash_profile

    Correct Answer(s)
    B. ~/.bashrc
    E. ~/.bash_profile
    Explanation
    The correct answer is ~/.bashrc and ~/.bash_profile. These two files affect the behavior of the Bash shell. The ~/.bashrc file contains the individual user configurations for the Bash shell, such as aliases, functions, and settings. It is executed for each new interactive shell session. On the other hand, the ~/.bash_profile file is executed only for login shells and is commonly used to set environment variables and execute commands that should be run once when the user logs in.

    Rate this question:

  • 28. 

    Depois de emitir: "function myfunction { echo $1 $2; }" em seu bash. A saída no stdout ao executar: "myfunction A B C" será:

    • A.

      A B

    • B.

      A B C

    • C.

      A C

    • D.

      B C

    • E.

      C B A

    Correct Answer
    A. A B
    Explanation
    After defining the function "myfunction { echo $1 $2; }" in the bash, the output on stdout when executing "myfunction A B C" will be "A B". This is because the function is defined to only echo the first two arguments passed to it, which in this case are "A" and "B". The third argument "C" is not included in the output.

    Rate this question:

  • 29. 

    Qual dos seguintes comandos atribui a saída do comando date à variável shell chamada mydate?

    • A.

      mydate="$(date)"

    • B.

      mydate="exec date"

    • C.

      mydate="$((date))"

    • D.

      mydate="date"

    • E.

      mydate="${date}"

    Correct Answer
    A. mydate="$(date)"
    Explanation
    The correct answer is mydate="$(date)". This command assigns the output of the "date" command to the shell variable called "mydate". The "$()" syntax is used to capture the output of a command and assign it to a variable.

    Rate this question:

  • 30. 

    Qual das seguintes alternativas são operadores usados ​​para comparações pelo comando teste? (Escolha duas correta respostas).

    • A.

      equals

    • B.

      =

    • C.

      -is

    • D.

      -eq

    • E.

      null

    Correct Answer(s)
    B. =
    D. -eq
    Explanation
    The correct answer is = and -eq. These are operators used in the test command for comparisons. The = operator is used for string comparisons, while the -eq operator is used for numeric comparisons.

    Rate this question:

  • 31. 

    Qual dos seguintes comandos cria uma função Bash que gera a soma de dois números?

    • A.

      function sumitup { echo $(($1 + $2)) ; }

    • B.

      command sumitup { echo $(($1 + $2)) ; }

    • C.

      function sumitup { echo $1 + $2 ; }

    • D.

      method sumitup { echo $1 + $2 ; }

    • E.

      command sumitup { echo $1 + $2 ; }

    Correct Answer
    A. function sumitup { echo $(($1 + $2)) ; }
    Explanation
    The correct answer is "function sumitup { echo $(($1 + $2)) ; }". This is the correct command to create a Bash function that generates the sum of two numbers. The function is named "sumitup" and it uses the echo command to output the result of the addition of the two input numbers, which are represented by $1 and $2. The $(()) syntax is used to perform the arithmetic addition operation.

    Rate this question:

  • 32. 

    Qual diretório /etc é usado para manter uma cópia de amostra de arquivos e diretórios para quando um novo usuário tem um diretório HOME criado ? (Por favor, forneça o caminho completo).

    Correct Answer
    /etc/skel
    /etc/skel/
    Explanation
    The correct answer is /etc/skel or /etc/skel/. The directory /etc/skel is used to keep a sample copy of files and directories that will be automatically copied to a new user's home directory when it is created. This allows the new user to have a pre-defined set of files and directories already in place.

    Rate this question:

  • 33. 

    Qual palavra está faltando a seguinte instrução SQL? __________ count(*) from tablename;

    Correct Answer
    select
    SELECT
    Explanation
    The given SQL instruction is missing the keyword "SELECT" before the count(*) function. In SQL, the SELECT keyword is used to retrieve data from a database table, and it should be included before the count(*) function to specify which columns or data we want to retrieve.

    Rate this question:

  • 34. 

    Qual palavra está faltando a seguinte instrução SQL? update tablename ____ fieldname='value' where id=909; (Por favor, especifique a palavra que falta utilizando apenas letras minúsculas).

    Correct Answer
    set
    Explanation
    The missing word in the given SQL instruction is "set". In an SQL update statement, the "set" keyword is used to specify which column or field should be updated with a new value. In this case, the missing word "set" indicates that the "fieldname" should be updated with the value 'value' where the id is equal to 909.

    Rate this question:

  • 35. 

    Qual palavra está faltando a seguinte instrução SQL? insert into tablename ________(909, 'text');

    Correct Answer
    values
  • 36. 

    Por padrão, o conteúdo de qual diretório será copiado para o diretório home de um novo usuário quando a conta é criada passando a opção -m para o comando useradd? (Especifique o caminho completo para o diretório).

    Correct Answer
    /etc/skel
    /etc/skel/
    Explanation
    The correct answer is /etc/skel or /etc/skel/. When creating a new user account using the useradd command with the -m option, the content of the /etc/skel directory will be copied to the new user's home directory. The /etc/skel directory contains default files and configurations that will be available to the new user upon account creation.

    Rate this question:

  • 37. 

    Que palavra irá completar uma condicional "se" no bash, como o seguinte: if [ -x "$file" ]; then echo $file________(Por favor, forneça apenas a palavra em falta).

    Correct Answer
    fi
    Explanation
    The missing word to complete the conditional statement in bash is "fi". In bash scripting, "fi" is used to close the "if" statement. It indicates the end of the block of code that should be executed if the condition specified in the "if" statement is true.

    Rate this question:

  • 38. 

    Que palavra-chave está em falta a partir deste exemplo de código de um shell script?

    • A.

      for

    • B.

      while

    • C.

      loop

    • D.

      until

    Correct Answer
    A. for
    Explanation
    The missing keyword in this shell script example is "for". It is used to create a loop that will iterate a specific number of times, based on a given condition or range of values. The "for" loop is commonly used when you know the exact number of iterations you want to perform.

    Rate this question:

  • 39. 

    Os colchetes “[ ]” utilizados após o comando if, poderiam ser substituídos pelo comando _______.

    Correct Answer
    test
    Explanation
    The brackets "[ ]" used after the if statement can be replaced by the command "test". This means that the condition being tested in the if statement is being evaluated using the "test" command.

    Rate this question:

  • 40. 

    Observe o script abaixo e assinale a alternativa que irá apresentar uma saída similar a do script.

    • A.

      ls -l *mp3

    • B.

      mv *.mp3 *.txt

    • C.

      ls *.mp3

    • D.

      mv *.mp3; echo all

    • E.

      cp *.mp3 *.txt

    Correct Answer
    C. ls *.mp3
    Explanation
    The correct answer is "ls *.mp3" because this command will list all files in the current directory that have the .mp3 extension, which is the same output as the given script.

    Rate this question:

  • 41. 

    A saída do comando 'seq 0 7 30' é:

    • A.

      0 8 15 22 29

    • B.

      1 7 8 15 22 29

    • C.

      0 6 13 20 27

    • D.

      0 7 14 21 28

    Correct Answer
    D. 0 7 14 21 28
  • 42. 

    Analise o comando abaixo e marque a opção correta:

    • A.

      Podemos afirmar que a tabela clientes possui apenas os campos id, nome, cpf e data_nasc.

    • B.

      Podemos afirmar que a ordem dos campos na tabela clientes é exatamente como está apresentada no comando acima.

    • C.

      A ordem dos campos não é importante ao realizar uma inserção na tabela, no entanto que a ordem dos valores seja a mesma que a ordem dos campos.

    • D.

      A ordem dos valores e a ordem dos campos não precisam estar relacionados.

    Correct Answer
    C. A ordem dos campos não é importante ao realizar uma inserção na tabela, no entanto que a ordem dos valores seja a mesma que a ordem dos campos.
    Explanation
    The correct answer states that the order of the fields is not important when inserting data into the table, as long as the order of the values matches the order of the fields. This means that when inserting data, the values must be provided in the same order as the fields in the table, but the fields themselves can be in any order.

    Rate this question:

  • 43. 

    Visualize o seguinte comando SQL e marque as respostas corretas:

    • A.

      A saída apresentará apenas o campo id.

    • B.

      A saída apresentará todos os campos da tabela onde o id for igual a 13.

    • C.

      Na saída será mostrada a quantidade de ocorrências encontradas.

    • D.

      A saída será mostrada com apenas os campos de nome e id, que são as chaves primárias da tabela.

    • E.

      A saída será mostrada com apenas os campos de nome e id, que são as chaves estrangeiras da tabela.

    Correct Answer(s)
    B. A saída apresentará todos os campos da tabela onde o id for igual a 13.
    C. Na saída será mostrada a quantidade de ocorrências encontradas.
    Explanation
    The correct answer states that the output will display all the fields of the table where the id is equal to 13. Additionally, the output will also show the number of occurrences found.

    Rate this question:

  • 44. 

    O que faz o comando abaixo?

    • A.

      Mostra todas as colunas das tabelas clientes e compras, onde o valor correspondente ao id da tabela compras seja igual ao id_cliente da tabela clientes.

    • B.

      Mostra as colunas clientes e compras, onde o valor correspondente ao id da tabela cliente seja igual ao id_cliente da tabela compras.

    • C.

      Mostra todas as colunas das tabelas clientes e compras, onde o valor correspondente ao id da tabela cliente seja igual ao id_cliente da tabela compras.

    • D.

      Mostra as colunas clientes e compras, onde o valor correspondente ao id da tabela compras seja igual ao id_cliente da tabela clientes.

    • E.

      Mostra todas as colunas das tabelas clientes e compras, onde o valor correspondente ao id da tabela cliente seja igual a todas as colunas da tabela compras.

    Correct Answer
    C. Mostra todas as colunas das tabelas clientes e compras, onde o valor correspondente ao id da tabela cliente seja igual ao id_cliente da tabela compras.
    Explanation
    The given correct answer states that the command shows all columns from the tables "clientes" and "compras" where the value corresponding to the "id" column in the "clientes" table is equal to the "id_cliente" column in the "compras" table. This means that the command will display the data that matches the relationship between the two tables based on the corresponding values in the specified columns.

    Rate this question:

  • 45. 

    Você emitiu o comando: export CFLAGS="-march-i586". Você pode remover esta variável de ambiente usando o comando: ________CFLAGS

    Correct Answer
    unset
    Explanation
    The correct answer is "unset". This command is used to remove or unset a variable from the environment. In this case, the variable "CFLAGS" is being removed from the environment by using the "unset" command.

    Rate this question:

  • 46. 

    Onde estão localizados os aliases de linha de comando definidos para um usuário? Digite o caminho completo e o nome do arquivo para o usuário atualmente conectado.

    Correct Answer
    ~/.bashrc
    Explanation
    The aliases for command line defined for a user are located in the file named ".bashrc" in the user's home directory.

    Rate this question:

  • 47. 

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

    Correct Answer
    .bash_profile
    Explanation
    The correct answer is ".bash_profile". This file is typically located in the user's home directory and is used to set up the environment for Bash, the default shell in many Unix-like operating systems. By editing this file, the user can add or modify the PATH variable, which is responsible for determining the directories where the shell looks for executable files.

    Rate this question:

  • 48. 

    Qual palavra está faltando a seguinte instrução SQL ? select count(*) _________ table name;

    Correct Answer
    from
    Explanation
    The missing word in the SQL instruction is "from". The "from" keyword is used to specify the table from which the data is being selected in the SQL query.

    Rate this question:

  • 49. 

    Em qual arquivo você altera as variáveis padrão do shell para todos os usuários?

    • A.

      /etc/profile

    • B.

      ~/.bash_profile

    • C.

      /etc/bashrc

    • D.

      /etc/skel/.bashrc

    • E.

      /etc/skel/.bash_profile

    Correct Answer
    C. /etc/bashrc
    Explanation
    The correct answer is /etc/bashrc. This file is used to set the default variables for the shell for all users on the system. It is a system-wide configuration file that is executed every time a user starts a new shell session. Any changes made to this file will affect all users on the system.

    Rate this question:

  • 50. 

    Você deseja executar o comando ls, mas parece ser alias. Qual é a maneira mais fácil de executar o ls original ?

    Correct Answer
    \ls
    Explanation
    The given answer suggests using the backslash (\) before the command "ls" to execute the original version of the command. In this case, the backslash will bypass any alias that may have been set for the "ls" command and directly execute the original command.

    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
  • Mar 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • May 23, 2017
    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.