Computer Programming AdU
Computer Programming AdU
• ____________________________- It refers to languages Data type represents a type of data which you can process using
that use objects in programming. The main aim of OOP is your computer program. It can be numeric, alphanumeric,
to bind together the data and the functions that operate on decimal, etc.
them so that no other part of the code can access this data
except that function.
OBJECT MODEL
Early computer languages were used for mathematical & Different programming languages have different ways of typing
scientific operations, but their growth in size & complexity led to data types inside a program.
the evolution of languages to accommodate new features.
(Automation for business applications). Slowly, languages _______________ is a storage location and an associated
evolved, and even more, they moved closer to the problem symbolic name which contains some known or unknown
domain and further away from machines. The newer languages quantity or information, a value.
used classes & objects instead of subprograms & algorithms as
building blocks. _______________ is a symbol that tells the compiler or
interpreter to perform specific mathematical, relational or logical
The object model is based on three important concepts: operation and produce final result.
• _______________________
• _______________________ _______________________are expressions that ask the
• _______________________ program to determine if a variable is true or false. You may also
call it Boolean values.
____________________________ - It is a standard language
for specifying, visualizing, constructing, and documenting the A _______________allows us to execute a statement or group
artifacts of software systems. of statements multiple times.
• UML is not a programming language but tools can
be used to generate code in various languages using An _______________ is a data structure, which can store a
UML diagrams fixed-size collection of elements of the same data type.
• UML diagrams are not only made for developers but
_______________ are self-contained modules of code that
also for business users, common people, and anybody
accomplish a particular task.
interested to understand the system.
Here are all the parts of a function −
OO Analysis - is a method of analysis that examines the
Return Type − A function may return a value. The return_type
requirements from the perspective of the classes & objects
is the data type of the value the function returns.
found in the problem domain.
Function Name − This is the actual name of the function. The
• This is the first step in developing an object-oriented
function name and the parameter list together constitute the
system, here we examine the real-world environment
function signature.
in which the system will operate.
Parameter List − A parameter is like a placeholder. When a
• Focus on what systems are supposed to do function is invoked, you pass a value as a parameter.
• Created using user stories or use cases. Function Body − The function body contains a collection of
statements that defines what the function does.
OO Design - In this stage, the objects are collaborated
according to their intended association. After the association is List of Programming Languages
complete, the design is also complete. • Python is an advanced programming language that is
• Takes input from OO analysis interpreted, object-oriented and built on flexible and
• High level abstractions (arrangements) from analysis robust semantics.
are mapped onto classes • Java is a general-purpose, object-oriented, high-level
• Association is formed between classes and objects programming language with several features that make
• Uses class diagrams to represent the structure of the it ideal for web-based development.
system • JavaScript is not related to Java. It is a client-side
programming language that runs inside a client
OOP programming - the system is organized as a set of browser and processes commands on a computer
classes & objects rather than a server.
1|P age
Prepared by: Engr. Rex Jason H. Agustin
ADAMSON UNIVERSITY Computer Programming
• C Language is a structure-oriented, middle-level A. The problem domain is complex it requires that non-functional
programming language mostly used to develop low- requirements should be identified.
level applications. B. The user may have a vague idea of what they expect from a
• C++ is a general purpose, object-oriented, middle-level software
programming language and is an extension of C C. Developers expect requirements in a specific format
language, which makes it possible to code C++ in a “C D. all of these choices are correct
style”.
• C# is a multi-paradigm programming language that 2. In software development, requirements must be identified in
features strong typing, imperative, declarative, a clear and concise manner to avoid confusion and any
functional, generic, object-oriented and component- unexpected outputs. What is the nature of a requirements?
oriented disciplines. A. The requirements can be long and lengthy pieces of
• Swift is Apple’s newest open-source, multi-paradigm information
programming language for iOS and OS X apps. B. They define functions and functionality within and from the
• Ruby is an open-sourced, object-oriented scripting software system therefore they are not supposed to be
language that can be used independently or as part of modifiable.
the Ruby on Rails web framework. C. The requirements can be obvious or hidden, known or
• PHP is an open-source scripting language designed for unknown, expected or unexpected from client’s point of view.
creating dynamic web pages that effectively work with D. all of these choices are correct
databases.
• SQL is a database query language (not a development 3. Functional programming means using functions to the best
language) that allows for adding, accessing and effect for creating clean and maintainable software. The ideal in
managing content in a database. functional programming is what is known as
A. pure functions
_____________________is the process of responding to B. anticipated functions
unwanted or unexpected events when a computer program C. paradigm functions
runs. It ensures that the flow of the program doesn’t break when D. structured functions
an exception occurs.
4. OOP focuses on the objects that developers want to
An ____________________is an unwanted event that manipulate rather than the logic required to manipulate them.
interrupts the normal flow of the program. When an exception This approach to programming is well-suited for programs that
occurs program execution gets terminated. are?
A. small, concise, and easily managed
B. large, complex and actively updated or maintained
C. data are modifiable outside the function
D. all of these choices
Review Questions 10. OOP Languages are built upon 4 principles, what are they?
A. Inheritance, Absolution, Polarization, Encapsulation
1. Reasons for software complexity: B. Abstraction, Inheritance, Encapsulation, Polarization
2|P age
Prepared by: Engr. Rex Jason H. Agustin
ADAMSON UNIVERSITY Computer Programming
C. Abstraction, Inheritance, Polymorphism, Encapsulation programming language may be considered preferable in GUI
D. Polymorphism, Encapsulation, Incorporation, Abstraction programming.
A. PHP & Javascript
11. The capability of a class to derive properties and B. SQL and Rails
characteristics from another class is called _____? C. Python and SQL
A. Abstraction C. Inheritance D. C# and Java
B. Polymorphism D. Encapsulation
24. Kevin has implemented a While loop within his Java
12. It refers to providing only essential information about the program. Assess the code statement below and select which
data to the outside world, hiding the background details or answer best summarizes the output Kevin will experience once
implementation. the while statement is executed. int count = 1; while (count
A. Abstraction C. Inheritance <=25) { System.out.println (count); Count = count –1; }
B. Polymorphism D. Encapsulation System.out.println ("Done");
A. The while loop will execute 25 times and print the numbers 1
13. In Encapsulation, the variables or data of a class are hidden thru 25 and finish with the printing of Done.
from any other class and can be accessed only through any B. The while loop will execute 25 times and print the numbers
member function of their class in which they are declared. As in 25 down to 1 and finish with the printing of Done.
encapsulation, the data in a class is hidden from other classes, C. The while statement will not function correctly due to a
so it is also known as _____? missing semicolon(;) after the statement while (count <=25)
A. data freezing C. data encapsuling D. The while statement will execute by counting down from 1
B. data protecting D. data hiding until infinity and result in an infinite loop.
14. A computer program is also called computer software, which 25. Consider the following code that will assign a letter grade of
can range from two lines to millions of lines of instructions. ‘A’, ‘B’, ‘C’, ‘D’, or ‘F’ depending on a student’s test score.
Computer programming is also called ___________? if(score >= 90) grade = 'A';
A. syntax coding C. relative programming if(score >= 80) grade = 'B';
B. program coding D. software coding if(score >= 70) grade = 'C';
if(score >= 60) grade = 'D';
15. It is a way to store some sort of information for later use, and else grade = ‘F’
we can retrieve this information by referring to a “word” that will A. This code will work correctly only if grade >=60
describe this information. B. This code will work correctly only if grade < 70
A. array C. variable C. This code will work correctly in all cases
B. loop D. syntax D. This code will work correctly only if grade < 60
21. Exception handling helps ensure this does not happen when
an exception occurs. Which of the following are the types of
exceptions?
A. checked and unchecked exceptions
B. compile-time and run-time exceptions
C. both a and b
D. none of these choices
22. It is very difficult for a compiler to find out this error because
it cannot point out the exact line at which this particular error
occurs.
A. run-time exceptions
B. compile-time exceptions
C. both a and b
D. none of these choices
3|P age
Prepared by: Engr. Rex Jason H. Agustin