T1A1 - Workbook

Q1: Research the development of the internet from 1980 to today. You must describe at least FIVE key events in the development of the internet. You can refer to events, people of significance, or technologies and how they have changed over time.❓

❇ Ans:

1. 1985 - DNS:

DNS, or the Domain Name System is like a phone book for the internet. When we type a domain name on the browser like google.com, DNS translates the URL into an IP address so that the browser can contact to that address to request online contents.

Before DNS, people had to remember IP address to get information from the internet. DNS made internet use easy and user friendly.
DNS info link

2. 1989 - WWW:

WWW, or the world wide web is the collection of online contents where each content is in HTML format and we can access it via web browsers using the internet.

Sir Tim Berners-Lee invented the world wide web in 1989 to easily share experiment data with fellow scientists. He relied on three main technologies namely HTML (Hypertext Markup Language), URL (Uniform Resource Locator), and HTTP (HyperText Transfer Protocol) to make www work.

WWW info link

3. 1991 - First web page created

Berners-Lee first published public website in 1991. The purpose of the website was to explain what the world wide web is and the use of it.

This is really an important event because despite having the opportunity to sell the technology, Sir Berners-Lee makes it an open source and made a great contribution for a better connected world.

source

4. 2005 - YouTube:

YouTube is a video sharing platform based on America but widely popular throughout the earth. Chad Hurley, Steve Chen, and Jawed Karim co-founded YouTube in 2005. It started as an entertainment video sharing platform but now-a-days we can find all sort of tutorials and educational material here. I belive YouTube has helped people to dream of a world where education will be free for everyone.

Youtube info link

5. 1995 - Internet phone:

Internet phones also known as broadband phone was introduced back in 1995 and was developed by Vocal Tech Communications Ltd. Similar to traditional phone, we use this technology for communication using voice but it uses the internet instead of electrical energy. It is most widely used Voice over Internet Protocol (VoIP) application device. It was one of the stepping stone for current days Skype, zoom, canvas, google meet etc.

Internet phone info


Q2:Define the features of the following technologies that are essential in terms of the development of the internet:

  • packets
  • IP addresses (IPv4 and IPv6)
  • routers and routing
  • domains and DNS

Explain how each technology has contributed to the development of the internet.❓

❇ Ans:

* packets:

Packets are how we get content from the internet. When we request a piece of information such as a website all the content arrives as a series of packets. Normally a packet has 1000 to 1500 bytes in it. Each packet contains information about its source, destination, how many packets are coming and the number of the particular packet. Packets help make internet faster as it breaks the whole content into smaller pieces.
source

* IP addresses:

IP Address, or the Internet Protocol Address is used to identify a unique machine on a network. When we request any information from the internet, the request contains our local machine IP address and the IP address where it can get the information. IP address like a physical address made it possible to send data to a destination.
source

* Routers and routing

Router is a network hardware that helps to connect home device with the internet. It is used as a first line of security to protect computer system and information from external attack. And routing is the process that routers use to find a path to send traffic.
source
source

* Domains and DNS

A domain name is a unique identifying address that is used to visit websites. And the Domain Name System or DNS is like a phone book for the internet. When we type a domain name on the browser like google.com, DNS translates the URL into an IP address so that the browser can contact to that address to request online contents.

source


Q3: Define the features of the following technologies that are essential in terms of the development of the internet:

  • TCP
  • HTTP and HTTPS
  • web browsers (requests, rendering and developer tools)

Explain how each technology has contributed to the development of client and server communication over the internet ❓:

* TCP:

TCP stands for Transmission control protocol. It maintains a connection with the host computer to the destination server via the port number with the guarantee to secure packets delivery. It considered as one of the main protocols of the Internet Protocol Suite as this makes sure the data is in the right order and none are missing. Which ensures the quality of communication between client and server.
source

* HTTP AND HTTPS

HTTP, or The Hypertext Transfer Protocol is an application protocol that help to transfer data over the World Wide Web. HTTP also clarify how data are formatted and transmitted. It also defines what response should a browser take when it receives the data. While HTTP is unsecured, HTTPS, or the Hypertext Transfer Protocol Secure is secured. It protects the integrity and privacy of the data during communication between server and client.
source
source

* web browsers:

A web browser is an application that we use to get content from the World Wide Web including webpages, images, video, and other files. When we request any information by typing domain address, it receives the requested content from the internet as HTML format and then display the information on a page. It makes communication between client and server really easy and user friendly.
source


