Professional Documents
Culture Documents
{
For (int iloop=0; iloop <10; iloop++)
{
cout <<5*(iloop+1) <<”,”;
}
return 0;
}
2. #include <iostream> Create a program that will display
using namespace std;
int main () 11111
2222
{ 333
44
int i, j; 5
for (i=1; i<=5; i++)
{
for (j=5; j>=i; j--)
{
cout <<i;
}
cout << "\n";
}
return 0;
}
3. Sample flowchart that has a process inside, the question is what is the answer in the blank
process?
4. 3 functions simulate, the syntax is PASCAL Programming (just search for sample codes of Pascal PL
in the internet) The answer here is the final values of 3 variables. Ang given number are 456. It’s a
bit tricky because the variables will be modified within the function then pass it to another
function with current values.
Answer ko ditto is choices number “3” if I remember, pwede nyu dn e’analyze ulit.
Note: Program simulation of set 1.1 specifically sa number 4 and 5, just look for the sample
correct pseudocode and PASCAL PL syntax in the internet para sure kayo sa answer nyu.
SET 1.5
Code/Answer:
Code/Answer:
#include <iostream>
using namespace std;
int main()
{
int numbers[2];
return 0;
}
3. Time table……You will be asking to create a program that will convert a 24-hour time format to
a 12-hour time.
Code/Answer:
#include<iostream>
#include<cstdio> using
namespace std;
int main ()
{
int twenty_four_hrs; cout<<"Enter the time in
twenty four hour format:";
cin>>twenty_four_hrs;
cout<<"\n";
int hrs,min; hrs=twenty_four_hrs/100;
min=twenty_four_hrs%100;
cout<<"Time in Twelve Hour Format is:\t";
if(hrs==0&&hrs!=12)
{
hrs=12;
printf("%.2d:%.2d AM\n",hrs,min);
}
else if(hrs==12&&hrs!=0)
{
hrs=12;
printf("%.2d:%.2d PM\n",hrs,min);
}
else if(hrs<12&&hrs!=0)
{
hrs=hrs;
min=min;
printf("%.2d:%.2d AM\n",hrs,min);
}
else if(hrs>12&&hrs!=0)
{
hrs=hrs-12;
min=min;
printf("%.2d:%.2d PM\n",hrs,min);
}
}
4. How many elements that result to non-zero (So far, No answer yet)
Code/Answer:
5. How many fare if the distance is 35 km?
Code/Answer:
1. In an object-oriented program, data and methods are combined into one entity to keep details
of object implementation hidden from the view of users. What is this scheme.
a. Abstraction
b. Polymorphism
c. Clustering
d. Instance
e. Encapsulation
Answer: E
int i
int total
for i = 1 to 15
i=I+1
if I % 3 = 0
print i
end if
next
Answer: b
4. The most important reason for investigating the current systems and the needs for the new
system is to ____________.
Answer: d
5. During programs execution the control unit continuously repeats this 3-step cycle.
Answer: d
6. _______________ is a technique used to improve data access times rather than sorting the
data according to a key, it computes the location of the data from the key.
a. Direct Access
b. Indexed Sequential
c. File Merging
d. Hashing
e. Linked List
Answer: b
7. Given a set of numbers, A(1), A(2), … A(5), determine what the algorithm below is doing.
ALGOL: SUBROUTINE
B A (1) a. It initializes J to 1.
J 1 b. It performs comparison up
I 2 to the last element
DO WHILE ( I > 5 ) c. It determines the maximum number.
IF A (I) > B d. It locates the position of the maximum
THEN B A(I) number.
J 1 e. It initially assumes the first number
ENDIF to be the highest.
I=I+1
ENDDO
STOP Answer: b
END ALGO
8. Given the following array which loop will NOT print out the contents of the array?
Answer: b
Answer: a
Answer:
3. Create a program that will Sum of even and odd elements available in 2 D array. (If I to
remember, parang ganyan ang tanong, its either the sum, difference, product and quotient)
Code/Answer:
#include <iostream> {
using namespace std; If(a[i] [j]%2==0)
int main ()
s1=s1+a[i] [j];
{ Else
int a [3] [3], i , j , s1=0, s2=0;
printf(“\Enter Elements”); s2=s2+a[i] [j];