Questions
Question Objectives: The objectives of this lab exercise are to: Demonstrate an understanding of the concept...

Question Objectives: The objectives of this lab exercise are to: Demonstrate an understanding of the concept of operator precedence in Python expressions and statements. Take simple problem descriptions and produce small but complete Python programs that solve these problems. Give you some practice in using simple Python interactive input and output capabilities. Give you some practice in the simplest Python decision statement (if). Give you some practice in the simplest Python loop statement (while). Specifications: This is a four-part exercise. For the three assignment statements listed below, label the operators according to the order they will be evaluated, i.e., label the first evaluated operator with a 1, the second with a 2, and so on. Then fill in the blank with the result assigned to variable x in each part. i. x = 7 + 3 * 6 / 2 – 1 x = ________ ii. x = 2 % 2 + 2 * 2 – 2 / 2 x = ________ iii. x = ( 3 * 9 * ( 3 + ( 9 * 3 / 3 ) ) ) x = ________ Write a Python program that inputs three (3) integers to IDLE from the keyboard and prints the sum, average, product, smallest and largest of these numbers. For this exercise you may assume the user does NOT enter any duplicate values. The interactive screen dialogue should look something like this (user input is shown in bold): Input three different integers separated by : 13 27 14 Sum is 54 Average is 18 Product is 4914 Smallest is 13 Largest is 27 Write a Python program in IDLE that asks for the radius of a circle and prints the circle’s diameter, circumference, and area. Import the math library for p. Do the calculations for diameter, circumference and area in the output statements. You do NOT need variables for holding your calculated values of diameter, circumference, or area. Just place the appropriate expression as an argument to the print() function. Write a Python program in IDLE that asks for an integer and determines and prints whether it is odd or even. (Hint: Use the modulus operator (%). An even number is a multiple of 2 and any multiple of 2 leaves a remainder of zero (0) when divided by 2). Discussion: In addition to the documentation requirements specified in lab 1, first write the entire program in pseudocode as comments. When necessary place a comment to the right of complicated lines to clarify your code to the reader. Further, comments should not merely repeat what is obvious from a program statement. For example, avoid what follows. This statement below adds nothing to understanding what the statement does or what its purpose is within the program: Sum = Sum + 1 # Add 1 to Sum ß A totally worthless comment! Deliverable(s): Your deliverable should be a Word document with screenshots showing the sample code you have created, and discuss the issues that you had for this project related to AWS and/or Python IDE and how you solved them. Turn in your source code listings for the programs developed above. Include screen shots of the results from running the programs you developed for three (3) sets of test data (for each program). Choose your test cases carefully so they reflect good values to test all aspects of your solutions.

In: Computer Science

5) For each type of cables/media below, advise under what situation you would use it and...

5) For each type of cables/media below, advise under what situation you would use it and brief your reason.

- straight through cable

- cross-over cable

- rollover cable

- coaxial cable

- fiber

- wifi

In: Computer Science

In this assignment, you must use the MySQL Command Line Client Window. READ ALL INSTRUCTIONS BEFORE...

In this assignment, you must use the MySQL Command Line Client Window.

  • READ ALL INSTRUCTIONS BEFORE STARTING.
  • Install MySQL Server if you haven't done it yet. Some instructions are posted here: MySQL
  • You'll need to take screen shots throughout the assignment (more details below).
  • You may change the properties of your MySQL Command Line window by right-clicking on the title bar (or the icon on the upper left corner of the window), and selecting the Defaults menu.
    • This will allow you change the size and color of the window and the fonts.
    • You should increase the screen buffer size (height), in the Layout tab, to allow you to keep more lines available to review (when you scroll up).
    • The Command History buffer size, in the Options tab, is not the same as the above. It is the number of commands available when you use the up and down arrow keys to review previous commands. You may increase that too.
    • Remember that the command history is gone when you close the MySQL Command Line Client window. Your databases and tables are saved and will still be there when you log in again.  

Perform all the following steps in order. Some steps are repeated on purpose.

Open the MySQL Command Line Client.

1. The first query you must do, before creating the database is:

SELECT NOW();

2. Create a database named 'school'.

  • The 'school' database will have the following tables:
student (student_id, first_name, last_name, dob, home_street, home_city, home_state, home_zip)

faculty (employee_id, first_name, last_name, dept_id)

