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

Midterm Exam - CPE104L-Programming Logic and Design

The document appears to be a midterm exam for a programming logic and design course. It contains 100 multiple choice and true/false questions testing concepts in C++ programming including variables, data types, operators, control structures, and algorithms. It also includes 5 programming problems to solve using concepts covered.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
181 views

Midterm Exam - CPE104L-Programming Logic and Design

The document appears to be a midterm exam for a programming logic and design course. It contains 100 multiple choice and true/false questions testing concepts in C++ programming including variables, data types, operators, control structures, and algorithms. It also includes 5 programming problems to solve using concepts covered.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

BULACAN STATE UNIVERSITY

COLLEGE OF ENGINEERING
COMPUTER ENGINEERING DEPARTMENT

MIDTERM EXAM
In CPE 104L – Programming Logic and Design
2nd Semester, S.Y. 2021-2022
Name: ______________________________ Date:_____________________
Yr./ Sec: ____________________________ Score: _____________________

Answer the following questions.

1. What do you do in a variables/ data before using them in a program?


2. C Language is designed by ___ in 1972.
3. C language is a general purpose programming language. C language is called as a ____.
4. ____ is a multiparadigm programming language that supports object oriented
programming (OOP) created by Bjarne Stroustrup in 1983 at Bell labs.
5. Which of the following is not true?
a. C++ is procedural.
b. bottom up approach adopted in program design of C++.
c. Multiple declaration of global variables are allowed C++.
d. C++ allows the declaration of variable anywhere in the scope.
6. this library consists of general-purpose, stand-alone function that are not part of any
class. The function library is inherited from C.
7. this is a collection of classes and associated function.
8. What is the correct steps of writing an algorithm?

a. 1,2,3,4
b. 4,2,1,3
c. 1,2,4,3
d. 4,1,2,3
9. Which of the following is not a classification of algorithm according to structures?
a. Sequence
b. Branching
c. Loop
d. Decision Making
10. Which of the following is not a commonly used keywords in writing pseudocode for
input.
a. Input
b. Read
c. Set
d. Get
11. Which of the following is not a commonly used keywords in writing pseudocode for
output.
a. Display
b. Write
c. Print
d. prompt
12. This statement tells the compiler to include iostream file. This file contains pre defined
input/output functions that we can use in our program.
13. A namespace is like a region, where we have functions, variables etc and their scope is
limited to that particular region.
14. ___are just a text written by programmer during code development.
15. ____is the main function of our program and the execution of program begins with this
function, the int here is the return type which indicates to the compiler that this function
will return a integer value.
16. This statement returns value 0 from the main() function which indicates that the
execution of main function is successful. The value 1 represents failed execution.
17. _____is a type of diagram that represents an algorithm or process, showing the steps as
boxes of various kinds, and their order by connecting these with arrows.
18. A procedure for accomplishing some task which given an initial state, will terminate in a
defined end state.
19. ___ is an outline of a program, written in a form that can easily be converted in real
programming statements. It is an informal language that has no syntax rules and is not
meant to be compiled or executed.
20. ___is a schematic representation of a process.
21. A ___ is a region of the program and broadly speaking there are three places, where
variables can be declared.
22. An arrow in flowchart denotes ___.
23. This is represented as rectangles and used to show that something is performed.
24. Represented as circles, ovals, stadiums, or rounded rectangles which usually contain the
word "Start" or "End".
25. Represented as a diamond showing where a decision is necessary, commonly a Yes/No
question or True/False test.
26. The ___ is a keyword, but it is a compile-time operator that determines the size, in bytes,
of a variable or data type.
27. A shape represents that represents initiation in flow chart.
28. These type of variables holds integer value.
29. Data type that you can use to compute any mathematical operations and it has 4 bytes of
storage.
30. Data type that cannot be manipulated mathematically using standard arithmetic
operations.
31. Data type that you cannot use to compute any mathematical operations and it has 4 bytes
of storage.
32. Operation that perform familiar calculations on numeric values.
33. Division result is truncated or no rounding occurs.
34. In arithmetic operation order this is evaluated sixth
35. What is the value of x = 8 Or 4 ?
36. What is the value of x = 7 Xor 14 ?
37. ____ is the characteristic of a data element that describes whether it is numeric,
alphabetic or alphanumeric.
38. What is the value of x = Not 3 And 5 ?
39. Which of the following is not a relational operator? > != ! <
40. Copies string s1 into s2
a. strcpy(s2, s1)
b. strcpy(s1, s2)
c. strcopy(s1, s2)
d. strcopy(s2, s1)
41. Returns a pointer to the first occurrence of string s1 in string s2
a. strstr(s1, s2)
b. strstr(s2, s1)
c. strchr(s1, ch)
d. strchr(s2, ch)

