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

Fundamentals of Programming

The document is a review guide for a Fundamentals of Programming exit exam, covering algorithm design, programming basics, and program flow control. It includes questions and explanations on topics such as programming paradigms, C++ syntax, data types, and flowchart symbols. Key concepts include the definition of algorithms, the characteristics of programming languages, and the use of pseudo code.

Uploaded by

Gulelat Y
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Fundamentals of Programming

The document is a review guide for a Fundamentals of Programming exit exam, covering algorithm design, programming basics, and program flow control. It includes questions and explanations on topics such as programming paradigms, C++ syntax, data types, and flowchart symbols. Key concepts include the definition of algorithms, the characteristics of programming languages, and the use of pseudo code.

Uploaded by

Gulelat Y
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Fundamentals of

Programming
Exit Exam Review
Part I – Algorithm Design
• Understand programming as problem solving activity.
• Understand different programming paradigms
• Learn the meaning of algorithm.
• Know the generation of computer programming
• Understand the quality attributes of a computer program
• Know symbols used in flowcharting.
• Learn algorithm representation using pseudo code and flowchart.
1. Which one of the following programming language
considered as second generation language?

A. Assembly language
B. Procedural language
C. Machine language
D. Object oriented programming language

Explanation : Assembly language is second generation


while machine language is first generation
2. Machine specific or dependent languages are ______.

A. Low level programming Languages

B. Basic and Java programming

C. High level programming Languages

D. C and C++ programming

Explanation: Low level programming languages are machine


dependent while the others are high level programming
languages and they are machine independent.
3. The process of writing a program in small
independent parts called modules is ___.

A. Procedural programming

B. Object oriented programming

C. Structured programming

D. Sequential programming

Explanation: It is structured programming this can be


considered as subset of procedural programming and avoid the
reliance on use of Go to or Jump statements to reuse code.
4. A program should be in a way that can be modified
or upgraded when the need arises. This property
best describe by ______.
A. Portable
B. Reliable
C. Efficient
D. Maintainable
Explanation: It is maintainable
• Portable- usable in another type of computer
• Efficient – optimal use of resources
• Reliable – Do what is expected and handle exception
5. A detailed flow chart is also known as _________.

A. Stack flow chart


B. Macro flow chart
C. Micro flow chart
D. Union flow chart

Explanation: A detailed flowchart or a flowchart with more


details is called as micro flowchart. It represents all the
components of the algorithm that is followed.
6. What does a rectangle represent in a flowchart?

A. Process
B. Decision

C. Start/End

D. Connector
Explanation:
Process – rectangle
Decision – Diamond
Input/output – Parallelogram
etc
7. Machine specific or dependent languages are ______.

A. Low level programming Languages

B. Basic and Java programming

C. High level programming Languages

D. C and C++ programming


Explanation:
Low level programming languages like machine language
and assembly language are machine dependent while the
others are high level programming languages
8. What is the purpose of pseudo code?

A. Represents a specific programming language

B. Provides a high-level description of a program

C. Executes and compiles directly

D. Used for debugging only

Explanation:
Pseudo code provides a high level description of a program logic. No specific
programming language syntax used here and can’t be executed.
9. _____ converts source code written in high level programming
language into object code.

A. Assembler
B. Interpreter
C. Compiler
D. B and C

Explanation:
Interpreter converts line by line and execute.
Compiler converts all lines once and then execute.
Both work for high level programming languages.
10. Which one of the following processes give final executable
code?

A. Preprocess
B. Compile
C. Linking
D. Loading

Explanation:
Linker completes the object code created through compilation process by linking
it with any object code of any library module that the program may have refered.
Part II – Programming Basics
• Understand C++ program basic syntax.
• Understand about variables, constants and data types.
• Learn the header files used in C++.
• Know the operators supported and their precedence in C++.
• Understand the
1. What is C++?

A. C++ is pure object oriented programming language

B. C++ is a procedural programming language