Q4:Identify THREE data structures used in the Ruby programming language and explain the reasons for using each.❓

❇ Three Data structures Used in Ruby Programming are:

  • Array: An array is a collection that stores a list of values. It can store all kinds of items in a specific order unless something is done to change the order. The most useful function of an array is retrieving an element by the way of referring to its position. Setting a new element to a position or overwriting is another useful act of an array.
    info link ➡️ Array
  • Hash: A useful form of storing objects similar to a dictionary where values are signed to keys so that values can be looked up by their key. Looking up a value by the key is one big function of hash. Two hashes can be merged by using .merge method and the value can be retrieved later by using .fetch method.
    info link ➡️ Hash
  • Binary trees: The binary tree is an advanced level data structure of ruby that contains two child nodes that may include references to their parents.
    info link ➡️ Binary tree

Q5: Describe the features of interpreters and compilers and how they are different.❓

❇ Ans:

In the world of computer science to do any kind of work we need to send the command to the computer. If I assume that a member of human species lands on an alien planet with a broken spaceship. Now the human needs some help from the alien but no one understands others language. We need a "middle man" helping hand to translate the need of humans to the member of the fellow alien species. If we suppose the alien friend is the computer and the instruction list to fix the spaceship is the command to be passed on, this is where the explanation of "Interpreter" and "compiler" starts. Suppose there are two types of helping robots that can translate the situation in the alien language.

The interpreter will take the list of notes from humans and will translate it step by step to the alien language and then the alien fellow will do that step. This one step at a time method can keep going until the work is done. And if by any chance human gives a wrong note, there is enough time to correct that by giving the right notes to Interpreter and let the alien do it again until the work is finished happily. Though it is a little slower in the end the space ship is all ready to fly up high again without any bigger harm.

On the other hand, the Compiler will take the list of notes, will translate the whole at once, and will say bye-bye. All this might be a little more time consuming but after this everything is going to be very fast. After handing over the translated list to the alien friend, he can fix the spaceship so fast without any interruption. Now if the human gave some wrong instruction by mistake that was translated by the compiler, there is no way to stop the alien friend for correcting the problem because the compiler is not there anymore. So in the end, there is a big chance of doing big harm to that spaceship. The process seems faster but there is a big chance of doing it all wrong while working with the compiler.

This is the exact way the interpreter and the compiler work on the computer.

Interpreter:

The Interpreter is a computer program that starts right away, takes its time to run while translating the command, and gives the chance of fixing any mistakes by giving the chance of monitoring the result. The interpreter is always in between the program and the computer. It translates line by line.

Compiler:

The compiler is the program that takes an extra long time to prepare the translation all at once but after that, the program will run very quickly. Compiler piles together with the entire program and translates the whole thing all at once.

➡️ Source link for difference of interpreter and compiler


Q6: TWO commonly used programming languages and explain the benefits and drawbacks of each.❓

❇ Ans:

TWO commonly used programming languages:

  1. Ruby
  2. Java

Ruby:

  • Dynamicly typed language
  • Interpreted language
  • require statement is used to import a package or a module
  • null value is declared with nil
  • In Ruby, everything is an object

Java:

  • Staticly typed language
  • Compiled language
  • import statement is used to load a package
  • null value is declared with null
  • In Java, only classes have objects

Source link: Ruby, Java


Q7: Identify TWO ethical issues from the areas below and discuss the extent to which an IT professional is ethically responsible in terms of the issue.

List of topics containing ethical issues:

  • access to a user’s personal information (medical, family, financial, personal attributes such as sexuality, religion, or beliefs)
  • intellectual property, copyright, and acknowledgement.
  • criminal acts such as theft, fraud, trafficking and distribution of prohibited substances, terrorism
  • GPS tracking data and other types of metadata, MAC addresses, hardware fingerprints
  • freedom of thought, conscience, speech and the media
  • aggressive sales and marketing practices designed to mislead and deceive consumers
  • trading of shares on the stock exchange OR crypto-currencies

For each ethical issue identify a source of legal information relating to the ethical issue and discuss whether the law is helpful in assisting a developer to act in an ethical way.

Conduct research into a case study of ONE of the ethical issues you have chosen discuss how an ethical IT professional should respond to the case study and how they might mitigate or prevent ethical breaches.❓

❇ Ans:

I think the following two issues are relevent to IT professionals.

