Sadigya Subedi BSC - It 1St Semester Enrolled in 2019: Programming Assignment Submitted by
Sadigya Subedi BSC - It 1St Semester Enrolled in 2019: Programming Assignment Submitted by
Submitted By:
Sadigya Subedi
Enrolled In 2019
Submitted To:
1. Present a mini research project both in the form of a report and as a presentation. You
will
1. Present a mini research project both in the form of a report and as a presentation. You
will need to explain what an algorithm is, with examples of their use, comparing their
efficiency against brute forcing, and how it will relate to the application development
encryption/decryption, compression/decompression.
performance data and a bibliography using the Harvard referencing system. You are
required to make effective use of headings, bullet points and subsections as appropriate.
Submitted By:
Sadigya Subedi
Enrolled In 2019
Submitted To:
ACKNOWL
Niraj Khadka Sir
Firstly, as a student of ISMT College I would like to commemorate my college ISMT for
handing out this wonderful project for a student like me and many others to work on this
wonderful assignment and explore our level of understanding as well as our creativity. I would
also like to express my special thanks of gratitude to my teacher Mr. Niraj Khadka Sir as well as
all the teachers of Assignment Department who gave me the golden opportunity to do this
wonderful assignment which also helped me in doing a lot of Research and I came to know about
so many new things I am really thankful to them.
Secondly, I would also like to thank my classmates who helped me a lot in finalizing
this project within the limited time frame.
Features Of Algorithm
Finiteness
Definiteness
Input
Output
Effectiveness
Finiteness
Algorithm must get completed after finite number of steps.
Definiteness
An algorithm must be defined precisely step by step.
Input
An algorithm must have zero or more inputs.
Effectiveness
The operations to be performed in the algorithm must sufficiently basic that they can in
principle be done exactly and in a finite length of time.
Advantage Of Algorithm
There are different disadvantage of algorithm. Some of them are as follows :
Disadvantage Of Algorithm
There are different disadvantage of algorithm. Some of them are as follows :
Complex Logic
The flowchart becomes complex to show different types of branching and looping.
Modification in the program
If any types of changes had to be applied in the middle while preparing the algorithm
and flowchart it has to be entirely rewritten which takes a lot of time.
Time consuming
Algorithm makes easier for the developer to develop a program but it also takes a lot of
time while preparing the algorithm for big task.
Example of Algorithm
We use algorithm while developing the program as well as we use the algorithm in our daily
lives too. Here, are the different examples about how we use algorithm while developing a
program as well as in our practical life.
Here is an example to prepare a cup of boil water. To boil the water we use a fix procedure and
algorithm as described below :
1. Take a bowl.
2. Add some water .
3. Switch on the gas.
4. Soon
Here, the above mentioned process i.e. 1 to 4 respectively are the algorithm to boil
water. Therefore, the algorithm process is also applicable in the practical life as well
as the programming life.
Programming Algorithm
Step 1- Start the program.
Step 2- Read / input the number.
Development Environment
The term development environment is the set of process used to create and test the program or
software product to maximize productivity and efficiency for the developer. The purpose of a
development environment is to have a place for a developer to test anything they want without
worrying about it affecting any end-users or content Some of the examples of development
environment are as follows :-
Community
Professional
Enterprise
Android Studio
Android Studio is the official integrated development environment for Google's Android
operating system. It is available for download on Windows, macOS and Linux based operating
systems. It is developed in coordination of Google and JetBrains. It is designed specially for
Android Development. It is currently the most widely used Development Environment. Android
Studio allows to see any visual changes that we make to our app in real-time, and we can also see
how it will look on a number of different Android devices, each with different configurations and
resolutions, simultaneously.
JCreator
JCreator is an development environment for Java, consisting of tons of features and
functionality in a simple user interface which is suitable for both amatuer and professional
developers. Unlike most Java IDEs which helps typically for writing in Java, JCreator is written
entirely in C++ to support special speed, sharpness and cleverness. It is fully customizable user
interface. It also has syntax highlighting feature by which the different code are displayed in
different colors and font according to the category of the term.
Eclipse
Eclipse is an open source community of tools, projects offering several popular IDEs including
the cloud IDEs and desktop IDEs. Eclipse support our development work with any language
which means that Eclipse provides a tool that meets our needs. It is free of cost. Eclipse is
written mostly in Java and its primary use is for developing Java applications.
Programming Language
A programming language is a set of commands, instructions, notation designed to connect
instructions to a machine which is used to create an application/software program. Programmers
use language to write the code which are called high level languages. There are different types of
programming languages used which are described below :-
<HTML>
<HEAD>
</HEAD>
<HR>
<H1>This is a Header</H1>
[email protected]</a>.
<HR>
</BODY>
</HTML>
JavaScript
JavaScript is the programming language of HTML and the Web. JavaScript is easy to learn.
JavaScript is used mainly for enhancing the interaction of a user with the webpage. Client–side
JavaScript has expressly been developed for use in a web browser in conjunction with HTML
pages. This has certain consequences for security. JavaScript only works on things that are in
HTML pages or part of the browser.
<script>
playRoshambo = function(clientGesture) {
//server always chooses rock
if (clientGesture=='rock') {
Sadigya Subedi (HND / First Semester) 12
result = "tie";
}
if (clientGesture=='paper') {
result = "win";
}
if (clientGesture=='scissors') {
result = "lose";
}
document.getElementById('results').innerHTML = result;
}
</script>
C Language
C was developed at Bell Labs by Dennis Ritchie for the Unix Operating System in the early
1970s. Ranked among the most widely used languages, C has got the compiler for most of the
computer systems and also has influenced many knowable programming languages like C++. C
belongs to the structured, procedural paradigms of languages. Many later developed languages
have borrowed features directly or indirectly from the C language. Like the syntax of PHP, Java,
JavaScript, and many other languages are based on C language.
#include<stdio.h>
int main()
{
printf("Hello Sadigya, I am C");
}
C++
C++ was also developed at Bell Labs by Bjarne Stroustrup, and is an extension of the C
#include <iostream>
int main()
int a,b,c;
c=a;
a=b;
b=c;
return 0;
C#
C# is a general-purpose, modern and object-oriented programming language pronounced as C
Sharp. It was developed by Microsoft and uses Microsoft's .Net platform. C sharp was designed
by Anders Hejlsberg, and the team is led by Mads Torgersen. The recent version is 8.0, which
was released on 2019 alongside Visual Studio 2019 version. The core syntax of C# language is
similar to that of other C-style languages such as C, C++ and Java.
PHP
PHP is a widely-used open source general-purpose scripting language that is especially suited
for web development and can be embedded into HTML. PHP can create, open, read, write,
delete, and close files on the server. PHP runs on various platforms like Windows, Linux, Unix,
Mac OS X, etc. PHP can add, delete, modify data in our database
<html>
<head>
<title>Example</title>
</head>
<body>
<?php
echo "Hi, I'm a PHP script!";
?>
</body>
</html>
Python
Python is a popular programming language. It was created by Guido van Rossum, and released
in 1991. It is used for web development (server-side), software development, mathematics,
num1 = 1.5
num2 = 6.3
Platform Environment
A platform environment is the environment in which a piece of software is executed. There are
The platform environment of the language that we have used is Microsoft development .Net
platform. For the .net framework, we have used .NET Framework 4.6 which was installed as
default. The .NET Framework is object oriented We used this platform because it provides
opportunities available for software developers, alongside the Azure cloud and other services. It
has different kinds of tools that people can use easily to create any kind of applications as well as
it also has a tool for connecting various applications, which makes it possible to have data from
one system show up in another. The main reason we have used the .NET Framework because it
is object-oriented and supports C# and helped us in making of the “Assignment Management
System”.
The above mentioned is the .NET framework that we have used in building an application.
b. Mobile Platform
They include hardware/software devices for developing mobile applications.
c. Client/Server Platform
They are the platform for client/server software’s such as web browsers
d. Software Platform
They are the platform where computer software’s work. They can be Operating Systems or
development environment.
e. Cloud Platform
Platform for deploying cloud services
M1
Determine the steps taken from writing code to execution.
The Code execution process include following steps
Source code
Pre-processor
assembler
Linker
Source Code
Source code is the fundamental component of a computer program that is created by a
programmer. It can be read and easily understood by a human being. When a programmer types
a sequence of C programming language statements into Windows Notepad, for example, and
saves the sequence as a text file, the text file is said to contain the source code. It contains
declarations, instructions, functions, loops and other statements, which act as instructions for the
program on how to function. Programs may contain one or more source code text files, which
can be stored on a computer's hard disk, in a database, or can be printed in books of code.
Pre-processor
Preprocessing is the first step of the language processing system. Language processing system
translates the high level language to machine level language (i.e. to the form that can be
understood by machine). Preprocessors are programs that process our source code before
Macros
A macro is a fragment of code which has been given a name. Whenever the name is used, it is
replaced by the contents of the macro which means that whenever this name is encountered by
the compiler this compiler replaces the name with the actual piece of code. It can also be called
as text substitutions. The ‘#define’ directive is used to define a macro.
File Inclusion
This type of preprocessor directive tells the compiler to include a file in the source code
program. There are two types of files which can be included by the user in the source code
program :-
Syntax : #include”filename”
Conditional Compilation
Conditional Compilation directives are type of directives which helps to compile a specific
portion of the program or to skip compilation of some specific part of the program based on
statement1;
statement2;
statement3;
statementN;
#endif
Other directives
Apart from the above directives there are two more directives which are not commonly used.
These are:
#undef Directive
#pragma Directive
#undef Directive: The #undef directive is used to undefine an existing macro. This directive
works as:
#undef LIMIT
#pragma Directive: This directive is a special purpose directive and is used to turn on or off
some features. This type of directives are compiler-specific i.e., they vary from compiler to
compiler.
Assembler
An Assembler is a program that translates human readable symbols mostly three letter symbols
into binary data that can be executed by a processor. The output generated by assembler is the
object code or machine code understandable by the computer. Assemblers are classified based on
the number of times it takes them to read the source code before translating it; there are both
single-pass and multi-pass assemblers.
Linker
After the compiler creates one or more object files, then the job of the linker is in three process.
Sadigya Subedi (HND / First Semester) 21
In First, to take all the object files generated by the compiler and combine them into a single
executable program.
Second, in addition the linker also is capable of linking library files. A library file is a
collection of precompiled code that has been “packaged up” for the reuse in other programs.
Thirdly, the linker makes sure all cross-file dependencies are resolved properly. For example,
if we define something in one .cpp file, and use it in another .cpp file, then the linker connects
the two .cpp files together. If the linker is unable to connect a reference to something, we will get
a linker error, and the linking process will abort. We need to put all the modules together. This is
the job of the linker.
Loader
The loader is a component of an operating system that carries out the task of preparing a
program or application for execution by the OS. It does this by reading the contents of the
executable file and then storing these instructions into the RAM, as well as any library elements
that are required to be in memory for the program to execute. The reason of splash screen
appearing before the start of the program, often showing what is happening in the background is
what the loader is currently loading into the memory. When all of that is done, the program is
ready to execute.
Memory
The executable code is sent to loader which loads it into memory and then it is executed. The
memory acts as source to store the executable output which is currently being displayed over the
screen of the computer. After execution, output is sent to console.
Procedural Programming
Object Oriented Programming
Event-Driven programming
In this task,, we are going to discuss about explanations of what procedural, object
Procedural Programming
A programming language which uses list of instructions or procedures to perform a task is
known as procedural programming. In other words, it is a imperative language where execution
is based on the statements and step by step procedure. The code of the program executes line by
line with logical steps, it follows the top to bottom approach, the code is written first execute
with some conditions. The conditions are decided by the procedure calls. For example, if there
are two functions in the program the main function executes fist and the code will execute top to
bottom. Some of the examples of Procedural Programming includes BASIC, C, FORTRAN,
PASCAL, COBOL, etc.
Predefined functions
Local variables
Global variables
Parameter passing
Modularity
Procedures
Programming libraries
Predefined functions
Examples of pre-defined function such as "System.out.println", can be used as a function that
is already within a programming language, this grants easy work for programmers. This is
Local variables
A local variable is a variable that is declared in the body of a method that you make. They you
can use that variable only in the method you made. If you have other methods in the class they
will not even be aware that the variable even exists. Here is an example of a program using a
local variable :-
Global Variables
Variables that are declared outside a block are known as Global Variables. Global variables
have a program scope, which means they can be accessed anywhere/everywhere within the
program. The only way they can be destroyed is when the program ends as they are global.
Unlike local variables Global variables can be accessed anywhere throughout the program. A
global variable maybe used when we want to declare a variable that needs to be accessed by all
parts of our program.
Parameter passing
A parameter is a type of variable that you can pass into a function. Variables are the listed parts
of each methods declaration. Parameter passing allows variable values to be passed through to
the program which will handle it with a procedure.
Modularity
Modularity is a general concept which applies to the development of software. It allows
individual modules to be developed, in many cases this is done with a standardized interface to
allow modules to work and communicate properly. Each module works independent to each
other. Modularity is a software technique that shows that separating the functionality into
individual, interchangeable modules, each which allows it to execute the specific thing it is
designed to to do. These all combine as different tasks to achieve an overall goal.
Sadigya Subedi (HND / First Semester) 24
Procedures
Procedures are just small programs. The purpose of a procedure is to help a programmer avoid
repetition. A procedure start off with a begin and end up with end. In the Procedural
Programming Language the program that has them in, will follow the procedures step by step.
The program does exactly what it is told to do in the order that has been set by the programmer.
Programming libraries
Programming libraries are a collection of pre-built codes , routines, sub-routines, classes and
values which can be used at any time by the program and it's users. There are many Libraries in
programming. They each contain some unique functions and subroutines for a specific program.
Control Statement
A control statement is a statement that determines whether other statements will be executed or
not. Hence, it means that this statement looks after whether to execute the statement during the
execution process or not.
o while loops test whether a condition is true before executing the controlled
statement.
o do-while loops test whether a condition is true after executing the controlled
statement.
o for loops are (typically) used to execute the controlled statement a given number
of times.
Looping
In programming, loop is a sequence of instruction’s that is continuously repeated until a certain
condition is reached and the process of loop is known as looping.
Types of Loops
A loop is classified into two types:
while (condition) {
statements;
do {
statements
} while (expression);
Syntax
for (initial value; condition; incrementation or decrementation )
statements;
Array
An array is a collection of fixed number of components (elements), where all of components
have same data type. There are two types array which are as follows :-
One-dimensional array
Multi-dimensional array
Here is the output the program which have been coded above.
One-dimensional array
A One dimensional array is a array in which components are arranged in linear form. It is also
known as single dimension array. A one-dimensional array has a list of variables with the same
data type.
Multi-dimensional array
A Multi-dimensional array is a array in which components are arranged in tabular form.
The Multi-Dimensional array is 'array of arrays' having similar data types.
Structure
A structure is used to represent information about something complicated than a single
number, character, or Boolean can do (and more complicated than an array of the above data
Sadigya Subedi (HND / First Semester) 31
types ) For example, a Student can be defined by his or her name, gpa, age, Student ID, etc. Each
of these pieces of information should be labeled with an easily understood descriptive title, and
then combined to form the structure.
dataType member1;
dataType member2;
...
};
To reference a field of a structure, we use a "dot" between the name of the variable containing
the structure, and the name of the field of the structure.
String
A string is a data type used in programming, such as an integer and floating-point, but is used
to represent text rather than numbers. It is comprised of a set of characters that can also contain
spaces and numbers. For example, the word "sadigya" and the phrase "sadigya is a student" are
both strings. Even the numbers "12345" could be considered a string, if specified correctly.
Typically, programmers enclose strings in quotation marks for the data to recognized as a string
and not a number or variable name.
Example and Syntax Of pointer
char str_name[size];
Here is an example of String
Function
A function is a block of statements that performs a specific task. A programmer can create
their own functions. Once the function is properly described by the programmers, it can be used
like the predefined functions.
Example and Syntax of the function
returnType functionName(type1 argument1, type2 argument2, ...)
File Handling
File Handling concept in C language is used for store a data permanently in computer. Using
this concept we can store our data in Secondary memory (Hard disk). All files related function
are available in stdio.h header file.
1. open()
To create a file
2. close()
3. getc()
4. putc()
5. printf()
6. scanf()
7. getw()
8. putw()
Data encapsulation
Class and Object
Inheritance and its Types
Polymorphism
Abstraction
Overloading
Data encapsulation
Encapsulation is the grouping of data and methods which work on that data together and provide
the user an interface through which the user can accomplish tasks without getting into the details
of implementation. Data encapsulation, sometimes referred to as data hiding. While working
with procedural languages, it is not always clear which functions work on which variables but
object-oriented programming provides you framework to place the data and the relevant
functions together in the same object.
Sub Class
Super Class
Sub Class: The class that inherits properties from another class is called Sub class or Derived
Class.
Super Class:The class whose properties are inherited by sub class is called Base Class or Super
class.
Single Inheritance : In single inheritance, a class is allowed to inherit from only one class. i.e.
one sub class is inherited by one base class only.
Syntax :
class subclass_name : access_mode base_class
//body of subclass
};
Multiple Inheritance : Multiple Inheritance is a feature of C++ where a class can inherit from
more than one classes. i.e one sub class is inherited from more than one base classes.
Syntax :
//body of subclass
};
Here, the number of base classes will be separated by a comma (‘, ‘) and access mode for every
base class must be specified
Multilevel Inheritance: In this type of inheritance, a derived class is created from another
derived class.
Hierarchical Inheritance: In this type of inheritance, more than one sub class is inherited from
a single base class. i.e. more than one derived class is created from a single base class.
Hybrid (Virtual) Inheritance: Hybrid Inheritance is implemented by combining more than one
type of inheritance. For example: Combining Hierarchical inheritance and Multiple Inheritance.
Polymorphism
Polymorphism this is existing features of object oriented programming. It provides concept of
same name or different behavior. Poly refers to many. That is a single function or an operator
functioning in many ways different upon the usage is called polymorphism.
Abstraction
Data abstraction refers to, providing only essential information to the outside world and hiding
their background details. For example, the Hyundai invented a car in which we can turn the
steering wheel to automatic. As a user, we do not really know what happens in the inner
workings of the car, we just use the interface provided to us to get the work done. The complex
implementation details are hidden from us by using an interface. This is called as data abstraction
(the process of hiding complexity).
Overloading
The concept of overloading is also a branch of polymorphism. When the exiting operator or
function is made to operate on new data type, it is said to be overloaded.
Features
Service Oriented
Sadigya Subedi (HND / First Semester) 40
Service focused is a key features in event-driven programming that used to create programs that
are created for services and it takes does not slow down the computer as service oriented only
take in little of the computer control vitality and usually services run in the backdrop of OS.
Time Driven
In event motivated programming, time influenced is a paradigm, from the code that runs on a
period trigger, time motivated can be considered a specific code that works on a specific time,
which could be once one hour, once a week or once a month, this means from the pre-set to do
activity.
Event Handlers
Event handlers is a type of function or method that run a specific action when a specific event is
prompted. For example, maybe it's a button that whenever consumer click it, it'll display a note,
and it'll close the subject matter when user click the button again, this is an event handler.
Trigger Functions
Trigger functions in event-driven coding are a functions that make a decision what code to
perform whenever there are a specific event occurs, which are being used to select which event
handler to use for the function when you can find specific event occurred.
Events
Events include mouse, computer keyboard and user interface, which events have to be triggered
in this program in order to happen, that mean user have to interacts with an object in this
program, for example, click a button by a mouse, use computer keyboard to choose a button and
etc.
Limitation
The limitation of Event Driven Program is it can get very hard to understand by the other
programmer. Event driven programs is less logical as it doesn’t contain the algorithm or
procedure like the other programming paradigms, which makes it more difficult understand and
write. Other limitation is that it can require quite a lot of processing power as it will have to
refresh instantly to see if any changes has been made in the GUI . If any changes has been made
to the program then in that case the program will have an extra task to carry out the code for the
Sadigya Subedi (HND / First Semester) 41
certain action for which the code has been made or changed, which will take more processing
time.
NetBeans
Microsoft Visual Studio
Eclipse
Benefits of IDE
Some of the benefits of using Integrated Development Environment are as follows :-
Code editor
I. Auto completion
II. Syntax check
III. bracket Matching
Compiling
Debugging
Documentation
Libraries
automation tool
Syntax checks. This feature of code editor recognizes the incorrect use of syntax and
highlights any errors.
Bracket matching. This is used for languages that use pairs of brackets to mark out blocks of
code. It allows the code to be read and understood more quickly. If you forget to close a
bracket while writing, colored sections may help us to detect missing brackets.
Compiling
When running, the compiler firstly analyzes all the language statements written to execute the
code one by one and then, in one or successive stages it builds the output code by making sure that
the statements that refers to other statement is referred correctly in the final code to execute the
program to provide output to the user.
Debugging
Debugging is a program within the IDE which is used to detect the errors during the process of
compilation. If the debugging feature detects any kind of errors during the compilation, then it
will suggest what the type of error is detected and on which line is the error detected.
Documentation
Documentation feature explains the purpose and the function of the code, by considering the
modules and variables used, and its expected behavior also gathers these into a text file which can
be handled by other developers to understand why and how the code was created.
Libraries
Libraries provides function which are not included in the core part of the programming
paradigm. Library functions can be imported and used at the start of the program code.
It needs less memory as it reduced amount of overhead during runtime also data and
methods are stored in the same memory location.
Coding is excellent, simple and flexible for simple program.
It has got good level of control because without knowing the CPU details we coded and
got the output.
It is fast and efficient.
Easy to maintain as each procedure can be debugged separately.
It is easy to maintain and modify the existing code as the new objects can be created with
small change made to existing one.
The code can be reused through the feature provided called as inheritance.
The principle of data hiding helps in maintain the security of the program.
Polymorphism allows interaction between the objects without clearly stating which type
of data we are abstracting.
Object oriented program design is tricky as we can see in the above sample scenario.
Event driven programming is flexible as the programming code follows a logical order
from first to the end and the flow is determined by events which allows the programmer
to be flexible about the order in which they carry out the code.
Development is easier as the functionality can be added through programming more
events
It also has a better software design outcomes we can consider our example as it looks
attractive than that of C and C++.
Conclusion
From the above activities we have explained the principles, characteristics, features,
examples of Procedural, Object oriented and Event driven Programming and critically evaluated
the event driven, object oriented and procedural programming.
Coding Standard
Coding standard is simply a set of rules and guidelines for the formatting of source code. A
well developed software organization want their developers to maintain some well-defined and
standard style of coding which is known as coding standards.
Implementing the coding standards reduces the risk of project failures because software
becomes vulnerable to attacks if it is inconsistent, contains bugs and errors in logic which
is due to poor coding practice.
A clear coding in the program gives the programmer an opportunity to reuse the code
whenever and wherever required which can reduce the time in coding along with the
efforts being made in the development of the program.
If coding standard is followed in the absent of the developer in the company/office any
other developer can understand the code and hence, can modify it at any time.
Coding standard
Indentation
Commenting code
o Single line comment
o Multi line comment
Variable declaration
Naming convention for Package Class
Camel case
Pascal case
Indentation
In function definitions indentation denotes the code which is a part of the function. Indentation
makes programs easier to read and understand.
Commenting code
Commenting of code is done in order to know at the future why the code was written in such
type. For example to follow camel case we write a comment camel case is followed in order to
know in future during the edit of the code that instead if pascal case we have to follow camel
Variable declaration
Variable declaration is a process of declaring the variable while coding in the programming
language. There are different type of variable declaration like int, string, char, etc.
Pascal Case
Pascal Case is the word which have the first letter capital and subsequent word is also capital.
Example-Sadigya Subedi
We can also use firewall to keep any potential threats localized and also debug locally if we have
to debug an unfamiliar process in the visual studio remote debugging monitor. We should also
not use windows authentication mode infront of the unknown user because they may connect to
Microsoft® Visual Studio® 2005 from Microsoft Corporation also known as msvsmon.exe
which is dangerous because the unknown user may grant permission to access all the feature on
our computer.
The user can know why the code was written at any time.
If a source code is consistent bugs can be easily maintained without getting confused.
For team
There will be consistency in the naming of the variable throughout the entire project.
The code will be understand by one another even after exchanging the given work at
any time of the project.
Coding is also good starting point for new team members or external developers who
support our team.
All the member in the team will name the function according to what the other
member of the team does.