Write a program which take string from user and you have to do following tasks with the string:
1. Reverse
2. Find Length
3. Sort
You have to create child of child’s as given below process tree for each task and each child exec with the image of program of particular task. Print the string after each operation.
P
C
C
C
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 lap counter and 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, 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 number of laps from the user and start the program. At the end, display total time from total time calculator process.
Analyze the following Java Program and complete the missing codes:
public class Tut1_17032021_Qb {
public static void main(String[] args){
String name;
String AssessedValueString;
String outputStr;
name = JOptionPane.showInputDialog("Enter Property Name and press ok!");
AssessedValueString = JOptionPane.showInputDialog("Enter Assessed value and press
ok!");
AssessedValue = Double.parseDouble(AssessedValueString);
TaxableAmount = AssessedValue*TaxablePercentage;
PropertyTax = (TaxableAmount/100)*TaxRate;
outputStr = "Property Name: " + name + "\n" + "Assessed Value: R " + AssessedValue + "\n"
+
"Taxable Amount: R " + TaxableAmount + " \n" + "Tax Rate for each R100.00:
" + TaxRate + "
\n" + "Property Tax : R " + PropertyTax;
JOptionPane.showMessageDialog(null, outputStr, "Mafikeng Local Municipality",
JOptionPane.INFORMATION_MESSAGE);
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 program will need to calculate the final mark and corresponding grade and letter
grade based on the information given below.
• The final mark is derived from the following components of the assessments.
• Result calculation is based on information below:
o Exam (50%)
o Coursework (50%) components are made up of the total from the mid term test
(20%), programming assignment (15%) and lab practice (15%).
▪ Courseworks = Mid term test * 0.20 + Lab Practices (total marks /
150) * 0.15 + Programming Assignment * 0.15
▪ Final Mark = Exam * 0.5 + Courseworks
• Your program should also display the letter and letter grade based on the table
below:
Table A: Grade
MARKS
GRADE
Letter
Grade
Percentage
75 to 100
Distinction
A
80 - 100
A-
75 - 79Page 4
60 to 74
Credit
B+
70 - 74
B
65 - 69
B-
60 - 64
50 to 59
Pass
C+
55 - 59
C
50 - 54
0 to 49
Fail
C-
45 - 49
D
40 - 44
F
0 - 39
Write a program to find sum and average of three values using override method and overload method.
CSS Border Properties
The goal of this coding exam is to quickly get you off the ground with the CSS Border Properties.
Use the below reference image.
https://res.cloudinary.com/dfxicv9iv/image/upload/v1619085330/css-border-properties-output_a4ucou.png
Achieve the design by using CSS border
border-* properties. The * indicates the direction.Apply the border shorthand property with the width
CSS Colors used:
#184b73
#ffffff
HTML code:
<body>
<div class="d-flex flex-column">
<button class="button border-shorthand">border shorthand</button>
<button class="button border-top-none">border top none</button>
<button class="button border-bottom-none">border bottom none</button>
</div>
</body>
Your younger brother is studying in school. His computer teacher gives homework to make a calculator for six operations: addition, subtraction, multiplication, division, power, and modulo on two integers. As you are about to become an engineer, so he expected help from your side to develop the program. Therefore, write Calc.py module that define a separate function for implementing all the above-mentioned operations. Then import Calc.py in your RollNo_W12A_1.py file. In RollNo_W12A_1.py, define a function Arithmatic(a, b, op) which calls the respected function defined in Calc.py to perform the required operation. Also handle the possible exceptions and display the
Example-1
Example-2
Example-3
Example-4
Input:
5
6
+
Output:
11
Input:
15
9
*
Output:
135Input:
15
9
&
Output:
Invalid operation
Input:
2
4
^
Output:
16
Sanjay identifies that for compiler designing he need to implement tokenization of a specific line of program. As a friend of Sanjay, your task is to help him to write a python function Tokenize_Line(fname, n) which reads nth line from prime.py file and returns a list containing all tokens of that line as shown in the example. Also, handle the possible exception and provide proper message.
Contents of prime.py file will be like:
from math import sqrt
n = 1
prime_flag = 0
if(n > 1):
for i in range(2, int(sqrt(n)) + 1):
if (n % i == 0):
prime_flag = 1
break
if (prime_flag == 0):
print("true")
else:
print("false")
else:
print("false")
Input:
prime.py
10
Output:
['print("true")
']Input:
prime1.py
8
Output:
File Doesn't Exist
Input:
prime.py
6
Output:
['if', '(n', '%', 'i', '==', '0):']
Input:
prime.py
100
Output:
Invalid Line no.