0% found this document useful (0 votes)
2K views

Computer Programming Exam Answer Keys

This document contains a final exam in computer programming with three sections - multiple choice questions, true/false questions, and programming simulations to produce outputs. The multiple choice section covers topics like operators, conditional statements, and I/O streams. The true/false section tests understanding of programming concepts. The simulation section provides short code snippets and asks for their output. An answer key is provided with the correct responses.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Computer Programming Exam Answer Keys

This document contains a final exam in computer programming with three sections - multiple choice questions, true/false questions, and programming simulations to produce outputs. The multiple choice section covers topics like operators, conditional statements, and I/O streams. The true/false section tests understanding of programming concepts. The simulation section provides short code snippets and asks for their output. An answer key is provided with the correct responses.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Doc. Ref No.

: CEIT-TQ-05
Kalinga State University Effectivity Date: 12-10-2020

College of Engineering and Revision No.: 0

Information Technology Page No.:


FINAL EXAMINATION IN COMPUTER
PROGRAMMING

INSTRUCTION: Write your answer on the given answer sheet or on a clean pad paper.
I MULTIPLE CHOICE: Choose the correct answer from the choices given.
_______1. It assigns a value to a variable
a) assignment operator b) operator c) algorithm
_______2. The operation that gives the remainder of a division of two values.
a) Addition b) multiplication c) Modulo
_______3. Used to perform input and output operations in sequential media
a) Stream b) Include c) Modulo
_______4. A manipulator that produces a newline character
a) Reserve word b) operator c) endl
_______5. It evaluates an expression returning a value if that expression is true and a different one if the
expression is evaluated as false
a) conditional operator b) iostream c) assignment operator
A = 10 B=5 C=2
_______6. A /= B a) 3 b) 2 c) 4
_______7. B *= C + 1 a) 16 b) 15 c) 12
_______8. a -= 5 a) 5 b) 6 c) 7
_______9. a = 10 % 3 a) 1 b) 2 c) 3
_______10. a++ a) 9 b) 10 c) 11
_______11. A > B a) True B) False
_______12. A<B a) True B) False
_______13. (5 == 5) && (3 > 6) a) True B) False
_______14. (5 == 5) || (3 > 6) a) True B) False
_______15. a = 5 + (7 % 2) a) 6 b) 7 c) 5

_______16. An object where a program can either insert or extract characters to/from it
a) Stream b) include b) modulo
_______17. !(5 == 5)
a) True b) False
_______18. !(6 <= 4)
a) True b) False
_______19. !true
Doc. Ref No.: CEIT-TQ-05
Kalinga State University Effectivity Date: 12-10-2020

College of Engineering and Revision No.: 0

Information Technology Page No.:


FINAL EXAMINATION IN COMPUTER
PROGRAMMING

a) True b) False
_______20. It is used to execute a statement or block only if a condition is fulfilled
a) if b) switch c) do while

TRUE/FALSE
______1. The rvalue has to be a variable whereas the lvalue can be either a constant, a variable, the result of an
operation or any combination of these.
______2. cout can only process the input from the keyboard once the RETURN key has been pressed
______3. the standard output of a program is the screen
______4. The assignment operation always takes place from left to right
______5. Bitwise operators modify variables considering the bit patterns that represent the values they store.

III SIMULATION: Produce the output of the program below.


1. PROGRAM 1
#include <iostream.h>
int main()
{
int firstNumber, secondNumber;

cout << "Please enter a big number: ";


cin >> firstNumber;

cout << "\nPlease enter a smaller number: ";


cin >> secondNumber;

if (firstNumber > secondNumber)


cout << "\nThanks!\n";
else cout << "\nOops. The second is bigger!";
return 0;
}

2. PROGRAM 2

#include<iostream>
using namespace std;
int main()
{
for (int i = 1; i <= 5; ++i)
{cout << i << " ";} return
0;
Doc. Ref No.: CEIT-TQ-05
Kalinga State University Effectivity Date: 12-10-2020

College of Engineering and Revision No.: 0

Information Technology Page No.:


FINAL EXAMINATION IN COMPUTER
PROGRAMMING

3. PROGRAM 2(10 pts)


#include <iostream>
using namespace std;
int main (){ char grade
= 'D'; switch(grade) {
case 'A' :
cout << "Excellent!" << endl;
break; case 'B' : case 'C' :
cout << "Well done" << endl;
break; case 'D' :

cout << "You passed" << endl;

break;
case 'F' :
cout << "Better try again" << endl;
break; default :
cout << "Invalid grade" << endl;
}
cout << "Your grade is " << grade << endl;
return 0;
}
4. PROGRAM 2(7 pts)
#include <iostream>
using namespace std;
int main() {

1; int i =

while (i <= 5) { cout << i << " ";


++i;
}
Return 0; }

ANSWER KEYS:

1. B
Doc. Ref No.: CEIT-TQ-05
Kalinga State University Effectivity Date: 12-10-2020

College of Engineering and Revision No.: 0

Information Technology Page No.:


FINAL EXAMINATION IN COMPUTER
PROGRAMMING

2. C

3. A

4. C

5. A

6. B

7. B

8. A

9. A

10. C

11. A

12. B

13. B

14. A

15. A

16. A

17. B
Doc. Ref No.: CEIT-TQ-05
Kalinga State University Effectivity Date: 12-10-2020

College of Engineering and Revision No.: 0

Information Technology Page No.:


FINAL EXAMINATION IN COMPUTER
PROGRAMMING

18. A

19. B

20. A

II TRUE/FALSE

1. FALSE

2. FALSE

3. TRUE

4. FALSE

5. TRUE

III SIMULATION: Produce the output of the program below.

1. PROGRAM 1

Please enter a bigger number : 1

Please enter a smaller number : 2

Oops. The second is bigger!


Doc. Ref No.: CEIT-TQ-05
Kalinga State University Effectivity Date: 12-10-2020

College of Engineering and Revision No.: 0

Information Technology Page No.:


FINAL EXAMINATION IN COMPUTER
PROGRAMMING

2. PROGRAM 2

12345

3. PROGRAM 2(10 pts)

You passed

Your grade is D

You might also like