CS101 Final Term Past Papers 2025
Programming Languages: Variables and Data Types
In high-level programming languages, developers are able to assign meaningful
names to memory locations instead of relying on numeric addresses. These descriptive
vu expert solutions
names are referred to as variables because they allow the value stored
in the memory location to change during the program’s execution. This makes it
much easier to understand and manage a program’s behavior, as descriptive names
are more intuitive than arbitrary memory addresses.
However, in contrast to some
modern languages like Python, many programming languages discussed in this
section require that all variables be explicitly declared before they are used
in the program. A declaration statement specifies the variable's name as well
as the type of data that it is designed to hold. This is critical because it
defines how the programming language will handle the data, both in terms of
storage format and the operations allowed on that data.
This defining feature of a
variable is known as its data type. A data type not only tells the computer how
to encode the data in memory but also determines which kinds of operations can
be performed on it. For example, an integer data type typically
represents whole numbers, which might be stored in a two’s complement notation.
Common operations on integers include basic arithmetic such as addition,
subtraction, and comparisons to check whether one value is larger or smaller
than another.
On the other hand, a float
or real data type is used for numeric values that include fractions or
decimal points, and these values are typically stored in a floating-point
format. Operations involving floating-point numbers are generally similar to
those for integers, but because of the different encoding and mathematical
representations, the underlying processes used by the computer differ
significantly when performing actions like addition or multiplication.
Programming Languages: Data Structures
In addition to data types, variables are frequently associated with a concept
called data structure, which describes how data is conceptually arranged
and related. Data structures help organize data in a way that reflects the
real-world scenario a program is modeling. For example, plain text is usually
represented as a long sequence of characters, while data like sales records are
often visualized as tables with rows and columns, where each row might
correspond to a specific salesperson, while each column could represent sales
data for a particular day or product.
A widely used data structure is
the array, designed to hold multiple elements of a uniform data type in an
orderly and systematic manner. Arrays can be one-dimensional lists (like a list
of names), two-dimensional tables (like a grid of numbers), or even extend to
three or more dimensions if needed. In many programming languages, when an
array is declared, the programmer must specify not only the type of data it
will hold but also the size or length of each dimension. This ensures that the
programming environment knows exactly how much memory to reserve and how to
access individual elements within the structure.
Software Engineering: Cohesion
While managing variables and data structures is essential for writing
functional programs, good software design also requires careful structuring of
how different parts of the program relate to one another. In particular, it is
important to limit how much different modules depend on each other (low
coupling) and to strengthen how well the individual parts of a single module
work together (high cohesion). The concept of cohesion describes how
closely related the tasks within a single module are.
A module with high cohesion is
easier to maintain and extend, as all its components are focused on a single,
well-defined task. If a module contains too many unrelated activities, making
changes or fixing bugs can become unnecessarily complicated, potentially
leading to errors or inconsistencies. Consequently, achieving high cohesion is
a crucial objective in the practice of software engineering.
A particularly strong form of
cohesion is called functional cohesion, where every element of the
module directly supports one core activity. In structured programming, this is
often achieved by delegating subtasks to other modules and using these smaller
modules as tools. For example, in a simulation of a tennis game, a module named
Control Game might be responsible for overseeing the flow of the entire
game, while using separate modules to handle specific tasks like serving,
returning the ball, and keeping score. This division of responsibilities allows
each module to maintain a clear purpose and ensures that they work together
seamlessly.
Another important concept related
to software design is information hiding. This idea reinforces the
principle of abstraction by treating modules as “black boxes” that perform a
task without exposing their internal workings to other parts of the program.
This not only makes the system easier to understand and maintain but also helps
prevent accidental changes to parts of the program that should remain
untouched. Like a protective casing for sensitive electronics, information
hiding shields the core logic and keeps the program stable and secure.
Internet Architecture
The Internet is basically a system made up of interconnected networks, and
these networks are operated and maintained by Internet Service Providers
(ISPs). Often, people refer to these networks as ISPs themselves. For example,
when we say we’re connecting to an ISP, it means we’re actually connecting to
the network that the ISP manages.
The networks run by ISPs can be organized in a layered structure based on
their function within the Internet’s overall framework. At the highest level,
there are only a few top-tier ISPs that provide the core backbone services.
These are massive, high-speed, global networks and form the Internet’s
backbone. They’re usually operated by major companies that started out in
traditional communication services, like phone companies, and later branched
out into broader data and Internet services.
Internet Addressing
For the Internet to function
properly, it needs a system to assign unique addresses to each computer. These
unique addresses are called IP addresses. Originally, IP addresses were 32 bits
long, but with the growing need for more addresses, a shift to 128-bit IP
addresses is in progress.
Blocks of these IP addresses are
distributed to ISPs by an organization called the Internet Corporation for
Assigned Names and Numbers (ICANN). ICANN is a nonprofit group that coordinates
key aspects of the Internet. Once an ISP gets a block of IP addresses, it can
allocate those addresses to devices and users within its coverage area. This
system guarantees that each device connected to the Internet has its own unique
IP address.
Even today, many small groups and
individuals want an online presence but don’t have the technical or financial
resources to manage their own networks. For example, a local chess club may
want a website like KingsandQueens.org. However, setting up and maintaining
their own network would be too costly. In such cases, they can rely on their
ISP’s infrastructure to create the appearance of having their own domain,
without actually needing to own the network or servers themselves.
Conclusion
In conclusion, understanding how to manage variables and data types, organize data structures, and design modules with strong cohesion and proper information hiding are fundamental to developing high-quality software. By carefully applying these concepts, programmers can create systems that are not only functional and efficient but also easy to update and maintain over time. Such thoughtful design lays the groundwork for reliable and adaptable software that can evolve alongside changing needs and technologies.
CS101 Final Term Past Papers 2025, cs101 final term past papers, cs101 final term short notes
0 Comments