0 ratings0% found this document useful (0 votes) 37 views14 pagesU1 C
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
a pert. ISLAM OLLEGE SGR-97978, :
oppT. ISLAMIA € LLE
BOOK BANK
BOO
UNIT — 1445 Léchires)
Programming Lang
Q Discuss the History and Role of Programm
A Programming languages are tools that allov people to give in:
s of rules and symbols that comput
ructions to computer
fers can int
perform tas
@ languages have a I
1 complex history, and have played an importar
pment of computing
formation technolog
The first programming
fages were developed in the early 1950s. and were mostly
used for scientific and engineering purposes. These languages were low-level a
difficult to use, and required a deep understanding of computer
architecture. Some of
the earliest Programming s included FORTRAN, CORC »L
langua;
and Lisp.
i)
BOOK BANK OPPT. ISLAMLA c ‘OLLEGE SGR. Sat 9906400729We Way (85s
BOOK BANK OPPT. ISLAMIA COLLEGE SGR-9797865343
In the 1960s and 197
1s and 1970s, a new generation of programming languages emerged,
ned to be easier to use and
including C, Pascal, and BASIC. These languages were de
re accessible, and were used for a wider range of applications, including busine
In the 1980s and 1990s, object-oriented programming languages like C++, Javd aud,
Pythe ame popular. These languages allowed programmers to create corb pie
ystems using modular, able components, making, it eagi op
oftware applications
T ere are hundreds of programming languages in use-each with its own
weaknesses, Some languages are designed fos Specific af ns, like F
alysis or Swift for iOS app development. Others dire more general-f
ge Of Applicatior
Java, and can be used for a wide fi
uages play a crucial role iff tig development of software and
ammers to express comp!
uuter systems. They allow pro;
form a wide range of
uters can understand, and to create s6
tinues to evolve, prograrnmi will continue to pl
technol
hnolo,
tant role in shaping th@dutilre of computing and information t
Peer anita’ eS i 3
Key points about Programming Lang
Here are some keypoints about programming languay
1 Programming Janguages are sets of rules and symbols that allow people to
comffitnitate with computers
dre hundreds of programming lar ¢ in use today, each with its own
13 and weaknesses.
story, and have evolved o
3 Programming langua
ng needs and technological advances.
while ¢
ges are designed for specific applications,
4 Some programming lan
|-purpose
TE SGR- Meee 9905 100205 SGR-9797865 34
ant categories, Such as proc,
i 5 Programming languages can be classified into dif ns
object-oriented, o functional, based on their design princi le .
6-The choice of programming language can have a significant imp . ;
| niainability of software systems. 7
performance, efficiency, and main
age requires both theoretical kno
7 Leaming a programmin
e for beginners ar ani
experience, and there are many resources available for beginner: A fen °
alike. di
e development, and "Will ¢¢
es are a crucial tool for soft
b 8 Programming lang
to play an important role in shaping the future of technology.
ndobject code,
antics, source code
Q Define the Syntax and se
AS
Syntax refers to the rules t
ntax and semanti
vern the structure and”
language statements. These niles define how ttvarlous elements of a program,
d to crea alid state
keywords, operators, and variables, can be combin
errors occur when the program violates thé
tatements. It defines w
Semantics refers to the meaning of\programming languag
the program is supposed to do and how it will behave when executed, Semantics
s not behave as intended
occur when the progranfts syntictically correct but do
Source code ‘inl object code:
am that is written in a
Soureg cage fefers to the human-readable version of a prog
proggamming language. It is the original code that is written by the programmer and
sontains instructions that the computer can execute,
Object code refers to the machine-readable version of the program that is produced after
the:source code is compiled or interpreted, It is a binaty representation of the source
code that the « a
code that the eompitier can directly execute, Object code is not human-readable and
cannot be easily modified by humans.
BOOK BANK Oppy, ISLAMIA COLLEGE SGR-
a, 4
9906400729SGR-9797865343 ~~
BOOK BANK OPPT. ISLAMIA COLLEG
The process of converting source code into object code is called compilation or
interpretation, depending on the type of programming, language used, Compiled
languages are translated into object code before execution, while interpreted language
are translated line by line ditring execution
bles, const
%
Q Explain the Briefly datatypes, va
~ |
!
4 Datatypes:
hold. Programein® lanBiuage
of data that a variable can h
tr
types define the t
several built-in datatypes, including integers, floating-point numbgrsyefiaracter
and
atype pecifjaratigegf value
booleans, arrays, and objects. Each da
operations that can be performed on it.
Variables:
pecifie d
4 variable is a named memory location that sfines a'value of a
ammers to assign values to a named entity and then
allows pro}
value later in t rogram. Variables can bé declared and initi;
same time, or they can be declareditsiyand then a:
Constants:
PSe/cannot be changed during the execution of a program
A constant is anamed value
nt fixed values, such as mathematical constants,
Constants are typically“ased to repr
ation settings. They are d
maximum or miipifnum values, or program configur
am and as:
jgned a value that cannot be modified Inter
the beginning OP ro
Declaration?
of defining a variable or constant in a program. It
Déelaratipn refers to the proc
involves specifying the name of the variable or constant, its datatype, and optionally its
LO initial value. Declarations can occur at various points in a program but are typically
nts are defined
= done at the beginning to ensure that all necessary variables and co
before they are used. Programming languages may require explicit declarations, of
BOOK BANK OPPT. ISLAMIA COLLEGE SGR: H9DHA00729< OPPT. ISLAMI 2R-9795
BOOK BANK OPPT. ISLAM 97978,
ecliirations where the datatype is inferred from the
may allow implicit declarations where the datatyp m the va HOOK BA
Q Define the Structured Data Types
A Structured data types are data typ.
that are composed of other data ty,
You to group related data together, making it easier to 0
anize, manipultite, ap
Fe are several types of structured data types, including
1 Arrays: An array is a collection of data elements that are st
red togcthe a
con block of memory. The elements in an array are decksse@busing an in
ot specifies the position of the element within the array
2 Lists: A list is ac tion of data elements thatgr stored ts ther, but unlik
array, the elements in a list are not stored in contiguous i
ory locations. Inst
element ina list contains a reference to the 1
ent in the list.
3 Sets
lection of unique elements that are uno:
ed. Each
ar one.
ection of elements, similar to an array. Hi
have different data
Sth. Yuple
A record iscolltion of related data ¢lements that are stored to
in a regord is calfed a field, and
each field is identified by a unique nami
5 Objects: An,
contained data structure th
contains data element
(calle
1 methods (c
Jed functions or procedures) that
atyibi
imental building blocks of object-oriented
Structyréd data types are used in many programmi
anguages, in
Java, Python, and Ruby,
©
ng others. They provide a powerful
ganize and manipulate data in a structured and efficient
Q Describe the Sequence Control:
{S)
BOOK BANK OP?T. ISLAMIA COLLEGE SGR-Gs=9906400729
«BOOK BANK OPPT. ISL AMIA COLLEGE S¢ K
As: State machines are mo
and the
t involve multip
ications.
ign to ensure that the
reliably
Q what is Implicit and Explicit
BOOK BANK OPPT, ISLAMIA COLLEG)
ential component of many
autor
p
ESGR
j
=4990640072°a
s of information or
a describe different tyPe
A Implicit and explicit are terms tsed |
knowledg
tated, written ¢
Explicit information or knowledge is information that is directly
Otherwise communicated ita clear and unambiguous Way This inforrnation can b
exaily communicated and shared, and is(oflen stored in document Hataisnaea, or: ty
sirucvared formats, Biamyites of explicit information bnelude text ooks, manual
technical specifications, and guidelines
hand, is information shit Hot
cit information or knawledge, on the other hand,
(or experience
stated, but is implied or inferred from context or i
difficult to aritculanes and they. not be ensily communicated orghted Examples of
ntuition, cultural norp® and tdeit knowled;
implicit knowledge include skills,
acquired through experience.
i licit knowledge, a:
implicit knowledge can be more yalyable than explicit know!
>, ad is difficult to learn or teach
ars of experience and prgett
ditional methods. F craftsman may have imp!
example, a master
of the best way to work with cértain materials, even not
able to explain it in detail
and transferred, mak
In contrast, explicit knowledge“tan be more easily
more useful in situation ® Where standardized approach is required. For example, in a
manufacturing plant, eXplicit knowledge of production processes and quality control
tency and effic
procedures is é&sedtial to ensure
all, both(explieit and implicit knowledge are important in different contexts and
Overa
ituationd, antl a combination of both can lead to more effective decision-making and
pfobjém Solving
Q Define the Sequence control between Statements
jequence control between statements refers to th
In programmin
are executed in a program. The order in which statements are w
code determines the sequence in which they are executed by the computer.
For example, consider the following code
(
BOOK BANK OFPT, ISLAMIA COLLEGE scr.UDov06400729
8AY SSA (Cao
BOOK BANK OPPT. ISLAMIA coL R-9797865343
makefile
xty
print(z)
I code, the first two statements assign values to variables x and y, respectively '
rhe third statement adds x and y, and stores the result in th sable 2. Final ahertcin'
e sequence control between statements in this ¢ me yt, Pte Ball J
< of be printed
Ifth the output 6 Yograt can be affected. For
efore thdasstghment of 2, the program will
TPyalut
he correct functioning of m
. dre written in the correct oniler, and th
equent statements that rely on its output
1m Control: Simple call return and
Q Explain the Briefly Subprog
recursive Subprogram.
bpheat
ubprograms
am,control refer agement of
within a program, Subprograms are sel
1 from within other parts of t
n control: simple call and r
ThefSaretwo main types of subprogr
subprogram.
and Ret
ey Simple Cal
his type of subprogram control, the subprograr is called from w
program, and contr
‘ol is transferred to the
s executini
code and returns control back to the main progr
was called.
the subpr:
from the point wher
hho,
p SCR Mees
9
6400722
BOOK BANK OPPT. ISLAMIA COLLEGE) SGR.
BOOK BANK OPrT. R 776554
simple call and return subprogram in p,
Here is an example of Yhoy,
python
Copy code
def muttiply(a, 5)
result=a*b
umn result
multiply(x. y)
. print(z)
the main program with argur
In this example, the multiply function is called
and y, The function executes and retums the\gesiit of the multiplication, which
tinves executing from the print stater
m then con
n the variable z.
‘outputs the va onsole.
Recursive Subpré
ectly of indirect;
A recursiv
program ia a@hbptogram that call
aller
This can be usefil fofigol Ving problems that can be broken down into
subproblems of the sametype.
Here is an exampl@F a recursive subprogram in Pythe
aython
return |
retuirn f * factorial(n = 1)
y = factorial(x)
print(y)
BOOK BANK OPPT,
AMIA COLLEGE SGR-0=49906400729
Ww
Book
In this
calling
6, atwh
statem
Proper
Subpro
Q De
pages 1BOOK BANK OPPT. ISLAMIA COLLEGE §GR-9797865343
ms in this eximple, the fhetorial finetion calculates ¢ factorial of a aumber by fe
sling itself with 4 smaller value of, The function stops calling Hiself when n £9 h
[Link] point i retums 1, The program thet continues executing, from the prin
suntement, whiel outputs the value af y (the fiitorial of x) 0 the com
Jean and efficien
proper subprogram contol is important foe writing clean and e %
subprograms allow programmers to break down complex tasks into aller, more '
manageable sfeode, making it easier to write and maintain program
Q Define the Language Paradigms: Simple Procedural Languliges (
4 Procedural programining is a programming paradigm that foeyses the use of
or subroutines to organize and structur Inythis Paradigm, a pre
muctured as a series of pre res, each of which perfortis a
pecific task and cat ied from other parts of the Prggrsir
P : Simple procedural languages are f iming Wnduisges that are based primarily oF
eduritl paradigm, with minimal suppigrt for other pre
Pp
7 These languages typically provide features for de Jaring and calling
defining variables and data types, and controlling program flow
lude ¢ cal, and BASI
imple procedyrakfaFiguages ir
Some exan
In these Languages, procedures dre defined i jmilar to functions, with a
de. Procedures can be ca
ot of input pafaheters, and a body of ©
+ and passing in any required input
er parts of the programy ising their nam:
J and used within procedures, with scop
iables and data types can also be ¢
and Jifetifye determined by their location within the program. ¢ structur
which
sithiés Mops and conditional statements are used to
he the Block Structured Programming langua|
that use block
structured programming languages are programming lang
related statements together. A block can contain a
or structured statements to gr
within br
ments, and it is usually enclosed
single statement or a group of sta
The following are some examples of block structured programming lang
BOOK BANK OPPT. ISLAMIA COLLEGE scr 990640
iOK BAN
1.C: C isa popular block struc BC
bedded systems, and game ra aS
system programming,
syntax and a powerful set of built-in function:
rograrming language th
2 Java: Java is another popular block structured progran
» and mabile applications, web applications, and enter,
ig desktop
ni independence and its ability to run on multipte
Python is a versatite programming language that supports both ,
c ta afl
aming paradigms. It is widely used for dit
ented pi
mputiny
learning, web development, and
imming lapfyage tit is oft
4 Ruby: Ruby is ad:
faa sitopl
3 web development, scripting, and automation. | yy
and a tich set of built-in I
5 PHP: PHP 2 language'that i§ widely used for de F
ntax, a powerfill set c
working with databa: or object-oriented pro;
tured
dy
just a few examples of thiegmany block stra amming lar
available, Each Ia
ts OWN knesses, and
of language depends off the régiliremems of the project at hand.
Q Define the both Object Based Languages, Functional Languages,
A Object-based Programming Ia
are prog
object-oriented progr
its femirts, Object-based lai Supp.
{Ytorphism, but may not support some advanced OOP fe
i
eae
|
act cl
ss. Exar
ples of object-based programming languages include JavaSerip
VBScript, and ActionScript
Functional programming languages are pro
treat comput
as the evaluation of mathematical functi
d mutable data.
In functional
lunctions are treated as first-class citizens, meaning they
BOOK BANK OPPT. ISLAMIA COLLEGE SGR. 4449906400729
=Languages,
19
© Define the Logic Programming Languagesd let '
Element
wir
' Abst
th
on 50m
BOOK BANK OPPT. ISLAMIA COLL EGF SGRAeoe99064007291 Decision symbal: This symbol is used 10 Fe ane pook F
condition
Where the flow of’control depends 00 a €
Wo represent the inp
Input/Outpitt syiribol: This symbol is used to rept
program
onnect different parts of
4 Connector symbol: This symbol is used to ¢ i
indicate the flow of contro! of data between ther
hol is used to represent a blo
Subeutine symbol: Th
used repented! iit a program
There are many other symbols and connectors tht ean be used iy MOWEAarf, Aiea
ng represented. They fay:
on the needs of the prograin or process being represent rae
snectors should be consistent and clear to ensure that pif Moychart
a . the logie of the program or proces
Q Explain the Briefly Problem Solving Through Floweharts
A Flowcharts can be a valuable too! for protilent$solving and pro mpro Char
Here are some steps to follow when using floweharts for problern-solvi
efine the problem: The first step js to clearly define the problem and identif
scape of the process that needs [Link]
2 Map the current process: Creal flowchart of the current process, including all t
step: ions, and iiputefobrput
3 Analyze the process: Apdlyze the flowchart to identify areas of inefficiency, w
and opportunitied forimprovement. Look for bottlenecks, unnecessary steps, and ar
where errors ure likely to occur.
4 Developsolutions: Brainstorm potential solutions to the identified problems. Use th
flowebast to visualize how the proposed changes would impact the proce
i
5 Test the solutions: Implement the proposed changes and monitor the process to ensure 9
14
the improvements have the desired effect. Use the flo
ind identify any additional areas for improvement
; BOOK BANK OPPT, ISLAMIA COLLEGI sor doo0ea00720Use the
BOOK BANK OPPT. ISLAMIA COLLEGE SGI
R-IT9TROSIAS
palate he Nowchart: {ipa te flowchart i refleet the fnew and inprrved
[his will serv ‘rence for future problem-solving effets and Kelp to ensure that
1c process remains efficient and effective
fav using Roweharts to Visualize and analyze the problem-sol \
etter understand the underlying issues, develop more effect ,
Plowcharts can alsd help to comm the changes fo
wer time
«and enigure that everyone is on the same pay
the Algorithms, Characteristics of an Algorithnt
Algorithms for basic problems
A An algorithm is. 0 step-by-step Set of instructions for sc
task. It is » systematic approactt to problem-solving tat Th sure that
oritha include:
cteristies of an
g: The algorithm must terminate after p finite nw of
Definiteness; Each step in the algorithm ynust mbiguou:
3 Input: ‘The algorithm must take“igpbt from some sour
Output; The algorithm must Butput at the end
scithm must be effective, meaning that
4 Effectiveness: Each sigp ib Phe dle
to perform if'yyd Thite amount of time
duce the correct output
rectness: hwy algorithm mu
basic problems incl!
Some common
Sorting: Soryfigtlgorithims ar
Cofnmbn Sorting algorithms inclue
re used to find a spe
Hing: Searching
hy and binary search,
wn
49 Common searching algorithm include linear
numbers where
f
isa sequence
& 2 Fibonacci series The Fibonacci
mbers. An al; orithm can be used to Be
the sum of the no precedin,
number
Fibonacei series up toa
BOOK BANK OPPT, ISLAMIA COL LEGE SGR
49906400729