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

XII-computer notes Chapter 1

The document contains multiple-choice questions (MCQs) and answers related to the concepts of computer programming, including programming languages, error types, and programming project steps. It discusses the differences between low-level and high-level languages, as well as the roles of compilers, interpreters, and assemblers. Additionally, it defines key programming concepts such as problems, programs, and the characteristics of programming languages.

Uploaded by

jamil sulaiman
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

XII-computer notes Chapter 1

The document contains multiple-choice questions (MCQs) and answers related to the concepts of computer programming, including programming languages, error types, and programming project steps. It discusses the differences between low-level and high-level languages, as well as the roles of compilers, interpreters, and assemblers. Additionally, it defines key programming concepts such as problems, programs, and the characteristics of programming languages.

Uploaded by

jamil sulaiman
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Chapter 1: Concept of Computer Programming

MCQs
1. _______ is a relatively simple high level language that was developed to help students
learn programming
a) BASIC
b) COBOL
c) C
d) All of the above
2. In preparing a program one should first
a) Plan the solution
b) Document the program
c) Code the program
d) Define the program
3. During the development of a program drawing a flowchart is a means to
a) Plan the solution
b) Define the problem
c) Code the program
d) Analyze the problem
4. Which of the following is used to design a program using English like statements?
a) Algorithm
b) Program flowchart
c) Control structure
d) None of the above
5. Compilers are interpreters are types of _____
a) Programming language
b) Language translators
c) Alpha testers
d) Application generators
6. Which of the following type of error is detected by a language translator?
a) Program design
b) Logic
c) Syntax
d) Both b and c
7. You test a program to find which of the following?
a) Flowchart errors
b) Logic errors
c) Algorithm errors
d) Syntax errors
8. In preparing a program desk checking and translation are example of
a) Coding
b) Testing
c) Planning
d) Documenting
9. Which of the following is not one of the steps in a programming project?
a) Planning the solution
b) Coding the program
c) Testing the program
d) Selecting the hardware
10. In preparing a program desk checking and translation are examples of
a) Coding
b) Planning
c) Testing
d) Documenting
11. Comments in the program itself are part of
a) Compiling
b) Translating
c) Linking
d) Documenting
12. The first high level language to eb introduced was
a) COBOL
b) FORTRAN
c) Pascal
d) BASIC
13. The language named for a French mathematician is
a) C
b) Pascal
c) FORTRAN
d) COBOL
14. Specifying the kind of input, processing and output required for a program occurs when
a) Planning the solution
b) Coding the program
c) Flowcharting the problem
d) Defining the problem
15. Error messages provided by a compiler are called
a) Bugs
b) Translations
c) Diagnostics
d) Mistakes
16. After stating a solution in algorithm your would next
a) Test the program
b) Implement the program
c) Code the program
d) Translate the program
17. Software that translates assembly language into machine language is a
a) Binary translator
b) Assembler
c) Compiler
d) Link loader
18. A standardized business language is
a) Pascal
b) COBOL
c) BASIC
d) FORTRAN
19. In developing a program documentation should be done
a) As the last step
b) Only to explain errors
c) Throughout the process
d) Only during the design phase
20. Which of the following language is frequently used in object oriented programming\
a) COBOL
b) C
c) C++
d) Pascal
21. Popular object oriented languages are
a) Pascal, COBOL
b) C++, FORTRAN
c) C++, Smalltalk
d) C)OBOL, BASIC

Q1. What is a problem.


Ans. Problem:-A problem is a situation preventing something from being achieved. A problem
can be a task, a situation or any other thing. In simple language, a problem is a question which
requires an answer or a solution. In programming a problem is considered as a matter which is
difficult to solve, it is a complex task or routine

Q2. What is a program?


Ans. A program is a set of instructions that computer must follow in order to process data into
information. The instructions consist of statement used in a programming language. In order
words, a program is the set of instruction which tells the computer what to do .A computer
program is a sequence or set of instructions in a programming language for a computer to
execute. Such as BASIC, C, C++ etc.

Q3: Define Computer Program?


Ans. Computer Program: -A computer program is a set of instructions that is executed by a
computer to perform a specific task. Computer processes instructions in binary language i.e.
0sand 1s.It is very difficult to write in 0s and 1s, so that the programmer uses programming
languages to write programs to communicate with the computer to perform specific tasks.
Programming languages have a specific set of words called syntax and reserve words and data
type to create those instructions. Specialized programs such as translators i.e compiler, assembler
or interpreter are used to convert set of syntaxes into machine readable code i.e. 0sand 1s. A
computer programmers write programs using computer languages like C, C++, Python, Java etc