department (dept_id, dept_name, building_code)
  • You do not need to specify primary or foreign keys yet.

  • Choose appropriate data types and sizes for the fields.

  • Make sure the fields student_id and last_name do not allow NULL values. Other fields should allow NULL values.

3. Create the above tables.

4. Load fictitious data into your tables:

  • The student table should have at least 10 records. You should have 5 students with Tampa as their home_city. Other students should reside in other cities of your choice.
  • The faculty table should have at least 5 records.

  • The department table should have at least 3 records. The field building_code is a 3 letter code that identifies the location of the department, such as ENB, CPR...

  • You should make up your own data (do not use data from another student).

5. Write (and run) SQL queries to:

  • Show all existing databases in your RDBMS.

  • Show the tables in the 'school' database.

  • Show the structure of each table in the 'school' database.

  • Show all the data in each of the three tables in the 'school' database.

  • Show only the first name and last name of all the faculty.
  • Show only the first name, last name and home city of all the students who live in Tampa.

6. The last query you must do, after everything is done is:

SELECT NOW();
  • All of the above steps must be done in the MySQL Command Line Client.
  • You must take screen shots of the above commands AND results (showing in your command-line client window). It is okay to include any errors you made along the way.
    • You may use the 'Snipping Tool' or 'Snip and Sketch' (on Windows) , or 'Grab' (on MacOS), or see here for other options: https://www.take-a-screenshot.org/  (Links to an external site.).
    • Please avoid taking pictures of the screen with a camera/phone as it can be very hard to read (blurry/glare/small), and more time-consuming for you than the above tools.

In: Computer Science

Build an interactive calculator. Using an Arduino Uno, the OLED Display and matrix keypad to build...

Build an interactive calculator.

Using an Arduino Uno, the OLED Display and matrix keypad to build a simple calculator application. The user presses the operands and operators using the keypad. The calculation output should be displayed on the OLED display. You may make the following simplifying assumptions.

a)Assume 1 digit numbers

b) Assume only two operators ‘+’ and ‘-’

Upload the breadboard diagram and the code

In: Computer Science

1. Build a circuit in Logisim with the following characteristics: The circuit should have 3 inputs...

