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

ENGR 103 Midterm Exam Questions With Correct Answers

Puntuación
-
Vendido
-
Páginas
35
Grado
A+
Subido en
16-10-2024
Escrito en
2024/2025

©SIRJOEL EXAM SOLUTIONS 12/3/2024 11:27AM ENGR 103 Midterm Exam Questions With Correct Answers (3 pts) What is the output of the following code, and why? int a = 1, b = 1, c = 1; if (a == b || c++){ int a = 20; b = b + a; } cout << a << " " << b << " " << c << " " << endl; - answer1 21 1 Hint: scope, short-circuiting Algorithm - answerA methodical, logical rule or procedure that guarantees solving a particular problem. Computation - answerOperates to give an output that follows a definite set of rules. Signed vs Unsigned - answerSigned can be negative and positive. Unsigned cannot be negative. Variable - answerStore value that can change depending on the condition ©SIRJOEL EXAM SOLUTIONS 12/3/2024 11:27AM Operand vs Operator - answerThe operator indicates what action or operation to perform. Operands suggest what items to apply the action. rvalue to. lvalue * pre and post-increment/decrement - answerlvalue is object and rvalue is value. % - answeroperator use to get remain What is the value of my_value in the following exmaple? int my_value; - answerany number What are two ways to create a constant in C++ Wht are the pros and cons? - answerconst int my_constant= 42; #define MY_CONSTANT 42 Given N bytes, what is the maximum and minumum represntable njmber of signed and unsigned? - answerINT_MAX INT_MIN max = 65535 min -32768 ©SIRJOEL EXAM SOLUTIONS 12/3/2024 11:27AM Describe the diffence between syntax vs semantics - answerSyntax is concerned with the form of the code, while Semantics is concerned with its meaning and behavior. Both are imporatn for writting correct and effective C++ code. List and label the relational and logical operators, and what is the difference between them? - answerRelational operators are used to compare two value and determine the relationship between them. They return Boolean value of either 'true' or 'false' Like < (less than) > (greater than) <= (less than or equal to) >= (greater than or equal to) == (equal to) != (not equal to) Logical operators are used to perform Boolean operations on Boolean values. && (logical AND)

Mostrar más Leer menos
Institución
Engr 103
Grado
Engr 103











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

Escuela, estudio y materia

Institución
Engr 103
Grado
Engr 103

Información del documento

Subido en
16 de octubre de 2024
Número de páginas
35
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

Vista previa del contenido

©SIRJOEL EXAM SOLUTIONS
12/3/2024 11:27AM



ENGR 103 Midterm Exam Questions With
Correct Answers


(3 pts) What is the output of the following code, and why?

int a = 1, b = 1, c = 1;

if (a == b || c++){

int a = 20;

b = b + a;

}


cout << a << " " << b << " " << c << " " << endl; - answer✔1 21 1 Hint: scope, short-circuiting


Algorithm - answer✔A methodical, logical rule or procedure that guarantees solving a particular

problem.


Computation - answer✔Operates to give an output that follows a definite set of rules.


Signed vs Unsigned - answer✔Signed can be negative and positive. Unsigned cannot be

negative.


Variable - answer✔Store value that can change depending on the condition

, ©SIRJOEL EXAM SOLUTIONS
12/3/2024 11:27AM


Operand vs Operator - answer✔The operator indicates what action or operation to perform.

Operands suggest what items to apply the action.


rvalue to. lvalue * pre and post-increment/decrement - answer✔lvalue is object and rvalue is

value.


% - answer✔operator use to get remain


What is the value of my_value in the following exmaple? int my_value; - answer✔any number


What are two ways to create a constant in C++ Wht are the pros and cons? - answer✔const int

my_constant= 42;

#define MY_CONSTANT 42

Given N bytes, what is the maximum and minumum represntable njmber of signed and

unsigned? - answer✔INT_MAX


INT_MIN




max = 65535

min -32768

, ©SIRJOEL EXAM SOLUTIONS
12/3/2024 11:27AM


Describe the diffence between syntax vs semantics - answer✔Syntax is concerned with the form

of the code, while Semantics is concerned with its meaning and behavior. Both are imporatn for

writting correct and effective C++ code.

List and label the relational and logical operators, and what is the difference between them? -

answer✔Relational operators are used to compare two value and determine the relationship

between them. They return Boolean value of either 'true' or 'false'

Like

< (less than)

> (greater than)

<= (less than or equal to)

>= (greater than or equal to)

== (equal to)

!= (not equal to)




Logical operators are used to perform Boolean operations on Boolean values.




&& (logical AND)

, ©SIRJOEL EXAM SOLUTIONS
12/3/2024 11:27AM


|| (logical OR)

! (logical NOT)


Give examples of when you use logical and relational operators in your every life - answer✔It is

sunny outside and I want to go to the beach.


What is short circuiting and when is it useful? - answer✔%% which stand for "AND" and ||

Which stand for "OR"


When would you use an if versus switch - answer✔If statement is when you want to test one or

more conditions and execute diferencet staments based on the results of the test.




Swtich in other hand is you when you want to choose betwen sveral alternative actions besed on

the vlaue of a single expression.


What are the limitations with a switch? - answer✔Limited data types like int char short or long




No expression




No range
$11.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.
sirjoel Liberty University
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
109
Miembro desde
1 año
Número de seguidores
13
Documentos
11865
Última venta
4 días hace
Sirjoel

Here you will find all documents and package deals offered by sirjoel

3.5

17 reseñas

5
4
4
4
3
7
2
1
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