0% found this document useful (0 votes)
39 views

Solved - Assessment - Computer Science

This document contains questions about computer science topics like pointers in C++, deadlocks in operating systems, creating an HTML form, explaining the Agile software development methodology, and calculating maximum data rate for network users. Detailed answers are provided for each question explaining key concepts and providing code examples where applicable.

Uploaded by

sauravifas
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Solved - Assessment - Computer Science

This document contains questions about computer science topics like pointers in C++, deadlocks in operating systems, creating an HTML form, explaining the Agile software development methodology, and calculating maximum data rate for network users. Detailed answers are provided for each question explaining key concepts and providing code examples where applicable.

Uploaded by

sauravifas
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

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.
- Directly access the address of another variable using the pointer variable.
- Also modify the value of variable pointer is referring to.

Syntax:

string varName = “tempName” ;


string *var = &varName;

Example of pointer :

// Pointer in cpp

#include<iostream>

using namespace std ;

int main (){


// Declare the int variable
int straive = 10;

// Declare the pointer variable


int* ptr;

// Assign the address of int to pointer


ptr = &straive;

// print values of variables

cout<<"Value stored in straive before update: "<<straive<<endl;

cout<<"Address stored in pointer variable: "<<ptr<<endl;

cout<<"Value stored in variable to which pointer is referring :"<<*ptr<<endl;


// update the value of variable, pointer is referrring

*ptr = 20;

cout<<"Value stored in straive after update: "<<straive<<endl;

return 0;
}

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

Resources
X y

- 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.

Answer:

- Agile software development methodology is modern software development


methodology.
- It is iterative development model where software is break into smaller parts and
developed individually.
- It is iterative development model so once an iteration is completed next iteration
comes in focus.
Phases of agile development model:

- Requirement analysis
In this phase, requirements are defied, time and cost required to complete the project
is analysed based on business point of view.

- Design and Documentation


In this phase, you design the architecture of the project. This phase defines roadmap
of development.

- Development
In this phase, actual software development takes place. Actual coding is done in this
phase. Software model is developed, and project is undergoing multiple state
verification.

- Quality assurance
In this phase project undergoes the quality testing and improvement, quality assured
in phis phase. Once stakeholders are satisfied then project is forwarded to deployment
phase.

- Deployment
In this phase team issues the software to work in the user’s environment.

- Feedback
In this phase, users’ feedback and any new requirement is collected.

In waterfall model as name indicates this is a linear method, phases in this method are
irreversible. Once project undergo one phase, we cannot come to that phase again.

Agile development model consists of user feedback.


There is no concept of the feedback in waterfall model.

Agile method is iterative method, project can undergo multiple iterations.


Waterfall model is not an iterative method.

In Agile method project is break into smaller parts and worked on each part independently.
Whole project is considered as one product in 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.
Answer:
P0
Given :

Total bandwidth = 1 Gbps (Gigabit per second)


Network shared among number of users = 50
Maximum data rate (in Mbps) per user =?

Conversions :

1 Gbps = 1000 Mbps

Calculations:

Maximum data rate = Total bandwidth / Number of users

Maximum data rate = 1Gbps / 50

= 1000 Mbps / 50

Maximum data rate = 20 Mbps per user

You might also like