CPE202
CPE202
Question 1
a) Using any programming language that you are familiar with
a. Write a program that declares two variables of integer data type and performs the
following operations:
a) Assign a value to each variable.
b) Add the two variables together and store the result in a third variable.
c) Display the result on the screen.
b) Explain the steps involved in problem-solving methods for programming challenges. Provide
examples to illustrate each step.
c) Discuss the importance of debugging techniques in programming. Describe three common
debugging techniques and how they can be applied to identify and resolve errors in code.
Question 2
a) Why is documentation important in programming? Explain the key aspects of documenting
programs and how they contribute to code readability, maintainability, and collaboration.
b) What is programming language style, and why is it important? Discuss the benefits of adhering
to a good programming language style and provide specific guidelines for maintaining a
consistent and readable code style.
Question 3
a) Describe the process of programming algorithm development. Discuss the key steps involved,
including problem analysis, algorithm design, implementation, testing and optimization, and
documentation. Provide an example algorithm and explain how it follows each step in the
process.
b) Define operations in programming and provide examples of common operations for different
data types. Note: Use any programming language that you are familiar with
Question 4
a) What are built-in functions in programming? Categorize built-in functions based on their
purpose. Discuss the advantages of using built-in functions in programming.
b) Write a program that declares a variable of type float and assigns a decimal value to it. Perform
a mathematical operation of your choice on the float variable and display the result with
appropriate formatting
Question 5
Write a program in any programming language that you know that takes an integer input from the user
and determines whether the number is even or odd. Display the appropriate message based on the
result.
Question 6
a) Write a program in any programming language that you know that takes an input from the user
and checks if it is a positive number. If the number is positive, display the message "The number
is positive." Otherwise, display the message "The number is not positive."