COMPUTER PROGRAMMING
WITHC
Author:
Ghullam Mohiyuddin
(BCS, D.A.E-IT)
Sr. Instructor (C.I.T)
Abbas College of Technology
Compiled By:
Engr. M Shumraiz Sharif
(BS-(IT), D.A.E-IT, CCNA)
Sr. Instructor
Abbas College of Technology
Owais Jamil
(BS-Electrical Engineering)
H.O.D (ET)
Abbas College of Technology
C Language Notes Master Solution for Exams GMD©
pg. 2
Source code
A computer program that are written in high level language is called the source
program.
In computing, source code is any collection of computer instructions, possibly with
comments, written using a human-readable programming language, usually as
ordinary text.
Object code
A computer program in machine language is called object program/code.
OR
Code produced by a compiler or assembler
-------------------------------------------------
2-Define program and programmer?
Program
A well-defined set of instruction for computer to perform a specific task is called
the computer program.
Programmer
A person who develop/write the program is known programmer or developer.
--------------------------------------------------
What is Language and type name?
The language is the rule, set of instruction in which a program create/develop.
Types
High Level Language (C,C++,C#, java, php)
Low Level Language(like machine , assembly language)
--------------------------------------------------
C Language Notes Master Solution for Exams GMD©
pg. 3
3-Define Flow chart and IDE
Flow Chart
The sequence and step-by-step designing and representation of the algorithm is called flow
chart
--------------------------------------------------
4-Define variable. Also define the constant and global variable.
Variable
Variables are locations in memory for storing data.
Constant Variable
The value of variable which cannot be changed during the execution of program. It must be
numeric type.
Global Variable
The value of variable which can change outside to the program boundary.
--------------------------------------------------
5-Write the step to create the C program.
There are five steps to create C program
1-Creating source program
2-Saving the source Program
3-Compiling the source program
4-Linking
5-Loading
-------------------------------------------------
C Language Notes Master Solution for Exams GMD©
pg. 4
6-Define HLL and LLL. Also define advantages.
High Level Language
The language that are close to human language is known high level language. For example
English, Urdu, in computing C++, C#, php are high level language.
The advantage of high level language is that we can easily write the program in our
language like English, which human (programmers) can easily understand.
Low Level Language
The language that is close to machine is called low level language, like assembly binary
language, in which computer communicate between their components. It is also called
machine language.
The advantages of machine language is that the computer easily understand their native
language like assembly or binary language.
--------------------------------------------------
Define Compiler and assembler.
Compiler
The program that translate the source program into machine language is called compiler.
Assembler
The application that translate the assembly language program into machine language is
called assembler.
7-Define source code and why it cannot direct execute.
The computer that are written in high level language is called source code. It cannot be
direct execute because as we know that computer is a machine and it understand the
machine language , but our program code writer in high level language(human language)
.Therefor a program which name compiler is use that convert source code into machine
language(object code) .
---------------------------------------------------
C Language Notes Master Solution for Exams GMD©
pg. 5
Define ANSI.
ANSI stand for American National Standard Institute which developed a standard for C
language in late 80s.This standard version of C language is known as ANSI C.
---------------------------------------------------
8-What is getch () function?
The getch () stand for get character. This function is used to get a single character from the
keyboard during program execution. When a key pressed on the keyboard.
----------------------------------------------------
9-Define bug and debug.
Bug
The error which come in program are called bug. The bug is occur when the program syntax
is not write according to standard of the language.
Debugging
Removing the error from program is called debugging.
-----------------------------------------------------
10-Define type casting.
Conversion of data type of a numeric value into another data type during arithmetic
operation is called casting or type casting.
------------------------------------------------------
11-Write down the operation of /n?
It is a function in C language programming for create a new line in program.
-------------------------------------------------------
12-Define function and syntax.
Function
The function is the well-define procedure of the event which is perform their specific
operation in program.
C Language Notes Master Solution for Exams GMD©
pg. 6
Syntax
The syntax is the writing style and predefine standard in any programming language.
--------------------------------------------------------
13-Define linker write the process of linking.
In C program there are many associate predefined routines and functions. The function are
functions are contained in separate files. This file are part of C compiler and called library
files/runtime file. The C program needs the library file for execution of the program
creation. The file combine with object program.
The process of combining the required library with the object program is called linking. The
program who perform this process of linking called linker.
--------------------------------------------------------
14-Define loop and Nested loop.
Loop
Loop is also called the repetition structure .The loop is control structure which are repeat
and again and again in program.
Nested Loop
A loop structure completely inside the body of another loop structure is called nested loop.
---------------------------------------------------------
15-What is assignment statement?
The statement that is use to assign a value to a variable is called an assignment statement.
---------------------------------------------------------
16-What is operator? Also explain relational operator.
Operator
An operator is a symbol or an identifier that represent some action which is performed on
data.
C Language Notes Master Solution for Exams GMD©
pg. 7
Relational Operator
The relational operator is use to compare two expressions. Relational operator return value
true or false.
---------------------------------------------------------
17-Give the name of Relational Operator.
There are following given the name of relational operator
Greater than >
Greater than or equal >=
Less than <
Less than or equal <=
Assignment =
Not equal to !=
Equal ==
------------------------------------------------------
18-Define function and Declaration.
Function
A Functions is a piece of code that designed to perform a specific task. Which we are using
in our program to make a standard or some action of event executable code and this process.
Declaration
Variable declaration tells the computer the name and the data type of the variable that is to
be used in a program.
-----------------------------------------------
19-Define Logical Operator.
The logical operator are used to make compound condition. The output of logical operator is
True or False.
-----------------------------------------------
C Language Notes Master Solution for Exams GMD©
pg. 8
20-Define Syntax error.
The rules for writing statements in a computer programming language is called syntax of the
language. All program written according to these rule. A single mistake in these rule causes
an error .This error is called syntax error.
---------------------------------------------
21-Define while loop.
It is a conditional loop statement. It is used to execute a statement or a set of statement as
long as given condition remain true.
----------------------------------------------
22-Define statement and Return statement.
Statement
The statement of a C program are written under the main () function between curly braces
{}. The statement is the code in programming language.
Return Statement
The return statement are used to return a function or attribute of property in programming.
---------------------------------------------
23-What is expression explain?
An expression is used for calculating the value of formula. It is form by combining different
operand and operator.
----------------------------------------------
24-What is pointer?
A pointer is basically a variable like any other variable. However, the pointe is containing
actual data. Containing the address of the memory location.
----------------------------------------------
25-Define string and compound condition.
String
The string is the character data type. String containing the alphabetic and numeric data type.
C Language Notes Master Solution for Exams GMD©
pg. 9
26-Define Escape Sequence.
A combination of characters are used to control printing on the output device. This
combination of the character is called escape sequence.
----------------------------------------------
28-Define for loop in C language.
For statement/loop is used to execute a set of statements repeatedly for the specific number
of times. It is also known as counter loop.
-----------------------------------------------
29-What is! = ?