Access to user's personal information ( medical, family, financial, personal attributes such as sexuality, religion, or beliefs)

  • Australian privacy laws are contained in a variety of Commonwealth, State and Territory Acts. The "Privacy Acts" are data protection laws which regulate the collection, use and disclosure of personal information about individuals; they do not protect privacy of the individual in a broader sense. Many companies follow this and encript data and arrange training for developer to handle personal data carefully so that an individual developer can not access it. So In my opinion, there are enough knowledge out there for a developer to help with make a ethical decession.

GPS tracking data and other types of metadata, MAC address, hardware fingerprints.

  • Internet and other telecommunications services, ISPs and telephone service providers who mainly have access to user location, Mac address and hardware fingnerprints are also required to comply with the privacy protection provisions of the Telecommunications Act 1997 (C'th) and the Telecommunications (Interception) Act 1979 (C'th). A variety of other legislation contains privacy protection provisions relevant to particular types of entities and/or practices, for example, the Spam Act, surveillance and listening devices acts, and many others. Companies are pro active to follow this and encript data and arrange training for developer to handle personal data carefully so that an individual developer can not access it. So In my opinion, there are enough knowledge out there for a developer to help with make a ethical decession.

Case Study:

An investigation into Vodafone Hutchison Australia following allegations that customer information had been compromised showed that the company’s business model provided access to the company’s databases of customer information to dealership employees via a shared store login ID.

Although the use of shared logins and the wide availability of full identity information is an inherent personal information security risk, in this instance the risk was increased by the fact that the entity had less control over information being accessed through dealerships, and no way of tracking or auditing who was accessing the information.

To prevent this IT professional could flag that issue when building the feature and could suggest instead of showing the information without individuals permission, it could ask permisson from user weather they want to show their information on different dealership stores.
resource1
resource2


Q8:Explain control flow, using an example from the Ruby programming language❓

❇ Ans:

Control flow is a major programming concept. Like other different programming languages, Ruby also uses conditionals and loops to control the flow of any program. Conditionals help execute code for a specific condition. For example, if we have a program that will display 'cold' when the temperature is under 10 degrees and display 'hot' when the condition is above 30 degrees, we can use Ruby language's if elsif else statement to check the temperature and display the message. Loops help execute code multiple times. For example, if we want to display a message 100 times we can use Ruby languages 'times' method to do that.


Q9: Explain type coercion❓

❇ Ans:

Type coercion is a technique that is used in programming to convert one object to another object. This is widely used when a type of a piece of data needed to change in order to do some calculation or manipulation. For example, for an e-commerce online store, if the price of different items are saved as a string, we need to convert the price to a number before we can do any mathematical operation on it. In ruby we use.'to_i' to convert string to number. Likewise, we can also convert numbers to string using 'to_s'. Ruby also has other methods such as 'to_f', 'to_a', 'to_h' to convert data type.
source


Q10: Describe the data types recognised by the Ruby programming language. In your description you should give example code which uses each data type, and include the name of the Ruby classes which represent each data type. ❓

❇ Ans:

The data types recognised by the Ruby programming language are:

  • Numbers

Number is a series of digit represent a mathematical number. It uses a dot as a decimal mark and underscore as a separator. As an example to add two numbers Ruby uses number to perform a mathematical operation. There are different kinds of numbers like Integers and Float.

2 + 2.5 = 4.5
2.class = Integer
2.5.class = Float

source

  • Strings

String represents a sentence or word. If we wrap a group of letters or numbers by a single quote('') or double quotes(""), it converts to a string.

"2".class = String
'name'.class = String

source

  • Booleans

Boolean represent two states, either true or false. Ruby uses Boolean for conditional flows.

if true
    print 'this is true'
else
    print 'this is false'
end

true.class = TrueClass
false.class = FalseClass

source

  • Arrays

Arry is used to store a list of data and they can hold any type of data and they are ordered. For example, if we want to store seven days in an array, their index will always be same

