2.
Qual comando exclui a variável de ambiente 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.
3.
Qual dos comandos abaixo, irá exibir informações sobre as variáveis de ambiente no seu sistema ?
Explanation
The command "env" will display information about the environment variables in the system.
4.
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.
5.
Você está escrevendo um script e gostaria de testar o estado de saída deste processo. Qual das opções abaixo é verdadeira?
Correct Answer
A. 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.
6.
Qual comando que fecha uma estrutura de condição if ?
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.
7.
Qual instrução SQL que modifica dados já inseridos em uma tabela ?
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.
8.
Qual dos comandos abaixo irá incluir um registro na tabela CLIENTES ?
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.
9.
Na confecção de um novo script bash, qual deve ser o valor de sua primeira linha ?
Correct Answer
A. #!/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.
10.
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.
11.
Qual das opções abaixo pode ser utilizada para criar uma variável chamada LINUX com a atribuição do valor; lpi ?
Correct Answer
A. LINUX=lpi
Explanation
The correct answer is "LINUX=lpi" because it follows the correct syntax for creating a variable in Linux. In Linux, variables are typically written in uppercase letters, and the assignment of a value is done using the "=" sign. Therefore, "LINUX=lpi" is the correct way to create a variable called LINUX with the value "lpi".
12.
Qual comando remove um alias do shell já definido ?
Correct Answer
A. unalias
Explanation
The correct answer is "unalias". This command is used to remove an alias that has been previously defined in the shell.
13.
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.
14.
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
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".
15.
Quais são os dois arquivos no diretório home de um usuário que são usados para personalizar o ambiente bash?
Correct Answer
A. .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.
16.
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.
17.
Qual das opções abaixo pode ser utilizada para exibir o conteúdo da variável LINUX ?
Correct Answer
A. echo $LINUX
Explanation
The correct answer is "echo $LINUX" because the "echo" command is used to display the value of a variable in the terminal, and "$LINUX" refers to the variable named LINUX. By using "echo $LINUX", the content of the LINUX variable will be displayed on the screen.
18.
Qual comando impede que um arquivo seja sobrescrito pelo caracter de redirecionamento > do shell ?
Correct Answer
A. 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.
19.
Qual o valor da variável especial $! do shell BASH ?
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.
20.
Como eu posso verificar o sucesso ou não de um comando executado ?
Correct Answer
A. 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.
21.
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.
22.
Qual é o propósito do arquivo /etc/profile ?
Correct Answer
A. Ele contém variáveis de ambiente que são definidas durante o login dos usuários.
Explanation
O arquivo /etc/profile contém variáveis de ambiente que são definidas durante o login dos usuários. Isso significa que ele armazena informações importantes sobre o ambiente de trabalho do usuário, como caminhos de diretório, configurações de idioma e outras variáveis que afetam o comportamento do sistema. Essas variáveis são carregadas durante o processo de login e estão disponíveis para todos os usuários do sistema.
23.
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.
24.
Qual o valor da variável especial $$ do shell BASH ?
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.
25.
Qual das opções abaixo pode ser utilizada para tornar a variável LINUX acessível a partir de outros shell (Sub-sequente)?
Correct Answer
A. export LINUX
Explanation
The correct answer is "export LINUX". The "export" command is used to make a variable accessible to other shell processes. By using "export LINUX", the variable LINUX will be available to other shell processes.
26.
Qual arquivo do shell BASH é lido após um logout bem sucedido do sistema ?
Correct Answer
A. ~/.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.
27.
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á:
Correct Answer
A. 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".
28.
Qual das opções abaixo pode ser utilizada para remover uma variável chamada LINUX ?
Correct Answer
A. unset LINUX
Explanation
The correct answer is "unset LINUX". This option can be used to remove a variable called LINUX. The "unset" command is used in Unix-like operating systems to unset or remove a variable from the environment. By specifying the variable name (LINUX) after the "unset" command, the variable is removed from the environment.
29.
Qual das seguintes palavras é usada para restringir os registros que são retornados de uma consulta SQL SELECT com base em critérios fornecidos para os valores nos registros?
Explanation
The word "WHERE" is used in a SQL SELECT statement to restrict the records that are returned based on criteria provided for the values in the records. It allows you to specify conditions that the data must meet in order to be included in the result set.
30.
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 ?
Explanation
The correct answer is 0.
31.
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:
Correct Answer
A. 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.
32.
Qual arquivo será usado para configurar o shell bash interativo de um usuário?
Correct Answer
A. .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.
33.
Como um processo indica ao shell que encerrou com uma condição de erro?
Correct Answer
A. 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.
34.
Supondo que você deseje remover um alias chamado ipconfig. Escreva a linha de comando completa para realizar esta tarefa.
Correct Answer
unalias ipconfig
Explanation
The given command "unalias ipconfig" is used to remove an alias called "ipconfig". An alias is a shortcut or alternate name for a command. By running this command, the alias "ipconfig" will be removed and the original command or function it represents will be used instead.
35.
Escrevendo um shellscript você deseja verificar a existência do arquivo foobar e verificar se o mesmo é uma arquivo regular. Qual dos seguintes comandos de teste irá verificar a existência deste arquivo (foobar)?
Correct Answer
A. test -f foobar
Explanation
The correct answer is "test -f foobar". This command will check if the file "foobar" exists and if it is a regular file. The "-f" option is used to test if the given file is a regular file.
36.
A variável REPLY é utilizada por qual comando quando não definimos uma ?
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".
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.
38.
Qual dos seguintes comandos devem ser adicionados ao /etc/bash_profile a fim de mudar o idioma das mensagens para um programa internacionalizado para Português(pt)?
Correct Answer
A. export LC_MESSAGES="pt"
Explanation
The correct answer is "export LC_MESSAGES="pt"". This command sets the LC_MESSAGES environment variable to "pt", indicating that the language for program messages should be changed to Portuguese (pt). By exporting this variable in the /etc/bash_profile file, the change will be applied system-wide, ensuring that all programs using internationalization will display messages in Portuguese.
39.
Qual a diferença entre os comandos SET e ENV ?
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.
40.
Para qual tarefa você precisará usar o operador BETWEEN?
Correct Answer
A. 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.
41.
Qual das instruções abaixo é uma instrução SQL SELECT válida ?
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".
42.
Qual das seguintes alternativas são requisitos, a fim de executar um shell script como um comando regular a partir de qualquer lugar no sistema de arquivos? (Escolha três respostas corretas).
Correct Answer(s)
A. O arquivo de script deve ser encontrado no $PATH.
A. O script deve começar com uma shebang-line ( # ! ) Que aponta para o interpretador de comandos correto.
A. O arquivo de script deve ter permissão de execução.
Explanation
To execute a shell script as a regular command from anywhere in the file system, the following requirements must be met:
1) The script file must be located in the $PATH, which is the list of directories where the system looks for executable files.
2) The script must start with a shebang-line ( # ! ) that specifies the correct interpreter for the commands in the script.
3) The script file must have execute permission, allowing it to be run as a command.
43.
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?
Correct Answer
A. 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.
44.
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.
45.
De acordo com as informações fornecidas abaixo escreva a instrução SQL que irá listar o nome e o artista de todas músicas cadastradas.
Correct Answer
select Nome, Artista from Musicas;
Explanation
The given SQL query is correct and will retrieve the name and artist of all registered songs from the "Musicas" table. It uses the "select" statement to specify the columns to be included in the result, which are "Nome" (name) and "Artista" (artist). The "from" keyword is used to indicate the table from which the data should be retrieved, which is "Musicas" in this case.
46.
Qual das opções abaixo pode ser utilizada para listar apenas o primeiro valor da array FRUTAS?
Correct Answer
A. echo ${FRUTAS[0]}
Explanation
The correct answer is "echo ${FRUTAS[0]}". In Bash, arrays are zero-indexed, so the first element of the array FRUTAS can be accessed using the syntax ${FRUTAS[0]}. The options "echo $FRUTAS(1)" and "echo ${FRUTAS[1]}" would access the second element of the array, not the first.
47.
Considerando a consulta abaixo, o que é mostrado na coluna SALARY quando um valor NULL é retornado?
Explanation
Quando um valor NULL é retornado, o que é mostrado na coluna SALARY é o valor 0.
48.
Ao escrever um script, o que você precisa para criar um loop, recebendo uma lista de variáveis, onde as declarações a serem realizadas são encontradas entre as palavras-chave _______ e done.
Correct Answer
do
Explanation
To create a loop in a script, the keyword "do" is used to indicate the beginning of the loop block, and the keyword "done" is used to indicate the end of the loop block. The statements to be executed within the loop are written between these two keywords.
49.
Qual dos seguintes comandos lista todas as variáveis e funções definidas dentro do Bash ?
Explanation
The "set" command lists all the variables and functions defined within the Bash environment.