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

COS1511

Puntuación
-
Vendido
-
Páginas
120
Grado
A+
Subido en
21-01-2025
Escrito en
2024/2025

Exam of 120 pages for the course COS1511 at University of South Africa (COS1511)

Institución
Grado











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

Escuela, estudio y materia

Institución
Grado

Información del documento

Subido en
21 de enero de 2025
Número de páginas
120
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

Vista previa del contenido

COS1511 EXAM PACK
2025

QUESTIONS AND
ANSWERS
FOR ASSISTANCE CONTACT
EMAIL:

, lOMoARcPSD|50013335




COS1511/201/1/2020




Tutorial letter

Introduction to Programming I
COS1511

Semester 1

School of Computing




This tutorial letter contains the discussion of the solutions to assignment 3 semester 2.

, lOMoARcPSD|50013335




COS1511/201




Question 1

Which of the following is a valid variable name?

1. sixty_four
2. 64set
3. 6_set
4. dollar$

Correct option: 1

฀ Options 2 and 3 are incorrect because a variable name cannot start with a numerical value.
฀ Option 4 is incorrect because a variable name may not contain an ampersand character.


Question 2

Which of the following is not a valid variable name?

1. myInt
2. myDouble
3. sumOf4
4. return

Correct option: 4

฀ Options 4 is correct as return is a reserved word in C++ and cannot be used as a variable name.
฀ Options 1, 2 and 3 are all valid variable names.




2
2

, lOMoARcPSD|50013335




COS1511/201




Question 3

What is the value of xafter the following statements?

int x, y, z;
y = 10;
z = 3;
x = y * z - 3;

1. 0
2. 3
3. 10
4. 27

Correct option: 4

Options 4 is correct as *has precedence over +:

x = y * z - 3
x = 10 * 3 - 3
x = 30 - 3
x = 27

You can also include brackets for easier readability:

x = (y * z) - 3
x = (10 * 3) - 3
x = 30 - 3
x = 27




Question 4

What is the value of xafter the following statements?

int x;
x = 0;
x = x * 13;

1. 0
2. 13
3. 34
4. not defined

Correct option: 1

Options 2 is correct as the integer value 0is assigned to xand thus it is addition between two integer values.

x = x * 30
x = 0 * 30
x = 0




3
3
$2.50
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

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.
kevinlugwiri98 Teachme2-tutor
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
28
Miembro desde
1 año
Número de seguidores
0
Documentos
100
Última venta
2 meses hace

3.5

4 reseñas

5
2
4
0
3
1
2
0
1
1

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