Write an algorithm using pseudocode to check the age and height of a child who wants to go on a fairground ride. The child's age must exceed 7, but below 12, their height must exceed 110 cm, but below 150 cm.
Minimal Absolute Difference
There are N pyramids in a line.You are given their heights as a list of integers.Write a program to find the minimum absolute difference between the heights of any two different pyramids.
Input
The input is a single line containing space-separated integers.
Output
The output should be a single line containing the minimum absolute difference of any two different pyramid heights.
Explanation
Given Pyramid heights are 7 1 5.
The absolute difference between the heights of any two different pyramids are
given an object person containing a person details, write a JS program to log the name, address & nicknames count
input
{ 'name':'Pranay', 'address':{'city':'Mumbai','state':'maharastra'}, 'nicknames':['nani','chanti']}
output
pranay is from mumbai,maharastra
pranay has 2 nicknames
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStdin) => {
inputString += inputStdin;
});
process.stdin.on("end", (_) => {
inputString = inputString
.trim()
.split("\n")
.map((str) => str.trim());
main();
});
function readLine() {
return inputString[currentLine++];
}
function main() {
let person = JSON.parse(readLine().replace(/'/g, '"'));
/* Write your code here and log the output */
}
Mention and explain each field of IPv4 header in detail, by taking suitable examples.
Find the first address, last address and the number of addresses of a network whose one
of the IP addresses is 50.28.22.75 / 25.
In the IPv4 Header format following information is given in decimal number system, with
respect to the given information calculate the header checksum value. (10)
VER=4
HLEN =6
Service type=9
Total length=26
Identification=2
Flag=3
Fragmentation offset=0
Time to live=5
Protocol=12
Source IP Address=11.13.12.6
Destination IP Address=10.6.8.11
Write a program that receives one command-line argument: the name
of a text file. Your program will work as follows:
Start out by creating a child process.
The child process calls exec to run cat command with command-line argument that
the parent received.
The parent process calls wait so that it blocks until the child terminates and passes
back its termination status.
If the child process terminates without error, the parent spawns another child and,
again, calls wait so that it can block until the child terminates.
The new child calls exec again, but this it runs wc command on the same
the argument that the parent received from the command line.
Once the parent learns that the child has been terminated, it goes on to terminate also. If
the parent gets to this point, it’s because all has gone well.
How many number of processes will be created in the following
program? Prove your answer by making a replica code that will count no
of processes created.
int main()
{
fork()
fork()
fork()
fork()
}
Develop a stopwatch with a lap counter and a total time calculator. The
program will create two processes and they will start calculating time.
One process will be used to calculate total time and the other will calculate
lap time. The total time calculator process will keep on calculating time.
In the lap time, the calculator process when it reaches lap time limit, the
process will display lap number and set its counter to zero and start
calculating again. Take input of lap time and the number of laps from the user
and start the program. In the end, display the total time from the total time
calculator process.
Write a program that takes a string from the user and you have to do
following tasks with the string:
1. Reverse
2. Find Length
3. Sort
You have to create a child of child’s as given below process tree for each task and
each child exec with the image of the program of a particular task. Print the string after
each operation.
P->C->C->C->C->C