Questions: 856

Answers by our Experts: 763

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Question 4

A) Write a shell script that does the following

Allows the user to enter seven urls into a text file.

Check to see the status of the links as in whether they are working or not Write the name of the url and it’s status into another file.

Append to the file how many urls are working and how many are broken.

[10 marks]

B) With a working example show how IO Redirection works in shell scripting. [7marks]

C) With examples show how each of these external commands work  Awk

  Sed  Grep

D) Why would this process give an error

1) first create the file

touch my_example.sh

2) open it in an editor

gedit my_example.sh

3) write some code

#!/bin/sh

echo “Shell scripting is fun.” 4) run the file ./my_example.sh




Question 3

Write a shell script that allows a user to write a nursery rhyme directly from the CLI and have the rhyme stored in a text file.

Your script should then replace all vowels in the rhyme with the letter “t”

Your script should also count the number of lines in the rhyme

Your script should make a copy of the text file and append all the characters of the first file into the second file into it.

Then delete all the contents of the first file.


 

  B) Give four working examples of how to use grep in shell scripting,


C) list all hidden files in the present working directory showing all hidden files and in the long format


D) Explain the difference between ls -l > mylisting.txt and ls -l >> mylisting.txt [4 mar


Question 2

A) The AIT canteen wants you to write a script for them which would do the following

I) receive records from the user and keep these records into a file, the records must include

 ID

 Name of meal

 Price of meal

 Quantity bought today

 Sales made for the day

 2

 

  Today the sales person wants to make seven entries into the file via the command line interface.

Your script should be able to find to present the sales person with the ability to

 Search for a particular meal by ID

 Search for a particular meal by name

 find out how much money has been made from the sales of a particular

meal

 list all records

 list all meals and their prices

 list a particular meal and its price

B) With a shell script explain how to use case

C) With code explain how the following work

 if statements

 if else statements

 if elif else fi statements


D) Explain the difference between= grep -i "some string" some file and grep -iw "some string" some file

[


Question 1

A) Write a game entirely in shell script which generates an unknown number and prompts the player to enter a number. Your game should receive the number and compare it to the generated number, let your game tell the player whether the number entered is higher than or lower than the hidden number until the player is able guess the number or quit the game, upon guessing the right number the game should congratulate the player for winning and tell the player how many attempts were made before guessing the right number.


B) Write a shell script that uses a function to count the number of files in the present working directory and output their number to the screen.


 C)Explain with examples how to make variables available to child processes/shells


D) Many beginners are confused about the difference between the working of touch and of cat, could you please make the difference clear with an example


Question 3


(a) Using the AIT Lemass as an example, discuss practically the Quality of Service (QoS) levels in the areas that are measured when determining 3 the performance of a system. If any of the areas measured has a poor quality of service, discuss what could be done to improve upon its quality of service.


(b) Discuss practically the server form factor(s) you would consider for AIT and justify your choice with reasons


(c) Using the AIT Internet provision for lectures to be streamed online as a case study, discuss the kind(s) of challenge(s) faced by lecturers (e.g IT101) using the Internet service(s) provided by the school for the online streaming and its impact on students (both on campus and at home/hostel). Discuss what you think could be done to resolve such challenge(s).. 


Question 4

A. Consider a problem to find the student who had the highest GPA for the 2020/2021 academic year.

i. Explain your choice of either a search or a sorting algorithm to solve this problem. [7.5 marks]

ii. Write the algorithm for your implementation. [7.5 marks]

B. Consider the analogy of a pile of books on a table. Using a diagram, explain the basic operations involved in adding a book to the pile and removing a book from the pile. [5 marks]

C. Use the code below to answer the questions that follow: [5 marks] public class CS204 { public static int linearSearch(int[] data, int target) { for (int i = 0; i < data; i++) { if (target == data[i]){ return i;

5

} } return -1; } public void main(String[] args) { int[] data = {3, 14, 7, 22, 45, 12, 19, 42, 6}; System.out.println("Search for 7: " + linearSearch(7)); } }

i. Why is method linearSearch declared static?

ii. Identify and resolve the errors in the code.


Question 2

A. A module is required to enable lecturers to easily identify the highest and lowest performing students in their courses. As the lead programmer, write a java program to achieve this. Your program should have the following features:


i. The program should make use of a sentinel to control the number of grades entered.

ii. Total Number of grades entered

iii. The average of the grades

iv. Number of students that achieved a grade of 80 and above

v. Number of students that achieved a grade of 50 and below

[15 marks]

B. An algorithm is a procedure for solving a problem in terms of the actions to execute and the order in which these actions execute. Write an algorithm for the implementation of the sentinel control in Question A Sub Question I above. [5 marks]

C. For larger datasets, a linear search may be inadequate or perhaps inefficient. What other search method can be employed to return the maximum number from a set of elements in an array. Explain your answer.

Question 1

A. Write a java program that reads three (3) int variables and performs the below operations:

i. Prints out their product

ii. Prints out the maximum of the numbers

Do not use any inbuilt Java Methods to return the maximum.

Extra marks will be awarded for clarity of code and comments.

[8 marks]

B. Algorithms perform differently on different data sets and as such we may be interested in either their Best-case, Worst-case or Average-case scenarios. Explain why the Worst-case for an insertion sort is with reverse-sorted data. [6 marks]

C. Identify and correct the errors in each of the following sets of code: [6 marks]

i.

while ( c <= 5 )

{

product *= c;

++c;

ii.

if ( gender == 1 )

System.out.println( "Woman" );

else;

System.out.println( "Man" );

iii. What is wrong with the following while statement?

while ( z >= 0 )

sum += z;

D. Explain two (2) programming situations that will require the use of overloaded


A. Consider a problem to find the student who had the highest GPA for the 2020/2021 academic year.


i. Explain your choice of either a search or a sorting algorithm to solve this problem.


ii. Write the algorithm for your implementation.


B. Consider the analogy of a pile of books on a table. Using a diagram, explain the basic operations involved in adding a book to the pile and removing a book from the pile.


A. Consider a problem to find the student who had the highest GPA for the 2020/2021 academic year.


i. Explain your choice of either a search or a sorting algorithm to solve this problem.


ii. Write the algorithm for your implementation.


B. Consider the analogy of a pile of books on a table. Using a diagram, explain the basic operations involved in adding a book to the pile and removing a book from the pile.


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS