Basic Programming Concepts: For Multiple-Choice and Essay Questions
Basic Programming Concepts: For Multiple-Choice and Essay Questions
Basic Programming Concepts: For Multiple-Choice and Essay Questions
1
A. Multiple-choice questions and essay questions (10pts)
A.3. Name at least two IDEs that support C/C++ programming (not to mention Visual Studio). Are
they open-source tools?
A.4. Which of the following figures represents a step, which may be some basic task or action, in
the process?
A.5. Assume that the currency rate from USD to VND is 1 USD = 23,181 VND. The following
program converts a given amount of US dollars to Vietnam Dong. Which type of errors that
the program commits?
A.6. Define the following terms: computer program, programming, and algorithm.
A.7. Name all approaches to represent an algorithm. Which one do you prefer? Explain why.
3
B. Programming questions (10pts)
You can answer these questions by any possible mean while not worrying about loops or conditions
(which will be available in the following weeks).
B.1. Write a program that prints your name, date of birth and mobile number.
Expected output:
Name : Alexandra Abramov
DOB : July 14, 1975
Mobile : 99-9999999999
B.2. Write a program to compute the perimeter and area of a rectangle with a height of 7 inches
and width of 5 inches.
Expected Output:
Perimeter of the rectangle = 24 inches
Area of the rectangle = 35 square inches
B.3. Write a program to compute the perimeter and area of a circle with a radius of 6 inches.
Expected Output:
Perimeter of the Circle = 37.68 inches
Area of the Circle = 113.04 square inches
B.4. Write a program that accepts two integers from the user and calculates the sum of these
integers.
Test Data :
Input the first integer: 25
Input the second integer: 38
Expected Output:
Sum of the above two integers = 63
B.5. Write a program that accepts the information of two products from the user, for each of
which that includes the unit price (a floating point number) and the number of purchases
(an integer number), and calculates the average value for each product item.
Test Data :
Unit price – Product 1: 15
No. of item – Product 1: 5
Unit price – Product 2: 25
No. of item2 – Product 2: 4
Expected Output:
Average Value = 19.444444
4
B.6. Write a program that uses the asterisk character, ‘*’, to print a full rectangle whose size
(length height) is 7 4.
Expected output:
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
B.7. Write a program that uses the asterisk character, ‘*’, to print a empty rectangle whose size
(length height) is 7 4.
Expected output:
* * * * * * *
* *
* *
* * * * * * *
B.8. Write a program that uses the asterisk character, ‘*’, to print a full isosceles triangle whose
height is 4.
Expected output:
*
* * *
* * * * *
* * * * * * *
B.9. Write a program that uses the asterisk character, ‘*’, to print a empty isosceles triangle
whose height is 4.
Expected output:
*
* *
* *
* * * * * * *
B.10. Write a program that uses the hash character, ‘#’, to print the first letter (in uppercase) of
your name.