Computer Programming and CAD
Computer Programming and CAD
The structure and behavior of similar objects are 5. Objects are instances of a class created with
specified in a class. specifically defined data. Objects can
correspond to?
A. data and methods that control the data
B. represents only the behavior of a real-
world entity
C. collaboration of identified identities
D. real-world objects or an abstract entity
OO Design - In this stage, the objects are collaborated 9. It involves implementation of the conceptual
according to their intended association. After the model produced during object-oriented analysis.
association is complete, the design is also complete. A. Object Oriented Design
• Takes input from OO analysis B. Object Oriented Analysis
• High level abstractions (arrangements) from C. Object Oriented Programming
analysis are mapped onto classes D. all of these choices
• Association is formed between classes and 10. OOP Languages are built upon 4 principles,
objects what are they?
• Uses class diagrams to represent the A. Inheritance, Absolution,
structure of the system Polarization, Encapsulation
B. Abstraction, Inheritance,
OOP programming - the system is organized as a set Encapsulation, Polarization
of classes & objects C. Abstraction, Inheritance,
Polymorphism, Encapsulation
OOP Languages are built upon 4 principles D. Polymorphism, Encapsulation,
• Abstraction Incorporation, Abstraction
• Polymorphism
11. The capability of a class to derive properties
• Inheritance and characteristics from another class is called
• Encapsulation _____?
A. Abstraction
Abstraction - Denotes essential characteristics of an B. Polymorphism
object. It is a simplified specification that emphasizes C. Inheritance
only needed details D. Encapsulation
Encapsulation - the variables of a class will be hidden 12. It refers to providing only essential
from other classes, and can be accessed only through information about the data to the outside world,
the methods of their current class. hiding the background details or implementation.
A. Abstraction
Inheritance - represents a relationship where one B. Polymorphism
class is kind of another, a class will share its structure C. Inheritance
and behavior to another class. D. Encapsulation
Programming Language is an artificial language that 14. A computer program is also called computer
can be used to control the behavior of a machine, software, which can range from two lines to
particularly a computer. millions of lines of instructions. Computer
programming is also called ___________?
A. syntax coding
B. program coding
C. relative programming
Data type represents a type of data which you can D. software coding
process using your computer program. It can be
numeric, alphanumeric, decimal, etc. 15. It is a way to store some sort of information
for later use, and we can retrieve this information
by referring to a “word” that will describe this
information.
A. array
B. loop
C. variable
D. syntax
Operator is a symbol that tells the compiler or 20. Exception handling ensures that the flow of
interpreter to perform specific mathematical, relational the program doesn’t break when an exception
or logical operation and produce final result. occurs. Which of the following is a reason why
exception occurs?
A. invalid user input
B. missing semicolon
C. division by zero
D. all of these choices
Exception handling is the process of responding to • A GUI uses windows, icons, and
unwanted or unexpected events when a computer menus to carry out commands, such
program runs. It ensures that the flow of the program as opening, deleting, and moving
doesn’t break when an exception occurs.
files.
An Exception is an unwanted event that interrupts the • Although a GUI operating system is
normal flow of the program. When an exception occurs primarily navigated using a mouse, a
program execution gets terminated. keyboard can also be used via
keyboard shortcuts or the arrow keys.
Elements of a GUI
Button - A graphical representation of a button
that performs an action in a program when
pressed
Dialog box - A type of window that displays
additional information, and asks a user for
input.
Icon - Small graphical representation of a
program, feature, or file.
Menu - List of commands or choices offered to
the user through the menu bar.
Menu bar - Thin, horizontal bar containing the
labels of menus.
Types of exceptions
Ribbon - Replacement for the file menu and
toolbar that groups programs activities
• Checked exceptions - Also called compile-
together.
time exceptions, these errors occur when Tab - Clickable area at the top of a window that
we violate the rules present in a syntax. shows another page or area.
Terminator- missing semicolon, Missing Toolbar - Row of buttons, often near the top of
parenthesis. an application window, that controls software
For example, SQLException, IOException, functions.
ClassNotFoundException etc. Window - Rectangular section of the
computer's display that shows the program
currently being used.
• Unchecked Exceptions - Also called
runtime exceptions, these errors occur How does the user interact with a GUI?
during the run-time program execution after A pointing device, such as the mouse, is used
a successful compilation. Division error is to interact with nearly all aspects of the GUI.
one of the most common errors (runtime). It More modern (and mobile) devices also utilize
occurs due to the division by zero. a touch screen.
For example, ArithmeticException,
Structure in GUI Programming
NullPointerException, • Create the icons and widgets that are
ArrayIndexOutOfBoundsException etc. displayed to a user and organize them
inside a screen window.
Graphical User Interface (GUI) • Define functions that will process user
A GUI (graphical user interface) is a system of
interactive visual components for computer software. and application events.
• Associate specific user events with
specific functions.
GEAS
8 Computer Programming &CAD
• Start an infinite event-loop that processes 24. CAD is the use of computer software to
user events. When a user event happens, design and document a product’s design
the event-loop calls the function associated process. CAD stands for
A. Computer Aided Drawing
with that event.
B. Computer Aligned Design
C. Computer Aided Design
GUI programming is implemented using imported D. Computer and Design
modules which are often referred to as “toolkits.”
25. CAD is used to design, develop and optimize
products. CAD software
CAD A. allow the object to be viewed from
any angle, even from the inside looking
CAD or Computer Aided Design software was out.
introduced in the late 1960's to expedite engineering B. can be used to produce either two-
drawing process. CAD (Computer Aided Design) is the dimensional or three-dimensional
use of computer software to design and document a diagrams.
product’s design process. C. reduces design time by allowing
precise simulation rather than build
CAD software enables and test physical prototypes.
• Efficiency in the quality of design D. all of these choices
• Increase in the Engineer’s productivity
• Improve record keeping through better 26. In this CAD classification, a team of users
documentation and communication collaboratively works with each other's data and
see the changes other users make to the data
Types of CAD Software as they go.
• 2-Dimensional CAD (2D CAD) A. Single-file-mode systems
• 3-Dimensional CAD (3D CAD) B. Referenced-file-mode systems
C. Collaborative-mode systems
D. all of these choices
3D CAD can be further classified as:
• Wire-frame models 27. 3D CAD allows the creation of 3D images
• Surface models that are realistic. These images are called 3D
• Solid models models as they can be viewed and rotated in any
direction – X, Y or Z. This model has additional
Wire-frame models – they create skeleton like properties like weight, volume and density, just
models with lines and arcs. Since they appear to be like actual physical objects.
made of wires, and everything in the background is A. Wire-frame models
visible, they are called wire-frame models. B. Surface models
C. Solid models
Surface models – unlike wire frames, these models D. all of these choices
are created by joining 3D surfaces. Since nothing in
the background is visible, the surface models are quite
realistic.
13. Which of the following is true for 19. What will happen if the following C
variable names in C? code is executed?
A. They can contain alphanumeric characters 1. #include <stdio.h>
as well as special characters 2. int main()
B. It is not an error to declare a variable to be 3. {
one of the keywords(like goto, static) 4. int main = 3;
C. Variable names cannot start with a digit 5. printf("%d", main);
D. Variable can be of any length 6. return 0;
7. }
14. C preprocessors can have compiler A. It will cause a compile-time error
specific features. B. It will cause a run-time error
A. True C. It will run without any error and prints 3
B. False D. It will experience infinite looping
C. Depends on the standard
D. Depends on the platform 20. What will be the output of the
following C code?
15. Which of the following are C 1. #include <stdio.h>
preprocessors? 2. int main()
A. #ifdef 3. {
B. #define 4. signed char chr;
C. #endif 5. chr = 128;
D. all of the mentioned 6. printf("%d\n", chr);
7. return 0;
16. The C-preprocessors are specified with 8. }
_________ symbol. A. 128
A. # B. -128
B. $ C. Depends on the compiler
C. ”” D. None of the mentioned
D. &
-End-
17. A loop that never ends is referred to as
a(n)_________.
A. While loop
B. Infinite loop
C. Recursive loop
D. For loop