Q4. What is programming language.


Ans. A language we mean to communicate, via human speech or written symbols. A computer
programming language is a set of symbols, rules of syntax or grammar governing how those
symbols are combined. Programming languages have very limited vocabularies and very specific
functions. Using computer programming language, a programmer writes programs, and directs
the computer to perform its task. Examples of programming languages are C, C++, JAVA , etc.

Q5. Characteristics of programming languages.


Ans. There are many different programming languages, each one designed to solve certain types
of problems, all of them have the basic function of directing the operations of a computer.
Therefore, certain general classes of instructions are present in every programming language,
which are as follows.
Input / Output Instructions:- These instructions direct the computer to “read from” or “write
to” a peripheral device (disk drive, or printer, monitor etc)
Computation Instructions:- These instructions direct the computer to perform arithmetic
operations (add, subtract, multiply, divide and raise a number to a power).
Example pay=hours x rate
Control Instruction:- These instructions can alter the sequence of the program’s execution or
terminate execution. Example in an accounts receivable program different sequences of
instructions are executed for customers who pay on time and for those who pay after the due
date.
Assignment Instructions:- These instruction transfer data internally from one RAM location to
another. Example a data item may be copied from one location to another.

Q6: Write down the differences between low-level and high-level languages.
Low Level Language High Level Language
In low level language machine codes (0 and 1) are In high level language English like words are used as
used as an instruction to the computer. an instruction to the computer.
The execution of programs is quite fast. The execution of programs is not very fast.
Instructions are directly understood by the CPU and Instruction are not directly understood by the CPU
direct access to memory and less memory efficient.
No need to translate program. In case of assembly Translation of program is required, compiler or
language assembler is required. interpreter.
One type of machine code cannot run on all The high level code can be translated to required
machines so it is not portable language machine code so it is portable language
Coding and maintenance are not easy Coding and maintenance are easy
The programs written in low level languages are The programs written in high level languages are
machine dependent and are difficult to modify. machine independent and are easy to modify.
The examples of low-level languages are:
The examples of high-level languages are: BASIC,
Machine language
FORTRAN, COBOL, PASCAL, C languages etc.
Assembly language

Q7. Define the steps in a programming project.


Ans. Define the Problem:-Specifically, the task of defining the problem consists of identifying
what you know (input-given data), and what you want to obtain (output-the result). During this
step, It is more important to understand described problem
Planning the Solution:-Two common ways of planning the solution to a problem are to draw a
flowchart and to write pseudocode / Algorithm, or possibly both.
a) A flowchart is a pictorial representation of a step-by-step solution to a problem. It is a
map of what your program is going to do and how it is going to do it.
b) Pseudocode / Algorithm is an English-like nonstandard language that states the solution
with more precision. Pseudocode/Algorithm permits to focus on the program logic.
Coding the Program:-The next step is to code the program. Coding is the process of writing
instructions in a programming language. A programming language is a set of rules that provides a
way of instructing the computer what operations to perform. Coding the program will translate
the logic from the flowchart or pseudocode or some other tool-to a programming language. There
are many programming languages: BASIC, COBOL, Pascal, FORTRAN, and C are some
examples.
Testing the Program:- After the program has been coded comes the stage to check whether the
program works or not?
a) Desk-checking. This phase, similar to proofreading, in desk-checking simply sit down
and mentally trace, or check, the logic of the program to attempt to ensure that it is error-
free and workable.
b) Translating. A translator is a program that
(1) checks the syntax of your program to make sure the programming language was used
correctly, generally there are three types of errors. syntax error which mainly occurred
due to the mistakes while typing or do not follow the syntax rules of the specified
programming language, run time error exists during the execution-time even after the
successful compilation known as run-time error and logical error is an error that leads to
an undesired output, then translates program into a form the computer can understand.
Programs are commonly translated by a compiler or interpreter. A compiler translates
entire program at one time and interpreter translate line by line.
c) Debugging. Debugging means detecting, locating, and correcting bugs (mistakes),
usually by running the program. These bugs are logic errors.
Documenting the Program:-Documenting is an ongoing, necessary process, although, as many
programmers are. Documentation is a written detailed description of the programming cycle and
specific facts about the program. Typical program documentation materials include the origin
and nature of the problem, a brief narrative description of the program, logic tools such as
flowcharts and pseudocode, data-record descriptions, program listings, and testing results.