C. C++ supports both procedural and object oriented programming language

D. C++ is a functional programming language

Explanation:
C++ supports both procedural (step by step instruction) and object
oriented programming (using the concept of classes and objects).
2. Which of the following is the correct syntax of
including a user defined header files in C++?

A. #include [userdefined]

B. #include “userdefined”

C. #include <userdefined.h>

D. #include <userdefined>

Explanation:
C++ uses double quotes to include a user-defined header file. The correct syntax of
including user-defined is:
#include “user_defined_name”.
3. Which one of the following is not true about
preprocessors in C++?

A. Preprocessors directives always start with #.

B. Tell to the compiler to preprocess the file before the actual compilation

starts.

C. Preprocessor directives end with semicolon.

D. Number of preprocessor directive supported by C++

Explanation:
Preprocessor directives are not c++ statements, so it doesn’t end with
semicolon. The other statements are true about preprocessor directives.
3. The expression sizeof(int) gives _____ in 64-bit machine.

A. 8 bits

B. 8 byte

C. 2 bites

D. 4 byte
Explanation:
• Since it is integer data type referred in the question, it always return 4 byte in
both 32-bit or 64 bit machine. But if it was sizeof (int*) will return
• a value 4 because the address value of memory location on a 32-bit machine is 4-byte
integers.
• a value of 8 as on a 64-bit machine the address of a memory location are 8-byte integers.
4. Which operator used to join multiple conditions in C+
+?

A. &&
B. ||
C. &
D. |
E. A and B
F. C and D
G. All

Explanation:
&& (logical and) and ||(logical or) used to join multiple conditions.
But & (Bitwise and) and |( Bitwise or) and Bitwise Operators are the operators
that are used to perform operations on the bit level on the integers.
5. Identify the invalid identifier in C++ program.

A. Sutudent_name

B. Age18

C. _totalMarks

D. new
Explanation:
New is key word in C++ since it is an object oriented programming
language. And keywords are not allowed as valid identifier names.
Use of other special character other than _( under score) is not allowed.
Use of numbers at the beginning of an identifier name is not allwoed.
6. The header file used in C++ to add the getch( ) function in a
program is ______.

A. iostream
B. string.h
C. conio.h
D. math
E. No need to have header file.

Explanation:
<conio.h> is console input output header file used to use
getch(), clrscr(), gotoxy(), ….
7. What is the out put of the following code fragment?
#include <iostream>
using namespace std;
int main()
{ int a = 8;
int b = 5;
int c = a & b;
cout << “Answer =” << c;
return 0;
}

A. 0
B. 13
C. 85
D. None of the above
Explanation:
The output is 0 because it is bitwise and operator. Numbers will be converted
to binary and computed bit by bit for digits in the same position.
8. What is the out put of the following code fragment?
# include <iostream>
int main (void)
{
cout << "Hello World\n";
return 0;
}

A. The compiler displays Hello World.

B. The compiler generates error cout not declared in this scope.

C. The compiler generates warning because relevant header file not added.

D. The compiler generates error because the return type of main function is int.
Explanation:
• The compiler generates error ‘cout not declared in this
scope’ because using namespace std not given or std:: not
used with cout statement.
9. What will be the value of y given
int k = 5; and int y = k++ + 20; ?

A. 25

B. 26

C. Generates error.

D. 26.0

Explanation:
The value of y will be 25 because postfix operator is evaluated after
assignment. If it was prefix like ++k the result would be different
because prefix evaluated before assignment.
10. What is the value of RED in the enumerated constant given
below?
enum MYCOL {GREEN=50, RED, BLUE =70, YELLOW};

A. 60

B. 51

C. Null

D. 50

Explanation:
The value for RED will be 51. If the value is not given explicitly it
increments by 1 from the previous. If value not given for all items in
the list the value will be 0,1, …
Part III – Program Flow Control
• Understand programming as problem solving activity.
• Understand

You might also like