1. Build a circuit in Logisim with the following characteristics:

  • The circuit should have 3 inputs - A, B, and C.
  • The circuit should have 1 output - W.
  • The output should be a 1 if the three inputs would form a binary number that is a multiple of 3. (Don't forget that 0 is a multiple of 3!)
  • The circuit should only use AND gates, OR gates, NOT gates, input pins, output pins, and wires. (See if you can build your circuit with as few gates as possible!)

2. Change your circuit from problem 1 so that it only uses decoders, OR gates, input pins, output pins, and wires.

3. Draw your circuit from problem 1 as a PLA.

In: Computer Science

Java Program Sequential Search You are given a sequence of n integers S and a sequence...

Java Program

Sequential Search

You are given a sequence of n integers S and a sequence of different q integers T. Write a program which outputs C, the number of integers in T which are also in the set S. Do not use any import sort packages.

Input: In the first line n is given. In the second line, n integers are given. In the third line q is given. Then, in the fourth line, q integers are given.

Output: Print C in a line.

Constraints

  • n ≤ 10000
  • q ≤ 500
  • 0 ≤ an element in S ≤ 109
  • 0 ≤ an element in T ≤ 109

Sample Input 1

5
1 2 3 4 5
3
3 4 1

Sample Output 1

3

Sample Input 2

3
3 1 2
1
5

Sample Output 2

0

Sample Input 3

5
1 1 2 2 3
2
1 2

Sample Output 3

2

In: Computer Science

1. Show the red-black tree that result after successively inserting the keys 1, 2, 5, 15,...

1. Show the red-black tree that result after successively inserting the keys 1, 2, 5, 15, 4, 7, 8, 14, 11 into an initially empty red-black tree.

Show each step whenever you change a node’s color or make a rotation, mark your operations clearly.

In: Computer Science

Which property of secure hash functions—one-way, weak collision-resitance, or strong collision-resistance—make them useful in the context...

  1. Which property of secure hash functions—one-way, weak collision-resitance, or strong collision-resistance—make them useful in the context of password security?
  2. What is a password dictionary? Can it be used to improve password security?
  3. What is the motivation for limiting the password age? In particular, why would you enforce a maximum age? Why would you want to set a minimum age?

In: Computer Science

In terms of Cybersecurity, discuss about your Comprehensive Information Security and Privacy Program (500 Word)

  1. In terms of Cybersecurity, discuss about your Comprehensive Information Security and Privacy Program (500 Word)

In: Computer Science

Write a ADT called in minStack that provides the following methods: • push() // inserts an...

Write a ADT called in minStack that provides the following methods:

• push() // inserts an element to the “top” of the minStack

• pop() // removes the last element that was pushed on the stack

• top () // returns the last element that was pushed on the stack

• min() // returns the minimum value of the elements stored so far

In: Computer Science

write value of PI(3.14159) in IEEE-754 single-precision format

write value of PI(3.14159) in IEEE-754 single-precision format

In: Computer Science

PLEASE CODE IN JAVA In this assignment you will write a program in that can figure...

PLEASE CODE IN JAVA

In this assignment you will write a program in that can figure out a number chosen by a human user. The human user will think of a number between 1 and 100. The program will make guesses and the user will tell the program to guess higher or lower.

                                                                  Requirements

The purpose of the assignment is to practice writing functions. Although it would be possible to write the entire program in the main function, your solution should be heavily structured. The main function must look like this:

public static void main(String[] args) {

       do {

                playOneGame();

       } while (shouldPlayAgain());

}

The playOneGame function should have a return type of void. It should implement a complete guessing game on the range of 1 to 100.

The shouldPlayAgain function should have a boolean return type. It should prompt the user to determine if the user wants to play again, read in a character, then return true if the character is a ‘y’, and otherwise return false.

In addition, you should implement the helper functions getUserResponseToGuess, and getMidpoint. They should be invoked inside your playOneGame function.

getUserResponseToGuess. This function should prompt the user with the phrase “is it <guess>? (h/l/c): “ with the value replacing the token <guess>. It should return a char. The char should be one of three possible values: ‘h’, ‘l’, or ‘c’. It should have the following signature:

                        public static char getUserResponseToGuess(int guess)

getMidpoint. This function should accept two integers, and it should return the midpoint of the two integers. If there are two values in the middle of the range then you should consistently chose the smaller of the two. It should have the following signature:

                         public static int getMidpoint(int low, int high)

In: Computer Science

What is O(g(n)) for the following method? What sorting algorithm is this? /*Function to sort array...

What is O(g(n)) for the following method? What sorting algorithm is this? /*Function to sort array using ??? sort*/ void sort(int arr[]) { int n = arr.length; for (int i = 1; i < n; ++i) { int key = arr[i]; int j = i - 1; /* Move elements of arr[0..i-1], that are greater than key, to one position ahead of their current position */ while (j >= 0 && arr[j] > key) { arr[j + 1] = arr[j]; j = j - 1; } arr[j + 1] = key; } }

In: Computer Science

Normalisation (13 marks) The table below has basic information about Sales staff and their sales for...

Normalisation

The table below has basic information about Sales staff and their sales for a small appliance sales chain. It shows the employee, the items they sell as well as which store they work in.

SALES(Cost, Emp_Name, Emp_ID , Make, Grade , Price, Serial_No, Commission, Store _Address, Date, Store _Phone, Model)

The following functional dependencies apply and there are no redundancies present:

Store_Address -> Store_Phone
Grade -> Commission
Emp_ID -> Store _Address
Serial_No -> Model, Make
Emp_ID , Serial_No -> Date, Retail_Price Serial_No ->Wholesale_Price

Emp_ID -> Grade Emp_ID -> Emp_Name

3.1​ ​Find the Primary Key of the SALES relation.
3.2​ Decompose the SALES relation into 3NF. Show the final schema in full with all primary keys and

foreign keys mark appropriately.3.3​ The following FD also holds true:

Store_Phone-> Store_Address

Which relation in your decomposition would it map to? Test that relation to show that it is still in 3NF. Show your working.

In: Computer Science

Relational Modelling (20 marks) For the relation: R (A, B, C, D, E, F, G) The...

Relational Modelling

For the relation:
R (A, B, C, D, E, F, G)

The following functional dependencies hold: F -> D

G -> B
C -> D
F -> C, E B -> F
A -> F, G

2.1​ Use Inference rules to find the ​minimal b​ asis.

2.2​ Determine the ​primary key​ of the relation.

2.3​ Based on this key, determine if the relation R is in BCNF. Explain your answer in terms of the FDs and the key.

2.4​ If the relation R is not in 3NF or BCNF, then decompose the relation to 3NF/BCNF.

In: Computer Science