Eit 12345
Eit 12345
A1 1, 2, 3, 4, 5
A2 2, 4(first half), 5, 6, 7(define CPU register),9
A3 2, 3, 4, 5, 6, 7
A4 1, 2, 4, 7, 10, 11, 13
A5 1, 4, 8, 9
Assignment 1
12345
Programming Paradigms
10 October 2023
18:47
Python:
- used in web development, data analysis, machine learning, artificial intelligence,
scientific computing, and automation.
C++:
- combines low-level and high-level features.
- Used in systems programming, game development, embedded systems, and
performance-critical applications.
Java:
- portable and platform independent (write once, run anywhere).
- Used in enterprise-level applications, Android app development, and web services.
JavaScript:
- scripting language used mainly for web development.
- Enables client-side scripting for web browsers and server-side scripting with Node.js.
- Used to create interactive and dynamic web applications.
C# (C-sharp):
- Developed by Microsoft
- used in game development with Unity, Windows desktop applications, and web
development with ASP.NET.
Ruby:
- Known for its elegant syntax and productivity.
- Commonly used in web development with the Ruby on Rails framework.
Go (Golang):
- Created by Google
- Used for building scalable and high-performance systems, web services, and cloud-
based applications.
PHP:
- Mainly used for server-side scripting in web development.
- used with databases to create dynamic websites.
R:
- Specialized for statistical analysis, data visualization, and data science.
Usability:
HCI aims to create systems and interfaces that are
easy for users to learn,
efficient to use,
provide a satisfying user experience.
Productivity:
Effective HCI design can enhance user productivity by
minimizing errors,
reducing the time required to complete tasks,
User Satisfaction:
HCI seeks to create systems that users find
enjoyable, intuitive,
and aesthetically pleasing,
leading to increased user satisfaction
1. Consistency: Maintaining a consistent design across an interface ensures users can easily
understand and use the system.
2. Feedback: Providing timely and informative feedback helps users understand the
consequences of their actions and reinforces learning.
3. Flexibility: Designing interfaces adapted to user needs, preferences, and abilities increases
usability.
4. Error Prevention and Recovery: Minimizing the chances of user errors and providing
straightforward ways to recover from them are essential for a positive user experience.
Gesture-Based Interfaces
Gesture-based interfaces detect and interpret user gestures, such as swipes, pinches, and
taps, as input. These interfaces are standard in touchscreens and motion-sensing devices like
the Microsoft Kinect.
Haptic Interfaces
Haptic interfaces provide tactile feedback to users, simulating the sense of touch. They are
used in virtual reality systems, gaming controllers, and assistive technologies.
It is written in plain Solution that is more structured Code is a detailed, precise, and
language and focuses on and closer to code but still avoids executable representation of an
the logic and flow of the using specific prog. language algorithm or solution.
solution syntax.
Algorithms are language- Pseudocode helps developers It involves translating the logic
agnostic and can be plan and understand the logic of and instructions from an
implemented in various their code before writing it in a algorithm or pseudocode into the
programming particular prog. language.
chosen programming language.
languages.
In this algorithm, we have a The pseudocode is more The code is written in Python, a
clear step-by-step plan for structured than the algorithm specific programming language,
adding two numbers. It's and uses some programming-like and follows Python's syntax
written in
constructs (e.g., <- for and conventions. It takes user
plain language and doesn't assignment), but it is still not tied input, performs the addition, and
include specific to a specific programming displays the result.
programming syntax.
language's syntax.
Algorithm: AddTwoNumbers
Input: Two numbers, num1 and num2
Output: The sum of num1 and num2
1. Start
2. Read num1
3. Read num2
4. Calculate sum = num1 + num2
5. Display sum
6. Stop
Pseudocode: AddTwoNumbers
Input: Two numbers, num1 and num2
Output: The sum of num1 and num2
BEGIN
Read num1
Read num2
sum <- num1 + num2
Display sum
END
intnum1 = 5;
intnum2 = "3"; // Semantic error: Mixing int and stringintsum = num1 + num2;
C++ semantics dictate that you cannot mix integer and string types in this manner.
1. Integer (int):
o Represents whole numbers, both positive and negative.
o Examples: -5, 0, 42
2. Floating-Point (float):
o Represents numbers with fractional parts (decimal numbers).
o Examples: -3.14, 0.0, 2.71828
3. Character (char):
o Represents a single character, such as a letter, digit, or symbol.
o Examples: 'A', '7', '$'
4. String (str):
o Represents a sequence of characters.
o Examples: "Hello, World!", "12345"
5. Boolean (bool):
o Represents true or false values.
o Examples: True, False
6. List:
o Represents an ordered collection of values that can be of different data types.
o Examples (in Python): [1, 2, 3], ["apple", "banana", "cherry"]
7. Array:
o Similar to a list, but often with a fixed size and elements of the same data type.
o Examples (in C/C++): int arr[5], float prices[10]
9. Tuple:
o Represents an ordered, immutable (unchangeable) collection of elements.
o Examples (in Python): (1, 2, 3), ("red", "green", "blue")
10. Set:
o Represents an unordered collection of unique values.
o Examples (in Python): {1, 2, 3}, {"apple", "banana", "cherry"}
Compiled language follows at least two Interpreted language follows one step to get from
levels to get from source code to source code to execution.
execution.
The compiled programs run faster than The interpreted programs run slower than the
interpreted programs. compiled program.
n a compiled language, the code can be In Interpreted languages, the program cannot be
executed by the CPU. compiled, it is interpreted.
CLEO, COBOL, C, C++, C#, etc Python, BASIC, JavaScript, Perl, etc.
Assignment 2
Unit 2: Overview of OS and CPU Organization
245679
3. Describe how the CPU, memory, and I/O devices interact in a computer
system and how the operating system manages this interaction.
The accumulator register is used by the ALU ( arithmetic and logic unit ) to perform the
arithmetic and the logical operations performed by the CPU.
8. Discuss the characteristics and importance of the system bus in a
computer system, particularly its role in data transfer between
components.
9. Provide a basic block diagram of the interface between the CPU and
memory, highlighting the key components involved.
Assignment 3
Unit 4: HTML5
1 2 4 7 10 11 13
1. What does HTML stand for, and what is its primary purpose?
HTML (Hypertext Markup Language) is the standard markup language used to create
web pages.
It provides the basic structure and elements needed to represent content on the
World Wide Web.
The <base> tag defines an absolute (base) URL for all relative URLs.
o <style>:
contains CSS code that defines how HTML elements should be rendered in a
browser.
html
<img src="dinosaur.jpg" alt="Dinosaur" />
If the image was in an images subdirectory, which was inside the same directory as
the HTML page, then you'd embed it like this:
html
<img src="images/dinosaur.jpg" alt="Dinosaur" />
4. What is the <br> tag used for, and how is it different from the
<p> tag?
HTML HTML5
HTML does not provide native audio and video HTML5 provides native audio and video
support. support.
HTML only supports vector graphics if used in HTML5 supports SVG (Scalable Vector Graphics),
conjunction with different technologies like Canvas, and other virtual vector graphics.
Flash, VML, or Silverlight.
HTML allows inline MathML and SVG in text HTML5 allows inline MathML and SVG in text
with restricted use.
HTML doesn’t allow users to draw shapes such HTML5 allows users to draw shapes such as
as circles, triangles, and rectangles. circles, triangles, and rectangles.
HTML only uses browser cache and cookies to HTML5 uses web SQL databases, local storage,
store data temporarily. and application cache for storing data
temporarily.
JavaScript and browser interface run in the JavaScript and browser interface run in separate
same thread. threads.
Longer document type declaration. Shorter document type declaration.
Longer character encoding declaration. Uses Shorter character encoding declaration. Uses the
the ASCII character set. UTF-8 character set.
Compatible with almost all browsers. Only compatible with newer browsers,
considering there are many new tags and
elements which only some browsers support.
Built based on Standard Generalized Markup HTML5 has improved parsing rules providing
Language (SGML). enhanced compatibility.
<!DOCTYPE html>
<html>
<head>
<style>
th, td {border:1px solid black;}
table {width:50%;
border-collapse:collapse;}
</style>
</head>
<body>
<table>
<tr>
<th>book</th>
<th>author</th>
</tr>
<tr>
<td>book 1</td>
<td>author 1</td>
</tr>
<tr>
<td>book 2</td>
<td>author 2</td>
</tr>
</table>
</body>
</html>
7. How does HTML5 support multimedia content, and what are
the <audio> and <video> elements used for?
HTML5 features include native audio and video support without the need for Flash. The
HTML5 supports <audio> tag which is used to embed sound content in an HTML or XHTML
document as follows.
<!DOCTYPE html>
<html>
<body>
<video src = "video.mp4" width = "300" height = "200" controls>
</video>
<audio src = "audio.mp3" controls autoplay>
</audio>
</body>
</html>
<section> Tag: This tag is used to split a page into sections like Introduction, Contact Information,
Details, etc and each of these sections can be in a different <section> tag. The <section> tag is
introduced to wrap-up the things in a particular section.
<article> Tag: This tag contains independent content that doesn’t require any other context. So the
<article> tag can be placed inside the main content. But each of the articles will contain independent
content within it.
The website footer is the section of content at the very bottom of a web page. It
typically contains a copyright notice, link to a privacy policy, sitemap, logo, contact
information, social media icons, and an email sign-up form. In short, a footer
contains information that improves a website's overall usability.
<header>
<h1>The header element</h1>
</header>
<footer>
<p>The footer element<br>
</footer>
11. What is the HTML5 <nav> element used for, and why is it
essential for web accessibility?
The <nav> HTML element represents a section of a page whose purpose is to
provide navigation links, either within the current document or to other documents.
Common examples of navigation sections are menus, tables of contents, and
indexes.
<nav class="nav">
<ol>
<li><a href="#">Bikes</a></li>
<li><a href="#">BMX</a></li>
</ol>
</nav>
Alt tags provide context to what an image is displaying, informing search engine
crawlers and allowing them to index an image correctly.
Assignment 4
Basics of C Programming
A3 2 3 4 5 6 7
int x = 5;
float x = 5.99;
char x = 'D';
double x = 16.5885;
apsu
array
int numbers[5]; // Declares an integer array with a size of 5 elements
pointer
int *ptr; // Declares a pointer to an integer
void
void print() { printf("Hello"); }
void return type function does not produce a value. A void function executes a task or action and
ends rather than returning a value.
3. Write a C expression that calculates the area of a rectangle using the formula:
`area = length * width`. Assume `length` and `width` are variables.
4. #include <stdio.h>
5. int main(){
6. int height=5;
7. int width=6;
8. int area=width*height;
9. printf("area of the rectangle = %d",area);
10. }
#include <stdio.h>
int main(){
int height;
int width;
11. Explain the difference between the `++i` and `i++` increment operators in
C. Provide an example for each.
In C, ++ and -- operators are called increment and decrement operators. They are unary operators
needing only one operand. Hence ++ as well as -- operator can appear before or after the operand
with same effect.
i=5;
i++;
printf("%d",i);
and
i=5
++i;
printf("%d",i);
However, when increment expression is used along with assignment operator, then operator
precedence will come into picture.
i=5;
j=i++;
In this case, precedence of = is higher than postfix ++. So, value of i is assigned to j before
incrementing i. Here j becomes 5 and i becomes 6.
i=5;
j=++i;
In this case, precedence of prefix ++ is more than = operator. So i will increment first and the
incremented value is assigned to j Here i and j both become 6.
#include <stdio.h>
int main() {
int i=5,j;
j=i++;
printf ("
after postfix increment i=%d j=%d", i,j);
i=5;
j=++i;
printf ("
after prefix increment i=%d j=%d",i,j);
return 0;
}
after postfix increment i=6 j=5
after prefix increment i=6 j=6
A pointer is a variable that stores the memory address of another variable as its value.
A pointer variable points to a data type of the same type, and is created with the * operator.
8. #include <stdio.h>
9. int main (){
10. int x = 5; // An int variable
11. int* ptr = &x; // A pointer variable, with the name ptr, that stores
the address of x
12. printf ("%d", x); // value of x
13. printf ("%p", &x); //memory address of x
14. printf ("%p”, ptr); //memory address of x with pointer
15. printf ("%d”, *ptr); // value of x
16. return 0;
17. }
18. 5 0061FF18 0061FF18 5
Assignment 5:CSS3
4 8 9 10
1
A5 2
1. Define CSS3 and its role in web development. How does CSS3 differ from its
previous versions?
Introducing CSS3:
CSS3 (Cascading Style Sheets 3) is the latest iteration of the CSS language. It introduces a wide
range of new features and enhancements to enable more advanced and interactive web page
styling.
DIFFERENECE
CSS3 includes new selectors, layout modules, animation and transitions.
allows for more complex and specific styling,
CSS3 allows for the use of media queries, which enables developers to create responsive
designs that adapt to different screen sizes.
Include new viewport units
Inset property
Accent colour property (style checkbox and radio buttons in form)
Gap property in flexbox
Selector :has()
CSS was first introduced in the late 1990s as a way to separate content from
presentation on the web. It went through several versions, with CSS3 being the latest
and most feature-rich iteration.
1994- HÃ¥kon Wium Lie proposed the idea of CSS.
1996- The first version of CSS was invented.
7. Discuss the significance of fonts on the web and the role of font services.
Name a popular font service.
Web fonts allow designers to use custom fonts that may not be available on all
user's computers.
They can be loaded from external font services or included directly in the
website's files.
Font services provide a platform for hosting and delivering fonts to websites.
Popular services include Google Fonts, Adobe Fonts, and Typekit.
8. What is the @font-face rule in CSS3, and how does it allow web designers to
use custom fonts?
The @font-face rule in CSS3 allows you to specify custom fonts for a web page.
This rule enables you to use fonts that that aren't traditionally available on the
user's system.
With the @font-face rule, web designers do not have to use one of the "web-
safe" fonts anymore.
You must first define a font named "myFirstFont", and specify the URL where it
can be found:
@font-face {
font-family: myFirstFont;
src: url(sansation_light.woff);
}
To use the font for an HTML element, refer to the name of the font (myFirstFont)
through the font-family property:
div {
font-family: myFirstFont;
}
BACKGROUND IMAGE:
CSS3 enables the addition of background images to elements.
This can be used to enhance the visual appeal of a webpage or to add branding
elements.
MASKS:
With CSS masking you create a mask layer to place over an element to
partially or fully hide portions of the element.
CSS3 introduces masking techniques that allow you to apply effects to
images or other elements. This includes alpha masks, luminance masks,
and more.
mask-image Specifies an image to be used as a mask layer for an element
mask- Sets the starting position of a mask layer image (relative to the
position mask position area)
.mask1 {
mask-image: linear-gradient(black, transparent);
};
GRADIENTS:
Gradients provide a smooth transition between two or more colors, allowing
for dynamic and visually appealing backgrounds.
CSS defines three types of gradients:
Linear Gradients (goes down/up/left/right/diagonally)
Radial Gradients (defined by their center)
Conic Gradients (rotated around a center point)
Background image:
1. The background-image property specifies an image to use as the
background of an element.
body {
background-image: url("paper.gif");
}
<img src="dinosaur.png">
img {
mask-image: linear-gradient(red, transparent);
}
Uses
video{
mask-image: url(mask2.png);
mask-repeat: no-repeat;
mask-position: center;
mask-size: 10%;
}
Fading an image
Masking text content
Masking list