42. What operator has the highest precedence in C++?


43. What operator has the lowest precedence in C++?
44. ___Is a logical operator if both the operands are non-zero, then condition becomes true.
45. ____Is a logical operator if any of the two operands is non-zero, then condition becomes
true.
46. A ___ is a data type used in programming, such as an integer and floating point unit, but
is used to represent text rather than numbers. It is comprised of a set of characters that
can also contain spaces and numbers.
47. ___ never change in value
48. A ___ constant is a value typed directly into your program wherever it is needed.
49. A ____ constant is a constant represented by a name, just like a variable
50. The ____ keyword precedes the type, name, and initialization in declaring symbolic
constants.
51. In defining constant, the preprocessor directive ____ can create a constant by specifying
its name and value, separated by spaces:
52. ____constants create a set of constants with a single statement. They are defined with the
keyword enum followed by a series of comma-separated names surrounded by braces:
53. A ____ is a name which is associated with a value that can be changed
54. ____ variable is when the variable only hold positive values.
55. ____ variable is when the variable  hold positive or negative values.
56. A variable is assigned a value using the = operator, which is called the ___.
57. ___ are declared inside the braces of any user defined function, main function, loops or
any control statements(if, if-else etc) and have their scope limited inside those braces.
58. An ____ statement consists of a boolean expression followed by one or more statements
59. TRUE or FALSE: Decision making structures require that the programmer specify one or
more conditions to be evaluated or tested by the program, along with a statement or
statements to be executed if the condition is determined to be true, and optionally, other
statements to be executed if the condition is determined to be false.
60. Which of the following statement is not true about if-else-if statement?
a. An if can have zero or one else's and it must come after any else if's.
b. An if can have zero to many else if's and they must come before the else.
c. All statements are true
d. All statements are false
61. TRUE or FALSE: You can terminate an infinite loop by pressing Ctrl + C keys
62. TRUE or FALSE: When the break statement is encountered inside a loop, the loop is
immediately terminated and program control resumes at the next statement following the
loop.
63. TRUE or FALSE: You can nest else if...else in the similar way as you have nested if
statement.
64. Which of the following is not true about the rules of switch statement?
a. When the variable being switched on is equal to a case, the statements following that case
will execute until a break statement is reached.
b. When a break statement is reached, the switch terminates, and the flow of control jumps
to the next line following the switch statement.
c. Not every case needs to contain a break. If no break appears, the flow of control will fall
through to subsequent cases until a break is reached.
d. A switch statement must have a default case, which must appear at the end of the switch.
65. A ___ is used for executing a block of statements repeatedly until a particular condition is
satisfied
66. ___statement is used to terminate a case in the switch statement
67. A ___ statement provides an unconditional jump from this to a labeled statement in the
same function.
68. Sometimes we need to execute a block of statements only when a particular condition is
met or not met. This is called _____.
69. A ___ statement allows a variable to be tested for equality against a list of values. Each
value is called a case, and the variable being switched on is checked for each case.
70. A ____ loop is a repetition control structure that allows you to efficiently write a loop
that needs to execute a specific number of times.
71. - 75. Create a C++ program that will determine if theinput number is evenor
oddusing if-else condition.
76. – 80. Create a C++ program that will determine if the input number is positive or
negative using if-else condition
81. – 85. Create a C++ program that will determine if the input letter is vowel or
consonant using switch case statement.
86. – 90. Create a C++ program that will determine if the input number is two digit, three
digit, four digit, five digit or the number is not between 1 and99999, using if-else-if
statement.
Sample output:

91. – 95. Create a C++ program that allows the user to input his/ her grades in 5 subjects
and your program will compute the average grade and will display the equivalent grade.
96. – 100. Create a C++ program that will determine if the inputvalue (char or string) is
letter/word or number, if letter/word it will identify the first character if it is vowel or consonant,
and if the value is number, will identify if it is even or odd. You can use nested if-else
or nested switch case statements.

You might also like