¡GoConqr estrena diseño! Cuéntanos qué te parece.

Test

PHP y MySQL: sesiones, formularios y procedimientos almacenados

DANIEL RUBEN RIVAS SALTOS 18 preguntas

Hacer el test

Preguntas del test (18)

  1. 1Analice el siguiente código y seleccione la instrucción que hace falta para la ejecución correcta
    <?php
    $_SESSION['usuario']=$_REQUEST['campousuario'];
    $_SESSION['clave']=$_REQUEST['campoclave']; ?>
    <html> <head> <title>Problema</title> </head>
    <body> Se almacenaron dos variables de sesión.<br><br>
    <a href="pagina3.php">Ir a la tercer página donde se recuperarán las variables de sesión</a>
    </body> </html>
    1. Asession_start();
    2. Bsetcookie("usuario","diego",0);
    3. Cif (isset($_COOKIE['valor']))
    4. Dwhile ($reg=mysql_fetch_array($registros))
  2. 2Analice el siguiente código, el mismo que debe permitir el envió de datos seleccionar la línea correcta:
    <html> <head> <title>El gran agujero de seguridad</title> </head>
    <body> <h2>Agujero de seguridad en register_globals = On</h2>
    Contraseña: <input type="password" name="pass">
    <input type="submit" value="Enviar">
    </form>
    <?php if ($pass == "abc_xyz_123") { $login = true; }
    if ($login) { echo "<p>Aqui empieza el arma secreta.</p>"; }
    ?> </body>
    </html>
    1. A<form action="<?php echo "33_seguridad.php"; ?>" method="post">
    2. B<form action="<?php echo "33_seguridad.php"; ?>" metod="post">
    3. C<form action="<?php echo "33_seguridad.php"; ?>" method=post>
    4. D<form action="<?php echo "33_seguridad.php"; ?>" method="gets">
  3. 3Analice el siguiente código para seleccionar los datos de la tabla dirección, debe de determinar la línea correcta.
    <html> <head> <title>MySQL 01 - Consulta a BD (Agenda)</title> </head>
    <body> <h1>Mostrar Nombres de la Agenda. BD </h1>
    mysql_select_db("agenda", $dp);
    $sql = "SELECT * FROM direcciones" ;
    $resultado = mysql_query($sql);
    while ($row = mysql_fetch_assoc($resultado)) {
    echo "$row[Nombre] $row[Apellido]<br>\n"; }
    mysql_close($dp); ?> </body> </html>
    1. A<?php $dp = mysql_connect("localhost", "root", "" );
    2. B<?php $dp = mysql_open("localhost", "root", "" );
    3. C<?php $dp = mysql_connect("localhost", "", "root" );
    4. D<?php $dp = mysql_open("root", "usuario", "" );
  4. 42. Analice el siguiente código de html que permita el envia de datos mediante un botón y la siguiente etiqueta.
    <!DOCTYPE html>
    <html lang="es-ES">
    <head>
    <meta charset="utf-8">
    <title>Ejemplo de formulario básico</title>
    </head>
    <body>
    <form>
    Nombre:
    <br>
    <input type="text">
    <br>
    Edad:
    <br>
    <input type="number">
    <br><br>
    <input type="submit" value="Enviar datos">
    </form>
    </body>
    </html>
    1. A<input type="submit" value="Enviar datos"> </form>
    2. B<input type="submit" text="Enviar datos"> </text>
    3. C<input type="search" value="Enviar datos"> </input>
    4. D<input type="submitt" value="Enviar datos"> </form>
  5. 5Seleccione la ejecución correcta del procedimiento almacenado para consultar los producto que empiezan con una determinada letra.
    USE Northwind
    GO
    CREATE PROCEDURE paunos @ProductName varchar(50)
    AS
    SELECT * FROM Products
    WHERE Productname LIKE @ProductName+'%'
    GO
    1. Aexecute paunos 'A'
    2. Bexecute paunos A
    3. Cexecute pauno 'A'
    4. Dexecute 'A' paunos
  6. 63. Del siguiente procedimiento almacenado determinar la ejecución correcta del mismo.
    USE Northwind
    GO
    CREATE PROCEDURE padoss @ProductID int, @ProductName varchar(50) output, @UnitPrice Money output
    AS
    SELECT @ProductName = ProductName, @UnitPrice = UnitPrice
    FROM Products WHERE ProductID = @ProductID
    GO
    1. Adeclare @Nombre varchar(50), @Precio Money
      Execute pados 10, @Nombre OUTPUT, @Precio OUTPUT
      SELECT @Nombre AS Nombre, @Precio AS Precio
    2. Bdeclare @Nombre varchar(50), @Precio Money
      Execute pados @Nombre OUTPUT, @Precio OUTPUT,100
      SELECT @Nombre AS Nombre, @Precio AS Precio
    3. Cdeclare @Precio Money, @Nombre varchar(50),
      Execute pados @Nombre OUTPUT, @Precio OUTPUT
    4. DSELECT @Nombre AS Nombre, @Precio AS Precio
      declare @Nombre varchar(50), @Precio Money
      Execute pados '100', @Nombre OUTPUT, @Precio OUTPUT
      SELECT @Nombre AS Nombre, @Precio AS Precio
  7. 7Lea el siguiente enunciado y determine la linea de sql correcta. Consultar el nombre del producto, el número de unidades totales vendidas, del producto que más unidades ha vendido la empresa.
    1. Ause Northwind
      go
      select productname, unitsonorder
      from products
      where unitsonorder= (SELECT MAX(unitsonorder)from products )
    2. Buse Northwind
      go
      select productname, unitsonorder
      from products
      where unitsonorder= (SELECT COUNT(unitsonorder)from products )
    3. Cuse Northwind
      go
      select productname, unitsonorder
      from products
      where unitsonorder= (SELECT AVG(unitsonorder)from products )
    4. Duse Northwind
      go
      select productname, unitsonorder
      from products
      where unitsonorder= (SELECT SUM(unitsonorder)from products)/( SELECT COUNT(unitsonorder)from products)
  8. 8Del siguiente enunciado determinar la línea de sql correcta, para consultar los clientes que compraron en el 1996 y 1997
    1. Aselect * from Customers where CustomerID in (select distinct CustomerID from Orders where Datename(mm,OrderDate) = 'Agosto' and year (orderdate )between ( 1996) AND ( 1997))
    2. Bselect * from Customers where CustomerID in (select distinct CustomerID from Orders where Datename(mm,OrderDate) = 'Agosto' and year (orderdate )between ( '1996') AND ( ' 1997'))
    3. Cselect * from Customers where CustomerID in (select distinct CustomerID from Orders where Datename(mm,OrderDate) = Agosto and year (orderdate )between ( 1996) AND ( 1997))
    4. Dselect * from Customers where CustomerID in (select distinct CustomerID from Orders where Datename(mm,OrderDate) = 'Agosto' and year (orderdate )between ( 1996) or ( 1997))
  9. 9Observe la imagen y analice para seleccionar la linea de sql que permite la operación de join correcta entre las tablas de la imagen.Imagen de la pregunta 9
    1. ASELECT Products.ProductName, [Order Details].ProductID, [Order Details].UnitPrice, [Order Details].Quantity, Customers.CompanyName, Employees.LastName, Employees.FirstName FROM [Order Details] INNER JOIN
      Orders ON [Order Details].OrderID = Orders.OrderID INNER JOIN
      Customers ON Orders.CustomerID = Customers.CustomerID INNER JOIN
      Employees ON Orders.EmployeeID = Employees.EmployeeID INNER JOIN
      Products ON [Order Details].ProductID = Products.ProductID where [Order Details].UnitPrice >=50
    2. BSELECT Products.ProductName, [Order Details].ProductID, [Order Details].UnitPrice, [Order Details].Quantity, Customers.CompanyName, Employees.LastName, Employees.FirstName FROM [Order Details] JOIN Orders ON [Order Details].OrderID = Orders.OrderID JOIN Customers ON Orders.CustomerID = Customers.CustomerID INNER JOIN Employees ON Orders.EmployeeID = Employees.EmployeeID INNER JOIN Products ON [Order Details].ProductID = Products.ProductID where [Order Details].UnitPrice >=50
    3. CSELECT Products.ProductName, [Order Details].ProductID, [Order Details].UnitPrice, [Order Details].Quantity, Customers.CompanyName, Employees.LastName, Employees.FirstName FROM [Order Details] INNER
      Orders ON [Order Details].OrderID = Orders.OrderID INNER
      Customers ON Orders.CustomerID = Customers.CustomerID INNER JOIN
      Employees ON Orders.EmployeeID = Employees.EmployeeID INNER JOIN
      Products ON [Order Details].ProductID = Products.ProductID where [Order Details].UnitPrice >=50
    4. DSELECT Products.ProductName, [Order Details].ProductID, [Order Details].UnitPrice, [Order Details].Quantity, Customers.CompanyName, Employees.LastName, Employees.FirstName FROM [Order Details] INNER JOIN
      Orders ON [Order Details].OrderID = Orders.OrderID INNER JOIN
      Customers ON Orders.CustomerID = Customers.CustomerID INNER JOIN
      Employees ON Orders.EmployeeID = Employees.EmployeeID INNER JOIN
      Products ON [Order Details].ProductID <> Products.ProductID where [Order Details].UnitPrice >=50
  10. 10Observe la imagen de la base de datos para escoger la linea de sql que permite calcular la sumatoria de un determinado producto.Imagen de la pregunta 10
    1. ASELECT Products.ProductName, [Order Details].ProductID, sum ([Order Details].UnitPrice) FROM [Order Details] INNER JOIN Products ON [Order Details].ProductID = Products.ProductID group by [Order Details].ProductID,Products.ProductName having [Order Details].ProductID=1 order by Products.ProductName
    2. BSELECT Products.ProductName, [Order Details].ProductID, sum ([Order Details].UnitPrice) FROM [Order Details] INNER JOIN Products ON [Order Details].ProductID = Products.ProductID group by Products.ProductName having [Order Details].ProductID=1 order by Products.ProductName
    3. CSELECT Products.ProductName, [Order Details].ProductID, avg([Order Details].UnitPrice) FROM [Order Details] INNER JOIN Products ON [Order Details].ProductID = Products.ProductID group by [Order Details].ProductID,Products.ProductName having [Order Details].ProductID=1 order by Products.ProductName
    4. DSELECT Products.ProductName, [Order Details].ProductID, ([Order Details].UnitPrice) FROM [Order Details] INNER JOIN Products ON [Order Details].ProductID = Products.ProductID group by [Order Details].ProductID,Products.ProductName having [Order Details].ProductID=1 order by Products.ProductName

Información

Descripción
Test sobre Sin título, creado por DANIEL RUBEN RIVAS SALTOS el 29/10/2019.
Idioma
Español
Visitas
32
Valoración
Aún sin valoraciones
Valora este test
Valora este test

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?