Q8. What is translator? What is the difference between a compile, interpreter and
assembler?
Ans. Programming Language Translator :- A program written in high-level language by the
programmer is called as source code. To convert the source code into machine code, translators
are needed. A translator takes a program written in source language as input and converts it into a
program in target language as output. Translator also detects and reports the error during
translation, whenever the programmer does not follow the rules of syntax of source language.
Compilers, interpreters, and assemblers are the most famous programming language translators
COMPILER: Compiler is a program bat translates the high, level language program into
machine language. Complier translates the whole Program at a time at once before it executed
and makes a separate object file for the translated program. Translated program can he used
multiple time without the need of retranslation of source code. Each high-level language has its
own compiler.
INTERPRETER: Interpreter is a language translator program, which converts high level
program into machine language. It translates one instruction at a time. Interpreter does not make
any object file and it translates the program every time when executed. An interpreter is faster
than a compiler as it immediately executes the codes.

ASSEMBLER: An assembler is a translator that converts assembly language program into


machine language. An assembler translates assembly language code directly into machine code
that can he understood by the CPU.

OR
COMPILER INTERPRETER ASSEMBLER

It converts the high-Level It also converts the It converts programs written in


programming language program-developed code the assembly language to the
into Machine language or into machine language or machine language or binary
binary code. binary code. code.

It scans the entire program It translates the program It converts the source code into
before converting it into line by line to the the object code then converts it
binary code. equivalent machine code. into the machine code.

Detects error line by line.


And stops scanning until It detects errors in the first
Gives the full error report the error in the previous phase, after fixation the second
after the whole scan. line is solved. phase starts.

Intermediate object code


generation is done in the There is no intermediate There is an intermediate object
case of Compiler. code generation. code generation.

It takes less execution An interpreter takes more


time comparing to an execution time than the It takes more time than the
interpreter. compiler. compiler.

The compiler requires a It requires less memory It requires comparatively more


lot of memory for than a compiler because no memory.
generating object codes. object code is generated

Interpreter is good for fast


Debugging is easy. Debugging is difficult.
debugging.

Python, Perl, VB,


C, C#, Java, C++ PostScript, LISP, etc… GAS, GNU

Q9. What is error, define its types.


Ans. ERROR: Errors are the problems or the faults that occur in the program, which makes the
behavior of the program abnormal, and experienced developers can also make these faults.
Programming errors are also known as the bugs or faults, and the process of removing these bugs
is known as debugging. These errors are detected either during the time of compilation or
execution. Thus, the errors must be removed from the program for the successful execution of
the program.
SYNTAX ERROR:-Syntax errors are also known as the compilation errors as they occurred at
the compilation time, or we can say that the syntax errors are detected by the compilers. These
errors are mainly occurred due to the mistakes while typing or do not follow the syntax rules of
the specified programming language. These mistakes are generally made by beginners only
because they are new to the language. These errors can be easily debugged or corrected.
1. If we miss the parenthesis (}) while writing the code.
2. Displaying the value of a variable without its declaration.
3. If we miss the semicolon (;) at the end of the statement.
RUNTIME ERROR:-Sometimes the errors exist during the execution-time even after the
successful compilation known as run-time errors. When the program is running, and it is not able
to perform the operation is the main cause of the run-time error. The division by zero is the
common example of the run-time error. These errors are very difficult to find, as the compiler
does not point to these errors.
void main()
{
int a=10;
int c=a/0;// Here number divisible zero error occurs
}
2.
void main()
{
int a[3]={1,2,3};
int out=a[4];// Here array out of bounds error occurs
}
LOGIC ERROR:-The logical error is an error that leads to an undesired output. These errors
produce the incorrect output, but they are error-free, known as logical errors. These types of
mistakes are mainly done by beginners. Suppose we want the sum of the two numbers, but the
given output is the multiplication of 2 digits; this is a Logical error. Detecting such errors is
possible by performing line-by-line debugging.
Syntax:
voidMain()
{
printf("%d",sum(10,20));
}
intsum(int a,int b)
{
return x*y;//expectation is sum but we are multiplying the numbers
}
Q10. What is the difference between procedure-oriented language and object oriented
language
Ans. Procedure-Oriented Language:-Procedural programming is a programming that focuses
on writing code in a structured and procedural manner, organizing the program as a sequence of
procedures or functions.
Object Oriented Language:-
Object-Oriented Programming (OOP) is a programming paradigm that organizes code by
representing real-world entities and their interactions using objects

You might also like