WorksheetsPage 1
Total questions: 133
Worksheet time: 1hrs 7mins
A principal função da estrutura if em PHP é:
Repetir um bloco de código em um loop
Armazenar dados permanentemente no servidor
Executar um bloco de código apenas se uma condição for verdadeira
Definir a estrutura básica de uma página HTML
Qual palavra-chave é usada para que o código execute um bloco alternativo quando a condição if é avaliada como falsa?
then
switch
elseif
else
No exercício de classificação de idade dos atletas (Lição 1/4), qual classificação é dada para idades maiores ou iguais a 18?
Equipe Adolescente
Equipe Criança
Equipe Bebê
Equipe Adulto
Para verificar se uma variável $idade é maior ou igual a 18 em PHP, qual operador de comparação dentro do if está correto?
==
>
!=
>=
Se a variável numeroequals10,whatwillbedisplayedbythecode:<?phpif( numero > 10) { echo "Maior"; } else { echo "Não é Maior"; } ?>
Maior
Não é Maior
Erro de sintaxe
Nada
Se a condição if for verdadeira, o código dentro de qual par de símbolos será executado em PHP?
Aspas ""
Parênteses ()
Colchetes []
Chaves {}
O que a Lição 1 (de 4) enfatiza como essencial para aprender programação?
Memorizar todas as funções do PHP
Fazer apenas design visual com CSS
Ignorar a prática e focar apenas na teoria
Programar requer sequenciamento lógico, treinamento e muita prática
Se a variável $idade = 10, qual será a classificação do atleta de acordo com a lógica da Lição 1/4 (Equipe Infantil é para idades de 6 a 12)?
Equipe Adulto
Equipe Adolescente
Equipe Bebê
Equipe Infantil
Qual instrução está correta para exibir a mensagem "Condição OK" na tela usando PHP?
print("Condição OK")
write("Condição OK")
console.log("Condição OK")
echo "Condição OK"
A expressão dentro do if (a condição) geralmente retorna qual tipo de dado, determinando se o bloco será executado?
String (texto)
Inteiro (número)
Float (decimal)
Booleano (Verdadeiro/Falso)
Que termo é usado para o servidor simulado em seu computador, acessado via navegador como http://localhost/... ?
Servidor Apache
Gerenciador XAMPP
C:\xampp
Localhost
Em PHP, qual estrutura de controle condicional permite que o código seja executado quando a condição é falsa?
else
while
if
for
Para a condição ($numero < 5), qual valor fará com que o bloco if seja executado?
5
10
5,5
4
Onde os arquivos .php (como if_1.php da Lição 1) devem ser salvos na estrutura de pastas do XAMPP?
C:\xampp\mysql\data
C:\xampp\php
C:\xampp\temp
C:\xampp\htdocs
O que significa o termo "estrutura de controle condicional"?
Uma forma de definir o estilo CSS de uma página
Um bloco de código que roda infinitamente
Um sistema para conectar a um banco de dados
Um mecanismo para decidir qual bloco de código executar com base em uma condição
O que significa a sigla PHP?
Página Pessoal Inicial
Páginas de Hipertexto de Programação
Plataforma Pública de Hospedagem
Pré-processador de Hipertexto
Onde o código PHP é executado principalmente?
No navegador do cliente (front end)
Em um banco de dados MySQL
No servidor (back end)
Em um arquivo CSS
Qual é a principal função do PHP no desenvolvimento web?
Estilizar páginas web (CSS)
Criar estrutura estática (HTML)
Criar páginas dinâmicas que interagem com bancos de dados
Adicionar interatividade do lado do cliente (JavaScript)
Which opening and closing tags are used to delimit PHP code?
`
Qual caractere deve ser usado para declarar uma variável em PHP?
#
&
@
$ (sinal de cifrão)
Qual comando é mais comum em PHP para imprimir ou exibir saída em uma página da web?
print()
display()
write()
echo
O que o ponto e vírgula (;) representa no final de uma instrução em PHP?
O início de um novo bloco de código
A separação entre o código HTML e PHP
Uma quebra de linha em HTML
O fim de uma instrução ou comando
Qual tipo de dado do PHP representa um valor com casas decimais (por exemplo, 3.14)?
Inteiros
Strings
Booleano
Floats
Qual tipo de dado representa um valor verdadeiro ou falso em PHP?
Floats
Inteiros
Strings
Booleano
O código PHP geralmente é incorporado em qual outra linguagem?
JavaScript
SQL
CSS
HTML
Quem foi o criador inicial do PHP em 1993, com a primeira versão lançada em 1995?
Linus Torvalds
Bill Gates
James Gosling
Rasmus Lerdorf
Para a variável $cidade = 'São Paulo'; qual é o tipo de dado?
Inteiro
Float
Booleano
String
Qual pacote de software gratuito que inclui Apache, MySQL e PHP é recomendado para simular um servidor web local?
WAMP
LAMP
MAMP
XAMPP
Qual tipo de dado representaria a idade de uma pessoa (por exemplo, 25) em PHP?
Floats
Strings
Boolean
Inteiros
O que significa o termo "páginas dinâmicas" em PHP?
Páginas com muitas imagens em movimento
Páginas que não mudam
Páginas que usam apenas CSS
Páginas que podem interagir com bancos de dados e responder de forma diferente dependendo do usuário ou do conteúdo
Em PHP, qual operador é usado para multiplicação?
+
-
*
Na expressão matemática 2+2∗4 , qual é o resultado ao aplicar a precedência de operadores (multiplicação antes da adição)?
16
4
10
8
Em PHP, qual operador é usado para concatenar strings e variáveis?
&
+
#
Ponto (.)
Dado e , qual código exibirá Ana Silva com um espaço entre o primeiro e o último nome?
echo nome+ sobrenome;
echo nome: sobrenome;
echo nome: sobrenome;
echo sobrenome;
Qual operador é usado para divisão em PHP?
\
//
%
/
Se $numero = 7, qual expressão PHP calcula o triplo desse valor?
triplo= numero + 3;
triplo= numero - 3;
triplo= numero / 3;
triplo= numero * 3;
Em PHP, qual operador realiza a adição?
x
**
-
+
O que a Lição 3 enfatiza sobre a precedência das operações em cálculos matemáticos no PHP?
Todas as operações têm a mesma prioridade.
A adição sempre tem prioridade sobre a multiplicação.
O PHP ignora as regras de precedência.
Multiplicação e divisão têm prioridade sobre adição e subtração.
Se var1=10e var2 = 5, qual é o resultado de var1− var2?
15
50
10
5
Qual é a saída de echo "O valor total é " . 50 . " reais"; ?
O valor total é 50+reais
Erro de sintaxe
O valor total é 50
O valor total é 50 reais
Qual é o principal benefício da concatenação em PHP?
Aumentar a segurança do código.
Reduzir o uso de memória.
Realizar cálculos complexos.
Exibir informações dinâmicas de forma legível e formatada na tela.
Qual operador calcula o resto da divisão entre dois números (módulo)?
/
*
#
%
Se a=20e b = 3, qual é o resultado de a b?
6,66
20
6
2
Ao concatenar uma variável numérica com uma string, o que o PHP faz?
Lança um erro de tipo.
Converte a string em um número.
Ignora o número.
Converte temporariamente o número em uma string para realizar a concatenação.
XAMPP é um pacote de software gratuito que inclui quais recursos essenciais para executar PHP?
Windows, Apache, MySQL, Photoshop
Linux, Apache, MySQL, Perl
Apache, MySQL, PHP, Perl
Apache, PostgreSQL, Python, Java
Qual é o propósito do elseif em um bloco condicional?
Executar o código após o bloco else.
Repetir o código em um loop.
Verificar uma segunda ou adicional condição se o primeiro if for falso.
Inserir dados em um banco de dados.
Qual é a principal vantagem de usar if/elseif/else em vez de várias instruções if separadas?
É mais rápido digitar o código.
elseif só aceita inteiros.
Ele avalia condições mutuamente exclusivas de forma mais clara e evita verificações redundantes.
Ele otimiza automaticamente o desempenho sem intervenção do desenvolvedor.
No exemplo da Lição 4, para verificar se um número é positivo, qual condição lógica deve ser usada?
$numero <= 0
$numero == 0
$numero < 0
$numero > 0
Se o valor da variável numeroeˊ−5,qualblocodecoˊdigoseraˊexecutadoquandoocoˊdigoutilizaif( numero > 0), elseif ($numero == 0), e else?
O bloco if.
O bloco elseif.
O bloco else (Negativo).
Nenhum bloco.
A estrutura de controle condicional (if/else) é definida como um mecanismo que executa um bloco de código apenas se uma condição for:
Verdadeira.
Igual a zero.
Não nula.
Falsa.
Qual é a sintaxe correta para verificar uma condição intermediária em PHP?
else if ($condicao)
else ($condicao)
elseif ($condicao)
else ife ($condicao)
In the athlete age classification exercise, which age range corresponds to the classification "Teen Team"?
Age greater than or equal to 18 years.
Age less than 6 years.
Age 6 to 12 years.
Age 13 to 17 years.
If an athlete is 5 years old, which classification will they receive according to the conditions from Lesson 4?
Child Team
Teen Team
Adult Team
Baby Team (under 6 years)
Which comparison operator means "not equal to" in PHP?
==
>=
<=
!= or <>
If a=10and b = 10, what is the result of the expression a== b?
False
10
True
20
What happens if the variable $numero is 0 in the Positive/Negative/Zero test that uses elseif?
The if block ($numero > 0) runs.
The else block runs.
The elseif block ($numero == 0) runs.
It produces an error.
Including a PHP code file inside another file is often done using which command?
echo
if
else
include or require
In the athlete classification exercise, if the age is 12, what will the classification be?
Adult Team
Teen Team
Baby Team
Child Team (6 to 12 years)
What does the term "good programming practices," mentioned in Lesson 4, suggest?
That it is not necessary to save the examples.
That HTML code is more important than PHP.
That you must memorize the code.
Follow the examples, practice, and take notes.
What does the condition if ( idade < 18) mean in logical terms?
Age is less than 12 OR greater than 18.
Age is less than or equal to 12.
Age is 12 or 18.
Age is between 13 and 17 (greater than 12 and less than 18).
In which form submission method are the data transferred more securely (not appearing in the URL)?
GET
SESSION
COOKIE
POST
What is the name of the PHP superglobal array used to receive data from a form submitted via the POST method?
$_GET
$_SERVER
$_SESSION
$_POST
In the flow of Lesson 5, which PHP page is responsible for receiving the data and performing the bonus calculation using if/else logic?
form3.php
index.html
conexao.php
resultado.php
What was the minimum sales value (condition) for the employee to receive a bonus of R$ 500.00?
R$ 5,000.00
R$ 9,999.99
R$ 15,000.00
R$ 10,000.00
If sales are set as vendas=9500,whatdoesthelogicif( vendas >= 10000) do?
The employee will receive the bonus of R$ 500.00.
The $vendas variable will be updated.
An error message will be displayed.
The else block will run (message indicating the target was not met).
In PHP, when receiving the sales field from a form, which syntax correctly stores it in the variable $vendas?
vendas= _GET['vendas'];
vendas= _POST.vendas;
POST[′vendas′]= vendas;
vendas= _POST['vendas'];
What does Lesson 5 emphasize about the importance of using forms in web development?
They are used only for design purposes.
They are used only to send emails.
They serve only to test CSS.
They enable collecting user information for processing and dynamic interaction.
In the form (form3.php), what is the action attribute used for?
Define the type of field.
Define the submission method.
Define the field name.
Indicate which page the data will be sent to (e.g., resultado.php).
Which code snippet allows the user to return to the form from the resultado.php page?
For which form field was the variable $setor used to receive the value?
Name
Sales
Bonus
Sector
What is the main resource used by the code echo "Olá Funcionário(a) nome,setor: setor, veja sua Bonificação:
"?
Conditional structures.
File manipulation.
Mathematical operations.
Concatenation and display of variables.
If the form’s method attribute is omitted, by which method are the data sent by default?
GET
POST
SESSION
PUT
Which of the following is not a PHP superglobal?
$_POST
$_GET
$_SESSION
$_ARRAY
On the resultado.php page, the variable $vendas receives the value from the form. Which line of code displays the value of this variable?
if ($vendas >= 10000)
vendas= _POST['vendas'];
echo "Você receberá uma bonificação...";
echo $vendas; (when used outside the main string)
In the Lesson 5 form, what is the purpose of the name attribute on an HTML input?
Define the visual style.
Define the data type.
Determine the submission method.
Identify the field so PHP receives it via $_POST['nome'].
What is the main objective of Lesson 6?
Connect to and query a database.
Send automated emails.
Create interactive charts.
Collect form data and save it to a .txt file.
What is the native PHP function file_put_contents() used for?
Only to read a file’s content.
Only to open a file for writing.
Move a file between folders.
Create a text file and write content to it.
In the file-writing flow, which function is used to generate a date–time string to create unique filenames (e.g., dados_20250506_150102.txt)?
time()
unique_id()
datetime()
date("Ymd_His")
Which condition is used on the processing page (dados.php in Lesson 6) to ensure the code runs only if the form was submitted via POST?
$_POST["name"] != ""
if (isset($_POST))
if ($conteudo != "")
$_SERVER["REQUEST_METHOD"] == "POST"
In the data-processing code for the .txt file, which structure is used to loop through the $_POST array and extract the field name and the entered value?
for
while
if
foreach
What does the concatenation \n represent inside the content string that will be written to the .txt file?
A tab (large space).
The end of the file.
A division slash.
A line break.
In Lesson 6, the $conteudo variable is responsible for:
Storing the file name.
Defining the page’s HTML structure.
Storing database connection details.
Concatenating all form information into a single string that will be written to the file.
Why is it important to use a function like date("Ymd_His") to name the generated text files?
To define the file type.
To encrypt the file.
So that PHP can read the file.
To prevent new submissions from overwriting old files, ensuring uniqueness.
In the code that iterates over POSTwithforeach,the chave (field name) variable stores:
The value entered by the user.
The .txt filename.
The date and time.
The form field’s name attribute.
If the validation $_SERVER["REQUEST_METHOD"] == "POST" fails, what does the page display?
The form page again.
A 404 error.
A success message.
"Invalid access."
Where will the .txt files created by the PHP script (Lesson 6) be saved in XAMPP if the code does not specify a different path?
In the folder C:\xampp\temp.
In the folder C:\xampp\mysql.
In the root of C:.
In the same folder as the PHP file (dados.php in Lesson 6).
What does the snippet $_POST["campo"] ?? "" do in the code (Lesson 6)?
Sets the default value to 0.
Forces the field to have a value.
Ensures that if the field does not exist in $_POST, no error occurs (Null Coalescing Operator).
Validates whether the field is a number.
What is the role of the file form6.php in Lesson 6?
Create the .txt file.
Process the data.
List the created files.
Contain the HTML form for data collection.
What needs to be done in the browser so that the form-processing page (such as dados.php in Lesson 6) can be tested correctly?
Access it directly by URL.
Restart XAMPP.
Open the .txt file.
Fill out the form in form6.php and click the Submit button.
What does the function date("His") return?
The full year.
The current date (day, month, year).
Hour, minute, and second.
The name of the month.
What is the primary purpose of a database connection in PHP, according to Lesson 7?
To style web pages.
To only read data from .txt files.
To execute code on the client side.
To let the PHP script communicate with the database to store, query, update, or delete data.
Which PHP file connects to the database server (MySQL/MariaDB)?
index.php
validar.php
dados.php
conexao.php
What is the name of the graphical tool (included in XAMPP) used to manage the database (create tables, insert records manually, etc.)?
MySQL Workbench
SQL Server
HeidiSQL
phpMyAdmin
When creating the table usuarios in phpMyAdmin, which two properties are essential for the ID field (record identifier)?
Type VARCHAR and NOT NULL
Type FLOAT and Default 0
Type TEXT and UNIQUE
Primary Key (PRIMARY KEY) and Auto Increment (A_I or Auto Increment)
In the registration flow, which page (PHP file) receives the form data and executes the SQL instruction INSERT INTO to save the information to the database?
index.php
conexao.php
dados.php
validar.php
Which SQL instruction is used on the page validar.php (Lesson 7) to add a new record to the table usuarios?
UPDATE
SELECT
DELETE
INSERT INTO
In which file is the PHP function mysqli_connect() used?
validar.php
index.php
dados.php
conexao.php
If the database is named cadastros and the server is on your local machine, what is the host name used in the connection?
192.168.1.1
db_server
localhost/cadastros
localhost (or 127.0.0.1)
Which of the following fields was not used in the table usuarios created in Lesson 7?
ID
usuario
senha
cpf
After registration in validar.php, which message is displayed to the user indicating the operation was successful?
"Server error!"
"Invalid access!"
"Registration completed successfully!"
"Back"
What happens to the ID of a new record in the table usuarios thanks to the Auto Increment (A_I) property?
The user must type it in the form
It will always be 1
It is generated automatically by the database, increasing with each new record
It is an optional field that may be left empty
What does the command mysqli_query() do in the context of validar.php?
Receives the form data
Opens the connection to the database
Closes the connection to the database
Executes the SQL instruction (INSERT INTO...) in the database
Which term is used for the process that allows the PHP script to send SQL commands and receive results?
Authentication
Loop structure
Conditional structure
Communication channel / Connection to the Database
Which DBMS (Database Management System) used in the lessons is part of XAMPP?
PostgreSQL
Oracle
SQL Server
MySQL/MariaDB
Why is it important to include the file conexao.php at the beginning of validar.php?
To set the page style
So the form variables are read
So the database connection is active before attempting to execute INSERT INTO
To include the HTML menu
What does the acronym CRUD represent in system development?
Clean, Read, Update, Deploy
Connect, Run, Upload, Download
Client, Router, User, Data
Create, Read, Update, Delete
Which SQL instruction is used on the page dados.php to select and list all registered users?
UPDATE
DELETE
INSERT INTO
SELECT * FROM usuarios
Which PHP function is used on the page dados.php (inside a while loop) to iterate over and return each row from the SQL query result as an associative array?
mysqli_connect()
mysqli_query()
mysqli_num_rows()
mysqli_fetch_assoc()
The function mysqli_num_rows() is used to:
Close the connection to the database.
Execute the SQL query.
Return the current row from the result.
Verify that more than zero rows (records) were returned by the query.
Why does the page dados.php use a while loop?
To define the CSS style.
To insert new data.
To close the connection.
To iterate over the query result set and display each record in the table.
If the SQL query returns no records, what does the else block on dados.php display?
A connection error.
An empty table.
A syntax error.
"No user registered."
How are the data for each field (e.g., usuario) displayed in the HTML table within the while loop?
Using $_POST["usuario"].
Using echo $usuario.
Using mysqli_query("SELECT usuario").
Using echo linha[′usuario′](where linha is the associative array).
Which PHP file must be included in dados.php before performing the database query?
index.php
validar.php
conexao.php
style.css
In the HTML of the page dados.php, the
c) d) 116. What does the command resultado=mysqliquery( conexao, $sql); do? a) Starts the server. b) Defines the connection. c) Stores the SQL instruction in the variable $sql. d) Executes the SQL query and stores the result in $resultado. 117. The variable $linha (returned by mysqli_fetch_assoc()) contains record data in which format? a) A single string with all data. b) A PHP object. c) Only the user ID. d) An associative array (where the key is the column name, e.g., usuario). 118. What does the code display in the table on the page dados.php? a) The name of the field "id". b) The static text "id". c) The unique identification number of each user. d) The name of the table. 119. The final objective of Classes 7, 8, and 9 is to have a complete system that allows you to: a) Only register data. b) Only display the home page. c) Only read data from files. d) Perform the four CRUD operations (Create, Read, Update, Delete). 120. Which CRUD operation does the page excluir.php (Lesson 9) implement? a) Create b) Read c) Update d) Delete 121. What SQL statement does the page excluir.php use to remove a record from the database? a) SELECT * FROM usuarios WHERE ID = X b) UPDATE usuarios SET ... WHERE ID = X c) INSERT INTO usuarios VALUES ... d) DELETE FROM usuarios WHERE ID = X 122. How do the pages editar.php and excluir.php identify the specific user record that must be modified or removed? a) By the user's full name b) By the user's email c) By the password d) By the record's ID field 123. On the page editar.php, the form field is prefilled with the user’s current data for editing. Which HTML attribute, together with PHP echo, is used to display the field’s current value? a) placeholder b) name c) id d) value 124. Before displaying the edit form on editar.php, which SQL operation is performed first? a) UPDATE to clear the fields b) INSERT to duplicate the record c) DELETE to remove the old record d) SELECT * FROM usuarios WHERE ID = X to fetch the user’s current data 125. In which part of the page editar.php is the SQL statement to update a record (UPDATE) executed? a) When the page first loads b) When the page is deleted c) After the user fills the form and clicks the Update button (sent via POST) d) Only when closing the connection 126. Which SQL instruction is used to modify the data of an existing record (Update)? a) CREATE TABLE b) SELECT c) INSERT INTO d) UPDATE usuarios SET campo='novo_valor' WHERE ID=x 127. Which submission method (GET or POST) is most likely used on the page dados.php to send the user ID to excluir.php or editar.php via a link? a) POST b) SESSION c) COOKIE d) GET (e.g., excluir.php?id=10) 128. What happens to a user record when they click the Delete link and the action is processed by excluir.php? a) The record is marked as inactive b) The user is redirected to the home page c) The user’s data is sent to a .txt file d) The user’s record is permanently removed from the database 129. After the form is submitted, what does the editar.php page receive from the $_POST superglobal array? a) Only the user ID b) Only the password c) The new values for username, email, and password d) The SQL SELECT command 130. What does Lesson 9 highlight as the final result of all the learning? a) Knowing only basic PHP syntax b) Creating only static forms c) Handling only text files d) Having a site with a database and the features to Create, Edit, and Delete (CRUD) 131. What is the role of the Cancel button on the page editar.php? a) Delete the record from the database b) Confirm deletion c) Redirect back to dados.php without making changes d) Submit the form data 132. Which PHP function is used in excluir.php to execute the DELETE FROM ... statement on the database? a) mysqli_fetch_assoc() b) mysqli_connect() c) mysqli_close() d) mysqli_query() 133. What should be included in the code of editar.php and excluir.php to ensure the operation can be performed? a) style.css b) index.php c) validar.php d) conexao.php 100 % Similar Resources on Wayground |
