100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Examen

CMPSC 101 Chp3-Chp4 QUESTIONS & ANSWERS(RATED A+)

Puntuación
-
Vendido
-
Páginas
5
Grado
A
Subido en
26-02-2025
Escrito en
2024/2025

branching - ANSWERdirects a program to execute either one statement group or another, depending on an expression's value. Ex; print "Too young to drive" if userAge < 16, else print "OK to drive". Braces - ANSWERsurrounds a branch's statements. {},sometimes redundantly called curly braces represent a grouping, such as a grouping of statements. rational operator / equality operator - ANSWERAn if-else expression commonly involves. Boolean value - ANSWEReither true or false. If userAge is 19, then userAge<25 evaluates to true. What is the final value of numItems? bonusVal = 5; if (bonusVal<12) numItems= 100 numItems = 200; - ANSWER5 < 12 so the first branch executes, namely numItems = 100. If userAge is greater than 62, assign 15 to discount. Else, assign 0 to discount. - ANSWERif (userAge > 62) { discount = 15; } else { discount = 0; } If numPeople is greater than 10, execute groupSize = 2 * groupSize. Otherwise,

Mostrar más Leer menos
Institución
CMPSC 101 Chp3-Chp4
Grado
CMPSC 101 Chp3-Chp4









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
CMPSC 101 Chp3-Chp4
Grado
CMPSC 101 Chp3-Chp4

Información del documento

Subido en
26 de febrero de 2025
Número de páginas
5
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

Vista previa del contenido

CMPSC 101 Chp3-Chp4 QUESTIONS &
ANSWERS(RATED A+)
branching - ANSWERdirects a program to execute either one statement group or
another, depending on an expression's value.
Ex; print "Too young to drive" if userAge < 16, else print "OK to drive".

Braces - ANSWERsurrounds a branch's statements. {},sometimes redundantly called
curly braces represent a grouping, such as a grouping of statements.

rational operator / equality operator - ANSWERAn if-else expression commonly
involves.

Boolean value - ANSWEReither true or false. If userAge is 19, then userAge<25
evaluates to true.

What is the final value of numItems?
bonusVal = 5;
if (bonusVal<12) numItems= 100
numItems = 200; - ANSWER5 < 12 so the first branch executes, namely numItems =
100.

If userAge is greater than 62, assign 15 to discount. Else, assign 0 to discount. -
ANSWERif (userAge > 62) {
discount = 15;
}
else {
discount = 0;
}

If numPeople is greater than 10, execute groupSize = 2 * groupSize. Otherwise,
execute groupSize = 3 * groupSize and also numPeople = numPeople - 1. -
ANSWERif (numPeople > 10) {
groupSize = 2 * groupSize;
}
else {
groupSize = 3 * groupSize;
numPeople = numPeople - 1;
}

If numPlayers is greater than 11, execute teamSize = 11. Otherwise, execute
teamSize = numPlayers. Then, no matter the value of numPlayers, execute
teamSize = 2 * teamSize. - ANSWERif (numPlayers > 11) {
teamSize = 11;
}
else {
teamSize = numPlayers;

, }
teamSize = 2 * teamSize;


a is equal to b - ANSWERa==b

a != b - ANSWERa is not equal to b or differ

!= - ANSWERDiffer or less than or greater than

centsLost is a negative number - ANSWER< 0 is the common way to detect a
negative number.

Strings are equal - ANSWERif they have they have the same number of characters
and corresponding characters are identical.

nested if-else - ANSWERA branch's statements can include any valid statements,
including another if-else statements, such occurrence known as nested if-else
statements.

logical operator - ANSWERtreats operands as being true or false, and evaluates to
true or false.

a && b - ANSWERLogical AND: true when both of its operands are true

a || b - ANSWERLogical OR: true when at least one of its two operands are true

!false - ANSWERTRUE

! - ANSWERNOT

!a - ANSWERLogical NOT (opposite): true when its single operand is false (and false
when operand is true)

!((numPeople > 10) && (numCars > 2)) - ANSWERThe && expression is false. So !
(false) is true.

% - ANSWERmodulo (remainder

modf - ANSWERBreak into fractional and integral parts.

Iterate until c equals 'z' - ANSWERc != 'z'

bool(short for Boolean) - ANSWERdata type is for variables that store only values
true or false.
common error - ANSWERis to access an invalid array index, especially exactly one
larger than the largest index.

exception - ANSWERis a detected runtime error that commonly prints an error
message and terminates the program.
$14.99
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada


Documento también disponible en un lote

Conoce al vendedor

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.
papersbyjol West Virginia
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
421
Miembro desde
2 año
Número de seguidores
253
Documentos
13986
Última venta
2 semanas hace

3.8

72 reseñas

5
27
4
18
3
17
2
2
1
8

Recientemente visto por ti

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