Fundamentals of Programming
Fundamentals of Programming
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
A. Procedural programming
C. Structured programming
D. Sequential programming
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 ______.
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++?
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++?
B. Tell to the compiler to preprocess the file before the actual compilation
starts.
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;
}
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