You are on page 1of 2

University of Cagayan Valley

Tuguegarao City

BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY


First Semester School Year 2020-2021

SUBJECT: Programming 1 FINAL EXAMINATION

Direction: Read the instructions carefully. Write your answers on your test booklet.
Write legibly and avoid erasures.

I. Flowcharting
1. Construct a flowchart that will allow the user to input two numbers. Print the
sum and the product of numbers.
2. Construct a flowchart that allows the user to input 100 numbers. Print the sum
of all the inputs.

II. Solve the following:


1. 2%3++-2*2---2
2. 2/2--+3*2+++4-2/2
3. T||F&&(!F||T)||T

III. Tracing Output:

A. The Input number is 10,9,5,7,3,1,8,2,4,6.


#include<iostream>
using namespace std;
 
int main() {
int number, reverse = 0;
cout<<"Enter a Number to Reverse and press Enter: ";
cin>> number;     // Taking Input Number in variable number
 
   for( ; number!= 0 ; )
   {
      reverse = reverse * 10;
      reverse = reverse + number%10;
      number = number/10;
   }
   cout<<"Reversed Number is:  "<< reverse;
   return 0;
 
}
 
OUTPUT:

B. #include <iostream>

#include<conio.h>

using namespace std;


int main()
{
int i;
int value[6] = {5,10,15,20,25,30};
cout<<"Single Dimensional Array In C++ Example Program\n";
for (i=0;i<6;i++)
{
cout<<"Position : "<<i<<" , Value : "<< value[i]<<" \n";
}
getch();
return 0;
}
OUTPUT:
IV. Fill in the blanks: Complete the program below and give the output.
Program that will allow the user to input two numbers. Print the sum of the two numbers.
#include <iostream.h>
#include <conio.h>
void main()
{
____ num1=0, num2=0, sum=0;
____<<”Input number 1: “;
cin>>_____;
cout<<”Input number 2: “;
____>>num2;
sum=___________;
cout<<”The sum of the two numbers is: “ + _________;
}

OUTPUT:

Prepared by:

MRS. APRILIZA M. CARAG, MIT


Instructor

You might also like