






































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
programming in c language for beginers
Typology: Lecture notes
1 / 78
This page cannot be seen from the preview
Don't miss anything!







































































II Semester Examinations - Model Question Paper Time: 3 Hours Max. Marks: 75
PART - A 5 × 5 marks = 25
What is an algorithm? Although there is no universally agreed-on wording to describe this notion, there is a general agreement about what the concept means:
COMPILED BY:- SIVA SAI KRISHNA.PATUKURI (^) M.C.A
Αλλ οφ τηοσε μετηοδσ λογιχσ μαψ νοτ βε γοοδ, φορ γιϖεν προβλεμ; τηερε 0 0 B 5
0 0 B 5
0 0 αψ βε σο ανψ αλγοριτηB 5 σ νοτ οφ αλλ εθυαλιτψ. 0 0 Τηε φολλοωινγ αρε τηε πριB 5 αρψ 0 0 φαχτορσ τηατ αρε οφτεν υσεδ το ϕυδγε τηε θυαλιτψ οφ τηε αλγοριτηB 5 σ.
▲ Τι0 0B 5 ε
▲ Μεμορψ
▲ Αχχυραχψ
▲ Σεθυενχε
0 0 B 5
0 0 οφ τι ε. Τηε λεσσερ τηε τι ε ρεθυιρεδ, τηε βεττερ ισ τηε αλγοριτηB 5.
0 0 B 5
0 0 B 5
0 0 B 5
0 0 α ουντ οφ ε ορψ 0 0 στοραγε. Τηε λεσσερ τηε εB 5 ορψ ρεθυιρεδ, τηε βεττερ ισ τηε αλγοριτηB 5.
0 0 B 5
0 0 B 5
0 0 σολυτιονσ το α γιϖεν προβλε , σο ε οφ τηεσε αψ προϖιδε (^) B 5ορε αχχυρατε ρεσυλτ τηαν οτηερσ.
0 0 B 5
0 0 B 5
0 0 σο ε (^) 0 0οφ τηε ινστρυχτιονσ οφ αν αλγοριτη αψ βε ρεπεατεδ ιν νυB 5 βερ B 5
0 0 οφ τι εσ ορ υντιλ α παρτιχυλαρ χονδιτιον ισ (^) B 5ετ.
0 0 B 5
0 0 Θ) Ωριτε αν αλγοριτη το φινδ ουτ τηε σι B 5 πλε ιντερεστ? 0 0 Σι B 5 πλε ιντερεστ (ΣΙ) =ΠΤΡ/
0 0 Θ) Ωριτε αν αλγοριτη το φινδ ουτ τηε Βιγγεστ οφ τωο νυ B 5 βερσ?
Βιγ=Α
COMPILED BY:- SIVA SAI KRISHNA.PATUKURI (^) M.C.A
Οτηερ ωισε
Βιγ=Β
Symbol
Description
Flow-lines: These are the left to right or top to bottom lines connecting
symbols. These lines show the flow of control throw the program.
Terminal symbol: The oval symbol is used always begins and ends the
flowchart. It is the first and last symbol of the program logic of
flowchart.
Input/output symbol : The parallelogram is used for both input(read) and
output(write),such that this symbol is used to denote any function of an
I/O device in the program
Process Symbol : The rectangle symbol is used primarily for calculations
and initialization of memory locations. All the arithmetic operations are
performed by using this symbol.
Decision Symbol : The diamond shaped symbol is used in a flowchart to
indicate at a point at which a decision has to be made and a branch to one
of two or more alternative point is possible.
nn
Connectors: A connector symbol is represented by a circle and a letter or
digit is placed in the circle to specify the link.
A language is a communica�on tool, which is helps the user to interact with computer by wri�ng programs. There are three types of languages
High Level Language:
The high level language is universal and user friendly, it is similar to English language and hence better understands and easier and less time consuming as compare to assembly language and machinery language.
It is machinery independent and can be used in different type of computers. Compiler or Interpreters are used to convert the source program into object program.
Q) Difference between POP and OOP?
Features of Programming Languages
There are some conventional features which a programming language must
possess, these features are:
Some programming methodologies are stated below:
which performs a calculation, retrieves input, or produces output. Concepts like assignments, loops, sequences and conditional statements are the building blocks of procedural programming. Major procedural programming languages are COBOL, FORTRAN, C, AND C++.
that interact with each other by passing messages that transform their state. The
COMPILED BY:- SIVA SAI KRISHNA.PATUKURI (^) M.C.A
Object Program 0101 10101010 0100 00001101
For execution the program is translation into binary form by compiler or interpreter.
Source program
Compiler
Object Prog.
Linker
Executable Program
Run the program
programming environment designed with a specific purpose in mind, such as the
development of commercial business software. In the history of computer science,
the 4GL followed the 3GL in an upward trend toward higher abstraction and
statement power. The 4GL was followed by efforts to define and use a 5GL.
History of C Programming Language
C Programming Language Timeline :
Programming Language Development Year Developed by
COMPILED BY:- SIVA SAI KRISHNA.PATUKURI (^) M.C.A
ALGOL 1960 International Group
BCPL 1967 Martin Richards
B 1970 Ken Thompson
Traditional C 1972 Dennis Ritchie
K&R C 1978 Brain Kernighan and Dennis Ritchie
ANSI C 1989 ANSI Committee
ANSI/ISO C 1990 ISO Committee
C99 1999 Standardization Committee
C Language Features
C Programming is widely used in Computer Technology, We can say that C is inspiration for development of other languages. We can use C for different purposes. Below are some of the Features of C Programming –
Features of C Programming Language:
1. Low Level Features:
C Programming provides low level features that are generally provided by the Lower
level languages. C is Closely Related to Lower level Language such as “Assembly
Language“.
It is easier to write assembly language codes in C programming.
2. Portability :
C Programs are portable i.e they can be run on any Compiler with Little or no
Modification
Compiler and Preprocessor make it Possible for C Program to run it on Different PC
3. Powerful
Provides Wide verity of ‘Data Types‘
Provides Wide verity of ‘Functions’
Provides useful Control & Loop Control Statements
4. Bit Manipulation
C Programs can be manipulated using bits. We can perform different operations at
bit level. We can manage memory representation at bit level. [Eg. We can use
Structure to manage Memory at Bit Level]
To write a C program, we first create functions and then put them together. A C
program may contain one or more sections. They are illustrated below.
All section, except the main () function section may be absent when they are not
required.
Rules to write C program
Source file: The source file contains the source code of the program. The file extension of any C source code file is ‘.c’. This file contains C source code that defines the main function and may be other functions. The main() is starting point of execution when you successfully compile and run the program. A C program may include other source code files with the file extension ‘.c’.
COMPILED BY:- SIVA SAI KRISHNA.PATUKURI (^) M.C.A
C Character Set
A Character Set denotes any alphabet digit or special symbols used to
represent information. Following shows the valid alphabets, numbers and special
symbols allowed in C.
Alphabets A - Z a - z
Numbers 0 - 9
Special Symbols ~ `! @ # $ % ^ & * ( ) - _ = + [ ] { } \ | ; : ‘ " ,. < > /?
Identifiers: The names of variables, functions and arrays are identifiers. These are
user-defined names and consist of a sequence of letters and digits. Such as,
my_num, _ton etc.
Rules for identifier:
C Keywords
break else long switch
case enum register typedef
COMPILED BY:- SIVA SAI KRISHNA.PATUKURI (^) M.C.A
char extern return union
const float short unsigned
continue for signed void
defaultgoto sizeof volatile
do if static while
Q) Variables in C?
A variable is a value. The value can be change at the time of program
execution.
Syntax: variable name;
Example: Int a=10;
Rules to name Variable
Valid and Invalid Variable Name
Valid Invalid
rollno roll-no
roll_no roll no
sum 2a
b3 int
_b3 acc’ts
Q) C onstants in C? Constants refer to fixed values that do not change during the execution of a program.
Constants can be defined as symbolic constant, because it is easy to refer the value whenever it becomes necessary Ex:
Valid examples are: 0 +47 17 -
(ii) Octal Integer Constants Octal integer constants can consist of any combinations of digits from 0 to 7. However, the first digit must be zero (0), in order to identify the constant as an octal number. For instance, decimal integer 8 will be written as 010 as octal integer.
Valid examples are: 0 047 017 0240
(iii) Hexadecimal Integer Constants Hexadecimal integer constants can consists of any combination of digits from 0 to 9 and letters from A to F (either uppercase or lowercase). A hexadecimal integer constant must begin with either 0x or 0X. For instance, decimal integer 12 will be written as 0XC as hexadecimal integer.
Valid examples are: 0x 0X2 0x7A 0xbcd
Real Constants Real constants are also called as floating point constants. Real constants are numbers having fractional parts. These may be written in one of the two forms :
5.i. Fractional form
(ii) Exponential form
(i) Fractional Form The fractional form consists of a series of digits representing the whole part followed by a decimal point and series of digits representing the floating part. The whole part or fractional part can be omitted but not both. The decimal point cannot be omitted.
Valid examples are :
(ii) Exponential Form The exponential (or scientific) form of representation of real constants is usually used if the value of the constant is either too small or too large. In exponential form of representation, the real constant is represented in two parts namely, mantissa and exponent. The syntax is :
For example, 3.5 can be written as 0.35 x 10 = 0.35E1 where the mantissa part is 0.5 (the part appearing before E) and the exponent part is 1 (the part appearing after E).
Single Character Constants A single character constant or a character constant consist of a single character encloses within apostrophes.
Valid examples are :
String Constants
A string constant is a sequence of characters encloses within double quotation marks. Technically, a string is an array of characters. The compiler automatically places the null character (\0) at the end of each such string, so program can conveniently find the end.
Valid examples are :
Data type means which types of data you want to store in to the variable is called as
data type. It is also called as memory object. By using the data type to allocate the memory to
the single variable.
C language is rich in its data types. ANSI supports three types of data types.
COMPILED BY:- SIVA SAI KRISHNA.PATUKURI (^) M.C.A