0% found this document useful (0 votes)
6 views

COMP 002 - Midterm Lecture Assignment 4 (Week 4 to 6 - C++ Basic Structures)

This document outlines the midterm lecture assignment for COMP 002 - Computer Programming 1 at the Polytechnic University of the Philippines, focusing on C++ basic structures. Students are required to work in groups to create appropriate variable names for various programming problems, evaluate expressions based on operator precedence, and identify valid identifiers. The assignment must be submitted as a PDF by November 7, 2024, at 11:59 PM.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

COMP 002 - Midterm Lecture Assignment 4 (Week 4 to 6 - C++ Basic Structures)

This document outlines the midterm lecture assignment for COMP 002 - Computer Programming 1 at the Polytechnic University of the Philippines, focusing on C++ basic structures. Students are required to work in groups to create appropriate variable names for various programming problems, evaluate expressions based on operator precedence, and identify valid identifiers. The assignment must be submitted as a PDF by November 7, 2024, at 11:59 PM.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Republic of the Philippines

POLYTECHNIC UNIVERSITY OF THE PHILIPPINES


SANTA ROSA CAMPUS
City of Santa Rosa, Laguna

COMP 002 - COMPUTER PROGRAMMING 1


FIRST SEMESTER, AY 2024-2025

MIDTERM LECTURE ASSIGNMENT NO. 4

Name: Score:
Name: Program:
Name: Course Code - Section:
Name of Faculty: Asst. Prof. Ma. Ymelda C. Batalla

Midterm Lecture Activity Name: C++ Basic Structures

Learning Outcomes:
Upon completion of this activity, the students should be able to:
▪ Recognize the significance of relevant and descriptive variable names in programming;
▪ Create concise variable names that reflect its purpose in every programming problem; and
▪ Evaluate expressions correctly by following the order of the operations based on their precedence.

Instructions:
▪ This activity is composed of two (2) to three (3) students per group.
▪ Create an appropriate variables name for the following problems (1pt each).
1. Calculate the area of a rectangle.
a.
b.
c.
2. Convert the temperature from Fahrenheit to Celsius.
a.
b.
3. Find the largest of three given numbers.
a.
b.
c.
d.
4. Determine a student's grade based on their average of three quiz scores.
a.
b.
c.
d.
5. Calculate the factorial of a given non-negative integer.
a.
b.
c.
6. Calculate the simple interest using principal, rate of interest, and years.
a.
b.
c.
d.

Mula Sa Iyo, Para sa Bayan! Page 1 of 2


Republic of the Philippines
POLYTECHNIC UNIVERSITY OF THE PHILIPPINES
SANTA ROSA CAMPUS
City of Santa Rosa, Laguna

▪ Evaluate the following expressions using the operator’s precedence (5pts each).
1. 20 - 13 % 2 + 17 / 4
Solution:

2. 7.0 / 2 + 3 * 4 - 10 % 5
Solution:

3. a = 5, b = 3, c = 7
++a * --b + --c /--b
Solution:

4. a = 5, b = 3, c = 7
!(--c % --a != a++ - --b )
Solution:

▪ Identify which of the following is a valid identifier; write VALID if the identifier is acceptable; however, write
INVALID and reasons why the identifier is not acceptable (1 pt each).
1. firstC++Prog
2. 3FeetYard
3. CPP_Assignment
4. Monthly Pay
5. firstNumber#
6. travel_time
7. _number
8. InchesInCentimeter
9. bonusAmount$
10. Jack’sQuizScore

▪ Save the group output as pdf file format and each member must upload the assignment using the filename
format: Last Name_ Last Name_ Last Name - COMP 002 - Midterm Lecture Assignment 4
▪ Submission due date: November 7, 2024, 11:59 PM

Mula Sa Iyo, Para sa Bayan! Page 2 of 2

You might also like