Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 2 fuera de 8 páginas
Examen

CPSC 1045 Midterm Exam 1- Solved

Document preview thumbnail
Vista previa 2 fuera de 8 páginas

CPSC 1045 Midterm Exam 1- Solved

Vista previa del contenido

CPSC 1045 Midterm Exam 1- Solved
Consider the following HTML paragraph
<p id="paragraph1">Here is a paragraph in English.</p>
Match each piece of the HTML element to its descriptor.

# opening tag
# attribute value
# text content
# attribute name
# closing tag

1.<p>
2.</p>
3.id
4."paragraph1"
5.Here is a paragraph in English. - ANSWER-1
4
5
3
2

Everything inside the
______
element is shown to the user inside the main browser window. Before this element we
will often see a
______
element that contains information about the page rather than information shown on the
page. This element usually contains a <title> tag. - ANSWER-body
head

For each scenario described select the appropriate input/output programming structure
you should use to complete the task.

# If a programming problem asks you to get the user input from a text field, you would
use...
# If a programming problem asks you to output some text to a textfield on the webpage,
you would use...
# If a programming problem asks you to output some value part way through your
program for debugging purposes, you would use...
# If a programming problem asks you to output some text to the HTML webpage (in say
a div or a paragraph), you would use..

1.let val = document.getElementById("someID").value;
2.document.getElementById("someID").innerHTML = "some text";

, 3.document.getElementById("someID").value = "some text";
4.console.log(value); - ANSWER-1
3
4
2

function doubleOrTriple( x ) {
if(typeof(x) !== "number"){
return NaN;
} if(50 <= x){
return x*2;
} else {
return x*3;
}
}

What value is returned by each of the following function calls?

1. doubleOrTriple(40)
2. doubleOrTriple(doubleOrTriple(40)) - ANSWER-1. 120
2. 240

function hypotenuse(a,b){
return Math.sqrt(Math.pow(a,2) + Math.pow(b,2));
};
let a = 3;
let b = 4;
console.log(hypotenuse(a,b));

What is printed to the console? - ANSWER-5

function stringTooLong(str, length){
if(typeof(str) != "string" || isNaN(length)){
return false;
}else if(str.length() <= length){
return false;
}else{
return true;
}
}

Given the function above, in the first blank write a function call that will cause this
function to return true.
In the second blank write a function call that will cause this function to return false. -
ANSWER-stringTooLong("Hello", 1)
stringTooLong("Hello", 10)

Información del documento

Subido en
5 de marzo de 2025
Número de páginas
8
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$11.79

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
CLOUND
3.9
(128)
Vendido
655
Seguidores
389
Artículos
12042
Última venta
1 semana hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes