You are on page 1of 3

Computer science – Assessment questions – Level 2 – Set 1

Things to be followed while answering the questions.


 Please provide elaborate answers for each question.
 Kindly provide plagiarism-free answers.
 For programming questions, user comments, and sample output are mandatory.
 For calculation, formulas used to solve the problems, step by step approach while
solving the solution must be provided.

Question 1: Explain the concept of pointers in C++. Provide a program example of how
pointers can be used to manipulate data and access memory locations.

Answer:
Pointers in cpp is nothing but the special type of variable which stores memory
address of other variables.

We can create pointer variable by using the asterisk(*) sign.


Syntax:

string varName = “tempName”;


string *var = &varName;

Example of pointer :

Question 2: Explain the concept of deadlock in operating systems. Provide an example of a


deadlock situation and discuss potential strategies to prevent or resolve deadlocks.

Answer:

Deadlock is a situation in which one or more processes are holding resources and waiting for
another resource which may cause system failure.

A B Processes

Holds
Holds

Request Request

X y
Resources
- Here in above example process A is holding resource x and waiting for the resource y,
while at the same time the process B holds the resource y and requests for resource x.
- In above situation process need an access to the requested resource to execute.
- But no one of them is willing to relieve the resource acquired by them.
- This situation leads to a deadlock.

Strategies to avoid deadlock:


- We can assign the required resources to the process before the execution starts.

Question 3: Create a simple HTML page with a form that includes input fields for name,
email, and a submit button. On submitting the form, display a message showing the entered
information.
Answer:

<!DOCTYPE html>
<html >
<head>
<title>Straive Assignment</title>
</head>
<body>

<div class="straiveAssignmet">
<form action="">
<!-- input fields for entering name and email values -->
<label for="Name">Enter your name:</label>
<input type="text" id="name">
<br> <br>
<label for="email">Enter your email: </label>
<input type="email" id="email">
<br> <br>
<input type="button" value="Submit" onclick="straiveFunction()">
<!-- paragraph where we display information -->
<p id="spn1"></p>
<p id="spn2"></p>
</form>

<!-- javascript function to display information on screen -->


<script>
function straiveFunction(){
var a = document.getElementById("name").value;
var b = document.getElementById("email").value;

let text1 = "Your name is "+ a;


document.getElementById("spn1").innerHTML = text1;
let text2 = "Your name is "+ b;
document.getElementById("spn2").innerHTML = text2;
}
</script>
</div>

</body>
</html>

Question 4: Explain the Agile software development methodology. Discuss its advantages
and how it differs from the traditional Waterfall model.

Question 5: A network has a total bandwidth of 1 Gbps (Gigabit per second). If the network
is shared among 50 users, calculate the maximum data rate (in Mbps) that each user can
achieve if they are all using the network simultaneously.

You might also like