Computer Programming Engr - Mojares SmartEDGE Unlocked
Computer Programming Engr - Mojares SmartEDGE Unlocked
Computer Programming Engr - Mojares SmartEDGE Unlocked
JACOB “COB”
MOJARES
TOPIC COMPUTER PROGRAMMING
A. syntax
B. interpretation
C. logic
D. customs
A. syntax
COMPUTER PROGRAMMING
Q 02 The step-by-step instructions that solve a problem
are called
A. an algorithm
B. a list
C. a plan
D. a sequential structure
A. an algorithm
COMPUTER PROGRAMMING
Q 03 Typing the function's name as Main, rather than
main, is an example of
A. an entry error
B. a function error
C. a logic error
D. a syntax error
D. a syntax error
COMPUTER PROGRAMMING
Q 04 refers to the process of locating and removing
the errors in a program
A. Analyzing
B. Correcting
C. Debugging
D. Executing
C. Debugging
COMPUTER PROGRAMMING
Q 05 The process of drawing a flowchart for an algorithm
is called
A. Performance
B. Evaluation
C. Algorithmic Representation
D. Flowcharting
D. Flowcharting
COMPUTER PROGRAMMING
TOPIC FLOWCHART
FLOWCHART
TOPIC FLOWCHART SYMBOLS
FLOWCHART
FLOWCHART ALGORITHM
STEP 3: IS IT 7 AM?
IF YES, TAKE BUS
IF NO, TAKE SUBWAY
A. Diamond
B. Oval
C. Parallelogram
D. Rectangle
A. Diamond
COMPUTER PROGRAMMING
Q 07 Actual instructions in flowcharting are represented in
A. Circles
B. Boxes
C. Arrows
D. Lines
B. Boxes
COMPUTER PROGRAMMING
Q 08 Which of the following flowchart symbols represents
the if selection structure?
A. Diamond
B. Hexagon
C. Oval
D. Parallelogram
A. Diamond
COMPUTER PROGRAMMING
Q 09 A detailed flowchart is called
A. Stack
B. Macro
C. Micro
D. Union
C. Micro
COMPUTER PROGRAMMING
TOPIC PROGRAMMING CONTROL STRUCTURE
A. Repetition
B. Selection
C. Sequence
D. Sorting
D. Sorting
COMPUTER PROGRAMMING
Q 11 The set of instructions for how to tie a bow is an
example of the structure.
A. Control
B. Repetition
C. Selection
D. Sequence
D. Sequence
COMPUTER PROGRAMMING
Q 12 The instruction "If it's raining outside, then take an
umbrella to work" is an example of the
structure.
A. Control
B. Repetition
C. Selection
D. Sequence
C. Selection
COMPUTER PROGRAMMING
TOPIC LOW-LEVEL & HIGH LEVEL PROGRAMMING
HIGH-LEVEL LANGUAGE
ASSEMBLY LANGUAGE
MACHINE LANGUAGE
HARDWARE
Q 13 A language which is close to that used within the
computer is
A. High-level language
B. Assembly language
C. Low-level language
D. All of the above
C. Low-level language
COMPUTER PROGRAMMING
Q 14 A notation used to express clearly on algorithm is
known as
A. Algorithmic language
B. Assembly language
C. Machine language
D. High level language
A. Algorithmic language
COMPUTER PROGRAMMING
Q 15 Which of the following isn’t a
characteristic of High level languages?
A. machine code
B. platform independent
C. interactive execution
D. user-friendly
A. machine code
COMPUTER PROGRAMMING
Q 16 Which of the following is the common abbreviation
for Assembly Language?
A. ASS
B. ASB
C. ASM
D. ASY
C. ASM
COMPUTER PROGRAMMING
TOPIC PROGRAMMING LANGUAGE FUNDAMENTALS
A. programmer-defined type
B. complex type
C. nonscalar type
D. scalar type
D. scalar type
COMPUTER PROGRAMMING
Q 18 The number 5.5e3 is a constant
A. character literal
B. named literal
C. numeric literal
D. string literal
C. numeric literal
COMPUTER PROGRAMMING
Q 19 Which of the following is(are) invalid string
constant(s)?
A. '7.15 pm'
B. "i like e"
C. "7.3el2"
D. "1234el2"
A. '7.15 pm'
COMPUTER PROGRAMMING
Q 20 The most efficient data type for a variable that stores
the letter C is the data type
A. Character
B. Double
C. Float
D. Long Integer
A. Character
COMPUTER PROGRAMMING
Q 21 The String data type is an extension of the
data type
A. Character
B. Double
C. Letter
D. Long
A. Character
COMPUTER PROGRAMMING
Q 22 You typically initialize a String variable to
A. an asterisk
B. a space enclosed in single quotes
C. the number 0
D. a zero-length string
D. a zero-length string
COMPUTER PROGRAMMING
Q 23 The first element in a string is
B. a member of an array
COMPUTER PROGRAMMING
Q 25 An array element is accessed using
A. a first-in-first-out approach
B. the dot operator
C. a member name
D. an index number
D. an index number
COMPUTER PROGRAMMING
TOPIC BASIC OPERATIONS
ARITHMETIC OPERATORS
OPERATOR NAME
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus
** Exponentiation
// Floor Division
TOPIC BASIC OPERATIONS
LOGICAL OPERATORS
OPERATOR NAME
&& AND
|| OR
! NOT
TOPIC BASIC OPERATIONS
COMPARISON OPERATORS
OPERATOR NAME
== EQUAL
!= NOT EQUAL
> GREATER THAN
< LESS THAN
>= GREATER THAN OR EQUAL TO
<= LESS THAN OR EQUAL TO
TOPIC BASIC OPERATIONS
ASSIGNMENT OPERATORS
OPERATOR
=
++
--
+=
-=
Q 26 An expression contains relational, assignment and
arithmetic operators. In the absence of parentheses,
the order of evaluation will be
A. arithmetic operators
B. equality operators
C. logical operators
D. relational operators
C. logical operators
COMPUTER PROGRAMMING
Q 28 The following statement where T is true and F is false
T&&T||F&&T
A. is true
B. is false
C. is wrong
D. not applicable in C language
A. is true
COMPUTER PROGRAMMING
Q 29 Evaluate the following expression:
3>6&&7>4
A. True
B. False
C. Invalid
D. Can't determine
B. False
COMPUTER PROGRAMMING
Q 30 Evaluate the following expression:
4>6||10<2*6
A. True
B. False
C. Invalid
D. Can't determine
A. True
COMPUTER PROGRAMMING
Q 31 Evaluate the following expression:
7>=3+4||6<4&&2<5
A. True
B. False
C. Invalid
D. Can't determine
A. True
COMPUTER PROGRAMMING
Q 32 The statement double total = 0.0; performs
A. assignment
B. initialization
C. rationalization
D. polymorphism
B. initialization
COMPUTER PROGRAMMING
Q 33 Which of the following assigns the number 5 to the
area variable?
A. area 1 = 5
B. area = 5
C. area == 5
D. area --> 5
B. area = 5
COMPUTER PROGRAMMING
TOPIC Programming Language Fundamentals
If (condition)then
do (instructions)
CONDITIONAL else if (condition 2) then
do (instructions)
BASIC IF-ELSE
else
do (instructions)
endif
TOPIC Programming Language Fundamentals
If (condition)then
do (instructions)
else
if (condition) then
CONDITIONAL do (instructions)
NESTED IF-ELSE else if (condition) then
do (instructions)
else
(instructions)
endif
endif
TOPIC Programming Language Fundamentals
switch choice
case choice1:
do (instructions)
break
case choice2:
SWITCH CASE do (instructions)
break
case choice2:
do (instructions)
break
default:
do (instructions)
end switch
TOPIC Programming Language Fundamentals
A. Beginning
B. Initial
C. Pretest
D. Priming
C. Pretest
COMPUTER PROGRAMMING
TOPIC Programming Language Fundamentals
TOPIC Programming Language Fundamentals
function functionName(parameters)
do (instructions)
FUNCTIONS return value
end function
Q 35 The two parts of a function are the
A. Control
B. Repetition
C. Selection
D. Sequence
D. Sequence
COMPUTER PROGRAMMING
TOPIC TRANSLATORS
TRANSLATORS
TOPIC COMPILER VS INTERPRETER VS. ASSEMBLER
HIGH-LEVEL HIGH-LEVEL
LANGUAGE LANGUAGE COMPUTER
(HLL) (HLL) INSTRUCTIONS
ASSEMBLY
LOWER BINARY
BINARY
LEVEL (0’s & 1’s)
LLL
LANGUAGE
(LLL)
TOPIC COMPILER VS INTERPRETER VS. ASSEMBLER
A. assembler
B. compiler
C. interpreter
D. linker
B. compiler
COMPUTER PROGRAMMING
Q 39 The output of an assembler is called?
A. data file
B. task file
C. object file
D. program file
C. object file
COMPUTER PROGRAMMING
Q 40 If an error occurs, what interpreter do?
A. terminate program
B. stops execution
C. reads the whole program even if it encounters
errors
D. give warning
B. stops execution
COMPUTER PROGRAMMING
Q 41 If an error occurs, what compiler do?
A. terminate program
B. stops execution
C. reads the whole program even if it encounters
errors
D. give warning
A. Compiler
B. Interpreter
C. Sensor
D. Circuitry
B. Interpreter
COMPUTER PROGRAMMING
TOPIC OBJECT-ORIENTED PROGRAMMING (OOP)
(POP) (OOP)
PROCEDURAL OBJECT-ORIENTED
PROGRAMMING PROGRAMMING
TOPIC CLASS AND OBJECT
A class is like a blueprint, while an object is an instance of
that blueprint.
TOPIC CLASS AND OBJECT
A class is like a blueprint, while an object is an instance of
that blueprint.
name()
age()
ATTRIBUTES gender()
occupation()
walk()
eat()
PERSON FUNCTIONALITY
sleep()
(CLASS) work()
TOPIC OBJECT-ORIENTED PROGRAMMING (OOP)
ENCAPSULATION ABSTRACTION
INHERITANCE POLYMORPHISM
TOPIC THE FOUR (4) OOP CONCEPTS
ENCAPSULATION
ABSTRACTION
INHERITANCE
INHERITANCE
TOPIC THE FOUR (4) OOP CONCEPTS
INHERITANCE
TOPIC THE FOUR (4) OOP CONCEPTS
POLYMORPHISM
C. inheritance
COMPUTER PROGRAMMING
Q 44 Inheritance is the principle that
A. a category of classes
B. a name given to a class
C. an instance of a class
D. the same as a class
C. an instance of a class
COMPUTER PROGRAMMING
Q 46 Object is to class as
A. library is to book
B. mother is to daughter
C. Plato is to philosopher
D. president is to Lincoln
C. Plato is to philosopher
COMPUTER PROGRAMMING
Q 47 A pattern for creating an object is called a(n)
A. class
B. attributes
C. Private
D. public
A. class
COMPUTER PROGRAMMING
Q 48 Which of the following type of class allows only one
object of it to be created?
A. Virtual class
B. Abstract class
C. Singleton class
D. Friend class
C. Singleton class
COMPUTER PROGRAMMING
Q 49 Which of the following term is used for a function
defined inside a class?
A. Member Variable
B. Member function
C. Class function
D. Classic function
B. Member function
COMPUTER PROGRAMMING
Q 50 Which of the following concept of oops allows
compiler to insert arguments in a function call if it is
not specified?
A. Call by value
B. Call by reference
C. Default arguments
D. Call by pointer
C. Default arguments
COMPUTER PROGRAMMING
Q 51 Which of the following is an abstract data type?
A. int
B. double
C. string
D. class
D. class
COMPUTER PROGRAMMING
Q 52 Which of the following provides a reuse mechanism?
A. Abstraction
B. Inheritance
C. Dynamic binding
D. Encapsulation
B. Inheritance
COMPUTER PROGRAMMING
Q 53 Inheritance occurs when a class adopts all the traits
of
A. an object
B. a parent class
C. a variable
D. a function
B. a parent class
COMPUTER PROGRAMMING
Q 54 Which of the following statement is correct?
A. Encapsulation
B. Abstraction
C. Composition
D. Inheritance
C. Composition
COMPUTER PROGRAMMING
Q 56 Which of the following conceptsmeans wrapping up
of data and functions together?
A. Abstraction
B. Encapsulation
C. Inheritance
D. Polymorphism
B. Encapsulation
COMPUTER PROGRAMMING
Q 57 Which feature of OOP is exhibited by the function
overriding?
A. Polymorphism
B. Encapsulation
C. Abstraction
D. Inheritance
A. Polymorphism
COMPUTER PROGRAMMING
Q 58 Which feature can be implemented using
encapsulation?
A. Polymorphism
B. Overloading
C. Inheritance
D. Abstraction
D. Abstraction
COMPUTER PROGRAMMING
TOPIC PSEUDOCODE
A. 5 8 10 B. 1 3 6
C. 8 9 10 D. 3 6 9
A. 5 8 10
COMPUTER PROGRAMMING
integer a, b, c
set b = 4, c = 5
for (each a from 2 to 4)
print c
b=b-1
c=c+b
end for
COMPUTER PROGRAMMING
Q 60 integer value, n
set value = 1, n = 45
while(value less than equal to n)
value = value << 1
end loop
print value
A. 16 B. 32 C. 64 D. 36
C. 64
COMPUTER PROGRAMMING
integer value, n
set value = 1, n = 45
while(value less than equal to n)
value = value << 1
end loop
print value
COMPUTER PROGRAMMING
Q 61 Which of the following series will be printed by the given
pseudocode?
integer a, b, c
set b = 0, c = 0
for (each a from 1 to 5)
print c
b=b+1
c=c+b
end for
A. 5 4 3 2 1 B. 0 1 3 6 10 C. 2 5 8 9 10 D. 0 0 0 0 0
B. 0 1 3 6 10
COMPUTER PROGRAMMING
integer a, b, c
set b = 0, c = 0
for (each a from 1 to 5)
print c
b=b+1
c=c+b
end for
COMPUTER PROGRAMMING
Q 62 Predict the output of the following pseudo-code
integer a, b, c, d
set b = 10, c = 11
a=b–c
for (each c from 2 to a)
b = b + c + 10
b = b/2
end for
c=a+b+c
print a b c
A. -1 7 9 B. 2 5 8 C. -1 9 19 D. 5 10 13
C. -1 9 19
COMPUTER PROGRAMMING
integer a, b, c, d
set b = 10, c = 11
a=b–c
for (each c from 2 to a)
b = b + c + 10
b = b/2
end for
c=a+b+c
print a b c
COMPUTER PROGRAMMING
Q 63 What will be the output following pseudo code?
integer p,q,r
set p=2, q=5, r=9
if((q+9)<p || (q&p)<p)
r=(p&p)+q
else
p=r+p
end if
r=q+p
print p+q+r
A. 9 B. 14 C. 18 D. 27
B. 14
COMPUTER PROGRAMMING
integer p,q,r
set p=2, q=5, r=9
if((q+9)<p || (q&p)<p)
r=(p&p)+q
else
p=r+p
end if
r=q+p
print p+q+r
COMPUTER PROGRAMMING
Q 64 What will be the output of the following pseudo code for
input a=8 & b=9?
A. 56 B. 88 C. 72 D. 65
C. 72
COMPUTER PROGRAMMING
for input a=8 & b=9?
COMPUTER PROGRAMMING
Q 65 How many times the following loop be executed?
{
ch = b;
while(ch >= a && ch <= z)
ch++;
}
a) 0 b) 25 c) 26 d) 1
b) 25
COMPUTER PROGRAMMING
Q 66 What will be the value of s if n=127?
Read n
i=0,s=0
Function Sample(int n)
while(n>0)
r=n%l0
p=8^i
s=s+p*r
i++
n=n/10
End While
Return s;
End Function
a) 27 b) 187 c) 87 d) 120
c) 87
COMPUTER PROGRAMMING
if n=127?
Read n
i=0,s=0
Function Sample(int n)
while(n>0)
r=n%l0
p=8^i
s=s+p*r
i++
n=n/10
End While
Return s;
End Function
COMPUTER PROGRAMMING
TOPIC COMPUTER AIDED DESIGN
START
RETHINK
NO Do I want to
do this?
YES
Will it likely NO
end in
RETHINK
disaster?
YES
COMPUTER PROGRAMMING
PROGRAMMING