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

COSC 1436 FINAL UPDATED ACTUAL Exam Questions and CORRECT Answers

Puntuación
-
Vendido
-
Páginas
73
Grado
A+
Subido en
15-12-2024
Escrito en
2024/2025

COSC 1436 FINAL UPDATED ACTUAL Exam Questions and CORRECT Answers [SHORT ANSWER] Assume the string variables firstName and userID are assigned with values. use string slicing and concatenation to create a username based on the first two letters of the firstName, concatenated with the last four digits of the userID as shown in the example below. For Example: Suppose firstName = "Mary" and userID = "W" then, the username

Mostrar más Leer menos
Institución
Cosc
Grado
Cosc











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

Escuela, estudio y materia

Institución
Cosc
Grado
Cosc

Información del documento

Subido en
15 de diciembre de 2024
Número de páginas
73
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

Vista previa del contenido

COSC 1436 FINAL UPDATED ACTUAL
Exam Questions and CORRECT Answers
[SHORT ANSWER] Assume the string variables firstName and userID are assigned with values.
use string slicing and concatenation to create a username based on the first two letters of the
firstName, concatenated with the last four digits of the userID as shown in the example below.


For Example: Suppose firstName = "Mary" and userID = "W12345678" then, the username
should be:
[SHORT ANSWER] Assume the string variables firstName and userID are assigned with values.
use string slicing and concatenation to create a username based on the first two letters of the
firstName, concatenated with the last four digits of the userID as shown in the example below.


For Example: Suppose firstName = "Mary" and userID = "W12345678" then, the username
should be:


Ma5678 - CORRECT ANSWER - username = firstName[:2] + userID[-4:]


SHORT ANSWER Assume variable gpa has already been assigned a value. Write python code
that displays invalid GPA if the value associated with variable gpa is not in the range [0,4] -
CORRECT ANSWER - if gpa < 0 or gpa > 4:
print("Invalid GPA")


Which type of error prevents the program from running?


human
syntax
grammatical

logical - CORRECT ANSWER - syntax


The smallest storage location in a computer's memory is known as a

,switch
byte
ketter

bit - CORRECT ANSWER - bit


A Python line comment begins with ________.
a. /*
b. $$
c. //

d. # - CORRECT ANSWER - d. #


Which of the following are valid camel case identifier naming styles (Choose all that apply)?
(a) dollar_amount
(b) dollarAmount
(c) dollar$Amount
(d) amtDollar
(e) dollarAmt$
(f) dollarAmt
(g) amountDollar

(h) Dollar_Amount - CORRECT ANSWER - (b) dollarAmount
(d) amtDollar
(f) dollarAmt
(g) amountDollar


Assume the following:


val = 99

,val += 1


Match the code with its output:
a. print('The value is', 'val')
b. print('The value is', val)
print("The value is:", 'val')


The value is val
The value is 100

The value is: val - CORRECT ANSWER - (a) The value is val
(b) The value is 100
(c) The value is: val


Match the relational operators with its meaning:
a. >
b. <
c. >=
d. <=
e. ==

f. != - CORRECT ANSWER - a. Greater than
b. less than
c. Greater than or equal to
d. Less than or equal to
e. Equal to (equality operator)
f. Not equal to


Which of the following will assign a random integer in the range of 1 through 50 to the variable
number?

, (a) number = random(range(1, 50))
(b) random(1, 50) = number
c) number = random.randint(1, 50)

(d) randint(1, 50) = number - CORRECT ANSWER - c) number = random.randint(1, 50)


x < y or z > x What is the result of the following Boolean expression, given that x = 5, y = 3, and
z= 8?


not (x < y or z > x) and y < z


(a) 5
(b) False
(c) 8

(d) True - CORRECT ANSWER - (b) False


What is the result of the following Boolean expression, given that x = 5, y = 3, and z = 8?


x < y or z > x


(a) False
(b) 8
(c) True

(d) 5 - CORRECT ANSWER - (c) True


Consider the following statements. If the input is 85, the output of the following code will be:


score=0
$15.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.
MGRADES Stanford University
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
1123
Miembro desde
2 año
Número de seguidores
104
Documentos
68962
Última venta
9 horas hace
MGRADES (Stanford Top Brains)

Welcome to MGRADES Exams, practices and Study materials Just think of me as the plug you will refer to your friends Me and my team will always make sure you get the best value from the exams markets. I offer the best study and exam materials for a wide range of courses and units. Make your study sessions more efficient and effective. Dive in and discover all you need to excel in your academic journey!

3.8

178 reseñas

5
76
4
31
3
47
2
9
1
15

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