You are on page 1of 12

GEAS

Computer Programming & CAD 1

COMPUTER PROGRAMMING Review Questions

What is the purpose of a software? 1. Reasons for software complexity:


• Perform complex task/calculation A. The problem domain is complex it
• Ease complexity and reduce human error requires that non-functional requirements
should be identified.
• Reduce human intervention and perform
B. The user may have a vague idea of
monotonous work what they expect from a software
C. Developers expect requirements in a
Software complexity specific format
• Problem domain complexity D. all of these choices are correct
• Communication between user and
developers 2. In software development, requirements must
• Volatile nature of requirements be identified in a clear and concise manner
• Unpredictable behavior of software to avoid confusion and any unexpected
outputs. What is the nature of a
requirements?
• Functional Programming - means using A. The requirements can be long and
functions to the best effect for creating clean and lengthy pieces of information
maintainable software. B. They define functions and functionality
within and from the software system
• Object Oriented Programming (OOP) - It refers therefore they are not supposed to be
modifiable.
to languages that use objects in programming. C. The requirements can be obvious or
The main aim of OOP is to bind together the data hidden, known or unknown, expected or
and the functions that operate on them so that no unexpected from client’s point of view.
other part of the code can access this data except D. all of these choices are correct
that function.
3. Functional programming means using
An object represents an individual, identifiable item, functions to the best effect for creating
unit or entity, either real or abstract, with well-defined clean and maintainable software. The
role in the problem domain. ideal in functional programming is what is
An object has the following characteristics: known as
A. pure functions
B. anticipated functions
C. paradigm functions
D. structured functions

4. OOP focuses on the objects that developers


want to manipulate rather than the logic
required to manipulate them. This
approach to programming is well-suited for
programs that 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
Classes are user-defined data types that act as the
blueprint for individual objects, attributes and
methods.
GEAS
2 Computer Programming &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

6. A class is a user-defined data type. It consists


OBJECT MODEL of data members and member functions,
Early computer languages were used for which can be accessed and used by
mathematical & scientific operations, but their growth creating an instance of that class. It
in size & complexity led to the evolution of languages represents?
to accommodate new features. (Automation for A. basic unit of Object-Oriented
business applications). Slowly, languages evolved, Programming and represents the real-life
and even more, they moved closer to the problem entities
domain and further away from machines. The newer B. the set of properties or methods that are
languages used classes & objects instead of common to all objects of one type
subprograms & algorithms as building blocks. C. only essential information about the
The object model is based on three important data
concepts: D. wrapping up of data under a single unit,
• OO Analysis the variables or data are hidden from any
• OO Design other
• OO Programming
7. UML is a standard language for specifying,
Unified Modelling Language (UML) - It is a standard visualizing, constructing, and documenting the
language for specifying, visualizing, constructing, and artifacts of software systems. UML stands for
documenting the artifacts of software systems. A. Undying Model Language
• UML is not a programming language but B. Unified Methodology Language
C. United Modification Language.
tools can be used to generate code in
D. Unified Modeling Language
various languages using UML diagrams
• UML diagrams are not only made for 8. What is the main difference between object-
developers but also for business users, oriented analysis and other forms of analysis in
common people, and anybody interested to developing a software?
understand the system. A. requirements are organized around
objects
B. requirements integrate both data and
OO Analysis - is a method of analysis that examines
functions
the requirements from the perspective of the classes
C. they are modelled after real-world
& objects found in the problem domain.
objects that the system interacts with
• This is the first step in developing an object-
D. all of these choices
oriented system, here we examine the real-
world environment in which the system will
operate.
• Focus on what systems are supposed to do
• Created using user stories or use cases.
GEAS
Computer Programming & CAD 3

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

Polymorphism - is the ability of an object to be 13. In Encapsulation, the variables or data of a


displayed in more than one form. class are hidden from any other class and can
be accessed only through any member function
Computer Program of their class in which they are declared. As in
• A computer program is a sequence of encapsulation, the data in a class is hidden from
instructions written using a Computer other classes, so it is also known as _____?
Programming Language to perform a A. data freezing
B. data protecting
specified task by the computer.
C. data encapsuling
• A computer program is also called a D. data hiding
computer software, which can range from
two lines to millions of lines of instructions.
• Computer program instructions are also
called program source code and computer
programming is also called program
coding.
GEAS
4 Computer Programming &CAD

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

