Posts

Data Structures book chapter 3 exercise solutions

 1. What are arrays and why are they needed? Arrays are the most important and brilliant piece of development in software area. They are grouped into data structures and its use and implications is very high in programming languages. So what are arrays, Array is also a type of variable just like int, char, float, etc.. but with some changes. Here array has a structure, data structure with a collection of data elements in a structured way of storing it. It holds similar type of data elements. Why are they needed, consider this example. there are 20 students whose marks is to be scanned and printed. So in terms of programming language, we need at least 20 variables to hold 20 students marks, 20 statements or ( 1 statement with 20 variables ) for getting input, 20 print statements for printing marks. Therefore it is really manual, tedious, highly taxing and error prone process. Since this was only 20 students, consider 200, 2000, 20000 or 200000 students data entry job. It is exponentiall

Computer Security book by Charles Chapter 1 Exercise Solutions

Image
1. Distinguish between vulnerability, threat, and control. In the above diagram, a man is standing near a wall with his finger placed inside a hole. There is water on left side of wall and a crack in a wall that you can see. For understanding the threat and vulnerability difference, we will understand it by the above diagram as a analogy.  By definition. Vulnerability is a weakness in the system ( loophole ) that might be exploited in the future to cause harm or loss.  Threat is a set of events, circumstances that may happen and potential to cause harm. Now, in the above diagram, If the water level rises, then the man may get wet, get harm either the water gets spilled out, overflows. So Water is the threat to Man. Now there is a weakness in the wall, i.e Crack is present, that some time it can diminish the entire wall, break the entire wall and thus it is a vulnerability.  To address this Harm, Threats, Vulnerabilities, We have Control or CounterMeasures.  Therefore, Control is a proc

Let us C book Chapter 2 Exercise SOlutions

 [A] Point out the errors, if any, in the following C statements: (a) x = ( y + 3 ) ;   Proper  (b) cir = 2 * 3.141593 * r ; r is undefined  char = '3'; WHere is the name dude , no variable name given  (d) 4 / 3 * 3.14 * r * r * r = vol_of_sphere ; Right to left associativitiy applies and left side of = should contain only one variable  (e) volume = a 3 ; Error no exponentiation form avaiable  (f) area = 1 / 2 * base * height ; Correct  (g) si = p * r * n / 100 ; perfect  (h) area of circle = 3.14 * r * r ; space not allowed in variable name  peri_of_tri = a + b + c ; ok  slope = ( y2 – y1 ) ÷ ( x2 – x1 ) ; ok (k) 3 = b = 4 = a ; NOt ok - > left side of = cannot have constant  count = count + 1 ; perfect  (m) char ch = '25 Apr 12' ; not ok only one character allowed in single quote [B] Evaluate the following expressions and show their hierarchy. (a) ans = 5 * b * b * x - 3 * a * y * y - 8 * b * b * x + 10 * a * y ; (a = 3, b = 2, x = 5, y = 4 assume ans to be an int)

Search Engines Exercise Chapter 1 Solution

 1.1. Think up and write down a small number of queries for a web search engine.Make sure that the queries vary in length (i.e., they are not all one word). Try to specify exactly what information you are looking for in some of the queries.Run these queries on two commercial web search engines and compare the top 10 results for each query by doing relevance judgements. Write a report that answers at least the following questions: What is the precision of the results? What is the overlap between the results for the two search engines? Is one search engine clearly better than the other? If so, by how much? How do short queries perform compared to long queries? Queries  1. Computer Algorithms time complexity 2. Security in computing 3. covid-19 variants 4. Earth atmosphere layers Web search Engines used Are Google and DuckDuckgo Top 10 results were highly relevant and some of the results returned were similar in both the search engines. There were overlapping results founded in both the s

Data Structures Chapter 2 Exercise Solutions

Short forms used DS -> Data structure 1. Explain the features of a good program. A good program is one that has the following points covered 1. Runs Correctly 2. Easy to read and undersand  3. is easy to modify A good program that runs correctly but runs efficiently, that's important. So a program that takes less time to execute and occupies minimum storage space is a good program. And also meets other points mentioned above. 2. Define the terms: data, file, record, and primary key.  Data : The term data means values or data sets  Record : It is a collection of data items like name, address, phone number, etc.. File : File is a collection of related records. File may be of school students attendance records, or marks records etc Primary Key : In a record that contains data items like name , id , phone number, age , etc.. , A primary key is the id field which is unique for each data item and cannot repeat , therefore using this as a key will serve identification of records, searc

Let us C book Chapter 1 Exercise Solutions

  [A] Which of the following are invalid C constants and why? ‘3.15’ : Valid C Constant falls into Real Constant category 35,550 : Invalid C Constant because comma is not allowed  3.25e2 : Valid Exponential format of Real Constant  2e-3 : Valid Exponential form of Real Constant  ‘eLearning’ : Invalid C Constant Because Only ONe character should be there and single quote present  “Show” : Valid C Constant  ‘Quest’ : Invalid C Constant because single quote present instead of double  2^3 : Invalid C Constant  4 6 5 2 : Invalid C Constant because spaces not allowed  [B] Which of the following are invalid variable names and why? B’day : Invalid Variable Name because single quote present  Int : Invalid Variable name because it is a reserved Keyword  $hello : Invalid C Variable Name  #Hash : Invalid because only alphabets, digits and underscores allowed in naming variable  Dot.  : Invalid  Number : Valid  totalArea : Valid  _main() : Invalid, variable name cannot have ()  Temp_in_deg : Valid 

Confidentiality - Integrity - Availability

Confidentiality Confidentiality means some things need protection against unauthorised access. It can be anything ranging from financial transactions to bank records to medical records, tax returns etc. But It varies from person to person. For example, A Student might scream out of the class saying "I got an A", so he is ok exposing his grades to all but other student might not choose to reveal. Other things like order of military food might not seem confidential, but an sudden increase in the order could be the sign of an military conflict or war.  Integrity Examples of Integrity failures are easy to find and too many. A number of years ago, Macro in a document added the word "not" after is in the statements after random instances. This might not appear integrity failure, but you can image the kind of havoc it can do if the word document consisted of Pentium computer chip details that produced an incorrect result due to the word "not" in a statement conta