days = ["Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
days[0] = "Sunday"
days.class = Array

source

  • Hashes

Hash is a key-value pair data structure which is commonly used to store data. For example, if we want to hold an user's information we can create a hash and store information like name and age as different pair. Keys can be a string, or a symbol, but the value could be any other data types.

user = {
  name: 'Isabela',
  age: 4,
}

user[:name] = "Isabela"
user[:age] = 4
user.class = Hash

source

  • Symbols

Symbols are used as a light weight and better performing alternative of string. But symbol can only represent a word, whereas string can represent sentences. The most popular use of the symbol as a key of hashes.

user = {
  :name => 'Isabela',
  :age => 4,
}
user.keys = [:name, :age]
user.keys.first.class = Symbol

source


Q11: Here’s the problem: “There is a restaurant serving a variety of food. The customers want to be able to buy food of their choice. All the staff just quit, how can you build an app to replace them?”

  • Identify the classes you would use to solve the problem
  • Write a short explanation of why you would use the classes you have identified ❓

❇ Ans:

Classes:

1. Menu :
Explanation:

Menu class wil hold the name of foods with asigned price of it so the customer can choose their food from the menu with the knowledge of price.

2.Customer:
Explanation:

Customer class will hold the details of each customer like, allargic alert, religous food choice, name, address, phone number so their favorite menu item could be saved for later.

3.Food:
Explanation:

Food class will hold description about food.Like the allergic ingredients alert, whole ingredients with the nutritional value of the item.

4.Orderlist:
Explanation:

Explanation class is here to hold chossen menu and sum up the bill for next time history showing and payment issue.

5.Ordertaker:
Explanation:

Ordertaker class takes order list to chef for preparing the food item.

6.Foodmaker:
Explanation:

Foodserver will cook the food.

7.Foodserver:
Explanation:

Foodmakre will serve the prepared food to the customer.

8.Paymentaker:
Explanation:

Paymenttaker takes the bill and gives change if required.

Q12: Identify and explain the error in the following code that is preventing correct execution of the program❓

​​​​ celsius = gets
​​​​ fahrenheit = (celsius * 9 / 5) + 32
​​​​ print "The result is: "
​​​​ print fahrenheit
​​​​ puts "."

❇ Ans:

Here, Celsius is storing a string as an input which can not be coerced into integer. The stored input needs to convert into integer.
The correct code is

​   celsius = gets.to_f
​   print "The result is: "
​   fahrenheit = (celsius * 9 / 5) + 32
​   print fahrenheit
​   puts '.'

Q13: The following code looks for the first two elements that are out of order and swaps them; however, it is not producing the correct results. Rewrite the code so that it works correctly. ❓

❇ Ans:

​arr = [5, 22, 29, 39, 19, 51, 78, 96, 84]
​i = 0
​while (i < arr.size - 1 and arr[i] < arr[i + 1])
​ i = i + 1 end
​puts i
​item = arr[i]
​arr[i] = arr[i + 1]
​arr[i + 1] = item

Q14: Demonstrate your algorithmic thinking through completing the following two tasks, in order:

i. Create a flowchart to outline the steps for listing all prime numbers between 1 and 100 (inclusive). Your flowchart should make use of standard conventions for flowcharts to indicate processes, tasks, actions, or operations
ii. Write pseudocode for the process outlined in your flowchart ❓

❇ Ans:

Flowchart:

Pseudocode:

Initialize a prime number collection
For each number from 1 to 100
  Initialize divisible counter to zero
  For each number from 1 to this number
    If that number is divisible by this number
      add one to the divisible counter
  If divisible counter is equal to two
    add this number to prime number collection 
print prime number collection

Q15:Write pseudocode OR Ruby code for the following problem:

You have access to two variables: raining (boolean) and temperature (integer). If it’s raining and the temperature is less than 15 degrees, print to the screen “It’s wet and cold”, if it is less than 15 but not raining print “It’s not raining but cold”. If it’s greater than or equal to 15 but not raining print “It’s warm but not raining”, and otherwise tell them “It’s warm and raining”. ❓

❇ Ans:

Ruby code:

def weather(temperature, raining)if temperature < 15if raining
​     puts "It’s wet and cold"else 
​     puts "It’s not raining but cold"endelsif temperature >= 15if raining
​     puts "It’s warm and raining"else 
​     puts "It’s warm but not raining"endend
end 

Q16: Write a program that, given a person’s score can tell them:

a. whether or not they’re allergic to a given item❓

b. the full list of allergies❓

❇ Ans:

​class Allergy
​ ALLERGIC_ITEMS = ['eggs', 'peanuts', 'shellfish', 'strawberries', 'tomatoes', 'chocolate', 'pollen', 'cats']
​ attr_reader :score
​ def initialize(score)
​   @score = score
​ end
​ def reversed_binary
​   score.to_s(2).split("").reverse
​ end

​ def allergen_list
​   identified_alleregen = []
​   reversed_binary.each_with_index do |binary, index|
​       if binary == '1'
​         identified_alleregen << ALLERGIC_ITEMS[index]
​       end
​   end
​   identified_alleregen
​ end

​ def is_allergic?(name)
​   allergen_list.include?(name) ? true : false
​ end

end

github link of solution