16. Loops are common types of iterations in


which a program performs certain actions an
Different programming languages have different ways infinite number of times until a new condition is
of typing data types inside a program. met. Loops also make it possible for programs to
Example in C programming: do something else while a given process is
running.
A. true
B. false
C. incomplete information
D. cannot be validated

17. A programming language used for artificial


intelligence (AI) and machine learning.
A. JAVA
B. PYTHON
Variable is a storage location and an associated C. C#
symbolic name which contains some known or D. PHP
unknown quantity or information, a value.
18. A programming language used in areas such
This program has two additional statements where we as data analysis and big data mining.
are storing 10 in variable a and 20 is being stored in A. JAVASCRIPT
variable b B. C++
C. RUBY
D. SQL

19. It’s a multi-paradigm programming language


for iOS.
A.PHP
B. SWIFT
C. RUBY RAILS
D. C
GEAS
Computer Programming & CAD 5

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

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
Conditional statements are expressions that ask the
program to determine if a variable is true or false. You 23. While there are several different visual
may also call it Boolean values. programming languages with their own unique
advantages for the development of a graphical
user interface design, this programming
language may be considered preferable in GUI
programming.
A. PHP & Javascript
B. SQL and Rails
C. Python and SQL
D. C# and Java
GEAS
6 Computer Programming &CAD

A loop statement allows us to execute a statement or List of Programming Languages


group of statements multiple times. • Python is an advanced programming
language that is interpreted, object-
oriented and built on flexible and
robust semantics.
• Java is a general-purpose, object-
oriented, high-level programming
language with several features that
make it ideal for web-based
development.
An array is a data structure, which can store a fixed- • JavaScript is not related to Java. It is
size collection of elements of the same data type. a client-side programming language
that runs inside a client browser and
processes commands on a computer
rather than a server.
• C Language is a structure-oriented,
middle-level programming language
mostly used to develop low-level
applications.
• C++ is a general purpose, object-
oriented, middle-level programming
language and is an extension of C
language, which makes it possible to
code C++ in a “C style”.
Functions are self-contained modules of code that • C# is a multi-paradigm programming
accomplish a particular task. language that features strong typing,
imperative, declarative, functional,
Here are all the parts of a function − generic, object-oriented and
Return Type − A function may return a value. The component-oriented disciplines.
return_type is the data type of the value the function • Swift is Apple’s newest open-source,
returns.
multi-paradigm programming
Function Name − This is the actual name of the
function. The function name and the parameter list language for iOS and OS X apps.
together constitute the function signature. • Ruby is an open-sourced, object-
oriented scripting language that can be
Parameter List − A parameter is like a placeholder. used independently or as part of the
When a function is invoked, you pass a value as a Ruby on Rails web framework.
parameter. • PHP is an open-source scripting
Function Body − The function body contains a
language designed for creating
collection of statements that defines what the function
does. dynamic web pages that effectively
work with databases.
• SQL is a database query language
(not a development language) that
allows for adding, accessing and
managing content in a database.
GEAS
Computer Programming & CAD 7

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.

Solid models – they are considered to be the most


useful CAD models. Although they appear to be the
same as surface models, they also have additional
properties like weight, volume and density, just like
actual physical objects.
GEAS
Computer Programming & CAD 9

CAD software classification - in terms of their Three types of selections


operating parameters: • one click – individual objects
• Single-file-mode systems • window selection
• Referenced-file-mode systems • cross selection
• Collaborative-mode systems
Objects in CAD
Single-file-mode systems -This type of CAD
software allows only a single user to work on a single Lines - With the Line command you can draw a
file at a time. simple line from one point to another.

Referenced-file-mode systems - In this type of CAD


software, users can work on their own files with the
files of other users attached as a background. This
enables users to leverage other users' work as
background data.
Polyline - object may be composed of a
Collaborative-mode systems - These CAD systems number of segments which form a single
take the referenced-mode system to the next level. object.
They allow a team of users to collaboratively work
with each other's data and see the changes other
users make to the data as they go.

