Show the encoding of the following machine instructions and convert into hexadecimal.
1. STUR X7, [X9, #32]
2. SUBI X16, X4, #52
3. AND X5, X20, X3
In: Computer Science
Write for Python IDLE 3.8.5
Write functions:
i) One that prompts a user for 2 numbers.
ii) Adds the two numbers if they are even
iii) Multiplies the two numbers if they are odd
iv) Displays the appropriate output to the user
You are writing 4 functions and calling them to test functionality.
In: Computer Science
int main(){
int i = 3;
if(fork()){
i++;
fork();
i+=3;
}else{
i+=4;
fork();
i+=5;
}
printf("%d\n",i);
}
how many processes does this code create including the parent
In: Computer Science
In: Computer Science
Write a java code to demonstrate the File IO.
Your code should get the following information from the user.
• Get a file name fname for output • Get number of data (numbers) (N) you want to process from the user
• Get N numbers from the users through keyboard and store them in an array
• Get M (How many numbers to read from file)
• (Or)You are free to use same N for M (use N for both purposes) You have to define two methods:
1) To write the numbers from the array into the file fname
2) To read numbers from the file fname, store them in an array, and compute average of the numbers.
The method should display the numbers from the array and the average value.
In: Computer Science
Role of Chief Information Officer (CIO) is assigned to you: Chief Information Officer (CIO): All IT is overseen by the CIO. The CIO is over the hardware, software, IT processes, management, support and security and privacy of all systems within the organization To prepare for this Discussion, gather information from the library and research other web resources. Write a plan describing your role as a Chief information officer (CIO) in developing the system, your tasks based on your role, and your input to a plan for developing the system.
In: Computer Science
Why is documenting computer programs essential? Include in your discussion why you do or don't believe it regularly occurs? Provide at least one example.
In: Computer Science
6. Compound Interest
When a bank account pays compound interest, it pays interest not
only on the principal amount that was deposited into the account,
but also on the interest that has accumulated over time. Suppose
you want to deposit some money into a savings account, and let the
account earn compound interest for a certain number of years. The
formula for calculating the balance of the account after a
specified number of years is:
? = ?(1 + ?)???
The terms in the formula are:
A is the amount of money in the account after the specified number
of years.P is the principal amount that was originally deposited
into the account.
r is the annual interest rate.
n is the number of times per year that the interest is
compounded.
t is the specified number of years.
Write a program that makes the calculation for you. The program
should ask the user to
input the following:
• The amount of money you want to make in the account after the
specified number of years.
• The annual interest rate paid by the account as a decimal
number.
• The number of times per year that the interest is compounded (For
example, if interest
is compounded monthly, enter 12. If interest is compounded
quarterly, enter 4.)
• The number of years the account will be left to earn
interest
Once the input data has been entered, the program should calculate
and display the principal amount you have to deposit into the
account.
In: Computer Science
Write a program that receives an integer and must return a string containing the hexadecimal representation of that integer.
In: Computer Science
Use the pumping lemma to prove that the following languages are not regular.
(a)L2 = {y = 10 × x | x and y are binary integers with no leading 0s, and y is two times x}. (The alphabet for this languages is {0, 1, ×, =}.) For example, 1010 = 10 × 101 is in L2, but 1010 = 10 × 1 is not.
(b)Let Σ2 = {[ 0 0 ] , [ 0 1 ] , [ 1 0 ] , [ 1 1 ]} . Consider each row to be a binary number and let L3 = w ∈ Σ ∗ 2 | the bottom row of w is the square of the top row of w . For example, [ 0 1 ] [ 0 0 ] [ 1 0 ] [ 0 0 ] [ 0 0 ] ∈ L3, but [ 0 1 ] [ 0 0 ] [ 0 0 ] [ 1 0 ] [ 0 0 ] [ 0 0 ] ∈/ L3.
In: Computer Science
n this task, you'll be asked to create a simple for-loop to loop over a simple data construct, in this case, to provide the maximum, minimum, and average length of words in a speech performing a lexicographical analysis not unlike what's used to measure reading level.
Specifications
In: Computer Science
USING SQL
Create a table named Zones with the attributes and assumptions indicated below.
Attributes: the zone ID, the lowest and the highest accepted temperature.
Assumptions: the ID will be the primary key and have one or two digits, the temperatures (in Fahrenheit) will be at most two digits and a possible minus sign, none of the temperatures can be NULL.
Populate table Zones so that it has the following rows:
id | lowerTemp | higherTemp |
2 | -50 | -40 |
3 | -40 | -30 |
4 | -30 | -20 |
5 | -20 | -10 |
6 | -10 | 0 |
7 | 0 | 10 |
8 | 10 | 20 |
9 | 20 | 30 |
10 | 30 | 40 |
3. Deliveries
The same flower vendor wants to use a code to explain the type of delivery for each flower. Create a table named Deliveries with the attributes and assumptions indicated below.
Attributes: the delivery ID, the category or type of delivery, and the size of the delivery.
Assumptions: the ID will be the primary key and have one one digit, the category will be at most five characters (pot, plant, hedge, shrub, tree), and the delivery size will be up to five digits with three decimal spaces (possibly NULL).
Populate table Deliveries so that it has the following rows:
id | categ | delSize |
1 | pot | 1.500 |
2 | pot | 2.250 |
3 | pot | 2.625 |
4 | pot | 4.250 |
5 | plant | NULL |
6 | bulb | NULL |
7 | hedge | 18.000 |
8 | shrub | 24.000 |
9 | tree | 36.000 |
3. FlowersInfo
Create a table named FlowersInfo with the attributes and assumptions indicated below. Choose the most appropriate data types.
Attributes: an ID with three characters, common name, Latin name, the coolest and hottest zones where it can be grown, the delivery category, and the sun needs.
Assumptions: The ID will be the primary key, the attribute
common name may have up to thirty characters, and the Latin name up
to thirty-five characters. The attributes coolest zone, hottest
zone, and delivery category will match the IDs from other tables,
and the sun needs will be up to five characters, S for Sun, SH for
Shade, P for Partial sun and any combination (StoP, StoSH, etc.).
Your table definition should implement referential integrity
whenever possible.
Populate table FlowersInfo so that it has the following rows:
id | conName | latName | cZone | hZone | deliver | sunNeeds |
101 | Lady Fern | Atbyrium filix-femina | 2 | 9 | 5 | SH |
102 | Pink Caladiums | C.x bortulanum | 10 | 10 | 6 | PtoSH |
103 | Lily-of-the-Valley | Convallaria majalis | 2 | 8 | 5 | PtoSH |
105 | Purple Liatris | Liatris spicata | 3 | 9 | 6 | StoP |
106 | Black Eyed Susan | Rudbeckia fulgida var. specios | 4 | 10 | 2 | StoP |
107 | Nikko Blue Hydrangea | Hydrangea macrophylla | 5 | 9 | 4 | StoSH |
108 | Variegated Weigela | W. florida Variegata | 4 | 9 | 8 | StoP |
110 | Lombardy Poplar | Populus nigra Italica | 3 | 9 | 9 | S |
111 | Purple Leaf Plum Hedge | Prunus x cistena | 2 | 8 | 7 | S |
114 | Thorndale Ivy | Hedera belix Thorndale | 3 | 9 | 1 | StoSH |
4. Queries
Write SQL statements to answer the following queries. Write a comment header right before each SQL statement with the letter of the query answered by the statement.
a) the total number of zones.
b) the number of flowers per cool zone.
c) common names of the plants that have delivery sizes less than 5.
d) common names of the plants that require full sun (i.e., sun needs contains ‘S’).
e) all delivery category names order alphabetically (without repetition).
f) the exact output (note that it is order by Name):
In: Computer Science
Java Data Structure Doubly Linked List
/*
* Complete the swap(int index) method
* No other methods/variables should be added/modified
*/
public class A3DoubleLL<E> {
/*
* Grading:
* Swapped nodes without modifying values - 2pt
* Works for all special cases - 1pt
*/
public void swap(int index) {
//swap the nodes at index and
index+1
//change the next/prev connections,
do not modify the values
//do not use
delete/remove/insert/add to help with this process
//make sure to account for all
special cases
}
private Node start, end;
private int count;
public A3DoubleLL() {
start = end = null;
count = 0;
}
public String printList() {
String output = "";
Node current = start;
while(current != null) {
output +=
current.value + ",";
current =
current.next;
}
return output;
}
public String printListRev() {
String output = "";
Node current = end;
while(current != null) {
output +=
current.value + ",";
current =
current.prev;
}
return output;
}
public void add(E val) {
Node newItem = new Node(val);
if(start == null) {
start =
newItem;
end =
start;
count = 1;
} else {
end.next =
newItem;
newItem.prev =
end;
end =
newItem;
count++;
}
}
public void insert(E val, int index) {
if(index < 0) {//fix invalid
index
index = 0;
}
if(index >= count) {//goes in
last position
this.add(val);
} else {
Node newItem =
new Node(val);
if(index == 0)
{//goes in first position
newItem.next = start;
start.prev = newItem;
start = newItem;
} else {//goes
in middle
Node current = start;
for(int i = 1; i < index; i++) {
current = current.next;
}
newItem.next = current.next;
newItem.prev = current;
current.next.prev = newItem;
current.next = newItem;
}
count++;
}
}
public void delete(int index) {
if(index >= 0 && index
< count) {//valid index
if(index == 0)
{//remove first
start = start.next;
if(start != null) {//as long as there was an
item next in list
start.prev = null;
} else {//if only item was removed
end = null;
}
} else if(index
== count-1) {//remove last item
end = end.prev;
end.next = null;
} else {//remove
middle item
Node current = start;
for(int i = 1; i < index; i++) {
current = current.next;
}
current.next = current.next.next;
current.next.prev = current;
}
count--;
}
}
public E get(int index) {
if(index >= 0 && index
< count) {//valid index
Node current =
start;
for(int i = 0; i
< index; i++) {
current = current.next;
}
return
current.value;
}
return null;
}
public String toString() {
return this.printList();
}
private class Node {
E value;
Node next, prev;
public Node(E v) {
value = v;
next = prev =
null;
}
}
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
public class A3Driver {
public static void main(String[] args) {
A3DoubleLL<Integer> list =
new A3DoubleLL<>();
for(int i = 1; i < 10; i++)
{
list.add(i);
}
System.out.println("Before
Swap");
System.out.println(list.printList());
System.out.println(list.printListRev());
list.swap(4);
System.out.println("After
Swap");
System.out.println(list.printList()
+ ":1,2,3,4,6,5,7,8,9,");
System.out.println(list.printListRev() +
":9,8,7,6,5,4,3,2,1,");
System.out.println();
System.out.println("Hot
Potatoe");
A3CircleLL hotPotato = new
A3CircleLL();
hotPotato.playGame(5, 3);
System.out.println("Correct:");
System.out.println("Removed Player
4\nRemoved Player 3\nRemoved Player 5\nRemoved Player 2\nWinning
player is 1");
System.out.println();
A3Queue<Integer> queue = new
A3Queue<>();
queue.enqueue(5);
queue.enqueue(20);
queue.enqueue(15);
System.out.println(queue.peek()+":5");
System.out.println(queue.dequeue()+":5");
queue.enqueue(25);
System.out.println(queue.dequeue()+":20");
System.out.println(queue.dequeue()+":15");
}
}
In: Computer Science
Using Python.
In this question, you are expected to use TensorFlow and Keras to perform a deep learning process for creating an image classifier to distinguish between dog and cat. You should follow fchollet’s code to create the classifier and test this classifier with one test photo of dog and one test photo cat. Create a screenshot to show the classifying results of these two test photos. The dog and cat in the test photos should not be in your original training dataset, and you may use your own pets or your neighbor’s pets.
Thankyou
use this website for reference:
https://keras.io/examples/vision/image_classification_from_scratch/
In: Computer Science