Rizal Technological University
Boni Ave Mand. City
Computer Programming 1
I. Multiple Choice
Write the correct answer from among the choices
1. The two major division of a computer system is
a. Input and output b. hardware and software
c. data and programs d. memory and disk drives
2. Which of the following is synonymous with computer instructions?
a. Hardware b. software
c programs d. data
3. Which of the following is true about programming languages?
a. Every programming language is a general purpose language
b. Every programming language has the same syntax set
c. Every programming language has a unique grammar rules
d. Every programming language can be used for all types of applications
4. The term that refer to the proper sequencing of computer instructions
a. Syntax b. logic
c. Arrangement d. Symmetry
5. Which of the following is the job of language translators?
a. Create syntax of a source code
b. Translate an English statement into a C++ statement
c. Execute the instructions in a source code.
d. Convert a source code into an object code.
6. Which category of programming language resembles binary notations?
a. Low –level b. middle level
c. high level d. all of these
7. Which of the following is true about newer programming languages?
a. Newer languages does not require logic
b. Newer languages has no definite syntax
c. Newer programming language approach in development is usually modular
d. all of these
8. Actually writing a C++ or Java program is known as
a. Translating b. interpreting
c. coding d. compiling
9. Which of the following is the first step in programming?
a. Coding b. Compiling
c. analysis d. Documentation
10. Which of these is a syntax error?
a. A misspelled reserved word like prrrint.
B. the use of x instead of the operator *
c. A newBalance calculated by adding a customerPayment to an oldBalance
instead of subtracting it.
d. an arithmetic statement written as regularSales + discounttedSales =
totalSales.
11. Two tools used in planning a programs logic is:
a. Flowcharts and pseudocode b. C++ and Java
c. ASCII and EBCDIC
d. word processor and spreadsheet.
12. In flowchart the entrance and exit of data is represented by the symbol
a. Rectangle b. diamond
c. parallelogram d. small circle
13. In a flowchart, processing is represented by the symbol
a. Rectangle b. diamond
c. parallelogram d. small circle
14. Which of the following is an advantage of using IDE in developing programs?
a. you can create a more logically correct program
b. syntax is slightly different
c. there is no need for program plan
d. every tool in program development is already available
15. Of the following tasks, which should be completed first?
a. Testing a program b. developing the logic
b. Coding the program d. translating a program
16. In C++, what is the term for a named set of statements that perform tasks
a. main() b. void ( )
c. proc() d. function ()
17. Which of the following is true about the use of identifiers in C++
a. C++ allows the use of digits at the beginning of an identifier
b. C++ identifiers may contain spaces between them
c. C++ identifiers may contain reserved words.
d. The case used in C++ identifiers must be consistent throughout the program.
18. When a program responds to a user’s query, the program is said to be
a. Batch b. on-line
c. interactive d. user friendly
19. Programs that uses GUI (Graphical User Interface) is said to be
a. Batch b. on-line
c. interactive d. user friendly
20. Which of the following is optional about variables in C++
a. It must always be declared b. It should be represented by a name
b. Its data type must be declared d. It must have an initial value
21. Which of the following is true about a C++ program
a. It always have a housekeeping routine
b. It always have main routine
c. It always have an end of job routine
d. All of these
22. Which of the following special symbol allowed in a variable name?
A. * (asterisk) B. | (pipeline)
C. - (hyphen) D. _ (underscore)
23. How would you round off a value from 1.66 to 2.0?
A. ceil(1.66) B. floor(1.66)
C. roundup(1.66) D. roundto(1.66)
24. By default a real number is treated as a
A. float B. double
C. long double D. far double
25. Translator which is used to convert codes of assembly language into machine
language is termed as
a. assembler b. attempter
c. compiler d. debugger
26. Language in which single statements can be written to accomplish substantial tasks
is termed as
a. machine language b. assembly language
c. high level language d. medium language
27. Third generation procedural language contains systematic order of
a. statements b. objects
c. classes d. operations
28. Data type is shifted from short type to long type when
a. value range decreases b. value range increases
c. value range becomes zero d. value range become infinite
29. Dividing a program into functions and modules is one of main feature of
a. machine language b. interpreted language
c. structural language d. all of these
30. A computer is a device that can perform computations and make
a. sequential statements b. Arithmetic statements
c. logical statements d. algebraic statements
II
1: Write a C++ program which accepts three numbers x, y and z and compute the
following algebraic expression:
𝑟𝑒𝑠𝑢𝑙𝑡=2𝑥+𝑦𝑧−2
Sample Output:
Enter value for x: 5
Enter value for y: 6
Enter value for z: 4
Result is : 32
2: Write a C++ program which accepts total number of days and converts it into
years, months, weeks and days. Use 365 days = I year
Sample Output:
Enter no of days: 544
544 is equal to 1 year, 5 months, 0 week and 1 day