Designing using a CAD Software


• Application menu: New, open, save, import,
export, print
• Quick access toolbar: User can save tools Rectangle - used to draw a rectangle whose
that they often use sides are vertical and horizontal.
• Info Center: Ask a question, find out answers
from Autodesk community
• Ribbon: Main menus – Home, Insert,
Annotate, View, Manage
• Ribbon tab
• Ribbon view: User can minimize and
Polygon - can be used to draw any regular
maximize the ribbon polygon from 3 sides up to 1024 sides
• File tab: Navigate files and create and open
files
• Drawing area/graphic area: Main drawing
space
• View cube: User can change the view, top,
front, 3D, or more
• Navigation bar: Zoom in and out, pan, zoon Donut - draws a solid donut shape, actually it's
to all, and more just a closed polyline consisting of two arc
segments which have been given a width.
• Command box: Can type commands and
see the previous commands
• Layout tab: Can see model space and print
spaces
• Status bar: Can set grid, snaps, scales, and
more
GEAS
10 Computer Programming &CAD

Circle - used to draw circles. Dimensions allow exact values to be shown on


a drawing which can then be used for
construction.

Arc - allows you to draw an arc of a circle.

Spline - a smooth curve that is fitted along a number


of control points

Ellipse - command gives you a number of different


creation options.

• The Linear dimension tool measures


horizontal or vertical distances.
• The Aligned dimension tool measures
the length along an object.
• The Angular dimension tool measures
Region - a surface created from objects that form a an angle between two objects.
closed shape, known as a loop.
• The Arc Length dimension tool
measures the length of an arc.
• The Radius dimension tool measures
the radius of an arc or circle.
• The Diameter dimension tool
measures the diameter of an arc or
Object snaps provide a way to specify precise circle.
locations on objects whenever you are prompted for a • The Jogged dimension tool measures
point within a command. the radius of an arc or circle but places
the leader line in an alternative place
(inferred point) to the arc or circles
centre point.
• Ordinate dimensions are used to
locate the X or Y coordinate value of a
point
GEAS
Computer Programming & CAD 11

7. scanf() is a predefined function


in______header file.
Answers to this exam is available at ERP A. stdlib. h
app B. ctype. h
C. stdio. h
1. Which of the following cannot be a D. stdarg. h
variable name in C?
A. volatile 8. Which command will stop an
B. true infinite loop?
C. friend A. Alt - C
D. export B. Shift - C
C. Esc
2. What is short int in C programming? D. Ctrl – C
A. The basic data type of C
B. Qualifier 9. Jay is considering adding a
C. Short is the qualifier and int is the basic data repetition statement within his
type Java programming final project.
D. All of the mentioned Jay is unsure of the number of
times each loop needs to execute.
3. Which of the following declaration is not Analyze the conditional
supported by C language? statements below and select
A. String str; which statement best fits the need
B. char str; identified by Jay within his
C. float str = 3e2; programming.
D. Both String str; & float str = 3e2; A. While loop
B. If-Else
4. Which keyword is used to prevent any C. For loop
changes in the variable within a C D. Switch statement
program?
A. immutable 10. Who is the father of C language?
B. mutable A. Steve Jobs
C. const B. James Gosling
D. volatile C. Dennis Ritchie
D. Rasmus Lerdorf
5. What is an example of iteration in C?
A. for 11. Which of the following is not a
B. while valid C variable name?
C. do-while A. int number;
D. all of the mentioned B. float rate;
C. int variable_count;
6. Property which allows to produce D. int $main;
different executable for different
platforms in C is called? 12. Which is valid C expression?
A. File inclusion A. int my_num = 100,000;
B. Selective inclusion B. int my_num = 100000;
C. Conditional compilation C. int my num = 1000;
D. Recursive macros D. int $my_num = 10000;
GEAS
12 Computer Programming &CAD

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

18. What will be the output of the following


C code?
1. #include <stdio.h>
2. int main()
3. {
4. int y = 10000;
5. int y = 34;
6. printf("Hello World! %d\n", y);
7. return 0;
8. }
A. Compile time error
B. Hello World! 34
C. Hello World! 1000
D. Hello World! followed by a junk value

You might also like