Assignment 3C: Answer the following questions
Question 1.
a. Declare a 32-bit signed integer variable and initialize it with the smallest possible negative decimal value.
b. Declare an uninitialized array of 100 16-bit unsigned integers.
c. Declare a string variable containing the word “DVC” repeated 20 times, and terminated with the null char.
Question 2
For the following declarations, assuming that the address of I is 404000h
What are the addresses of J, K, and L?
What is the total number of allocated bytes?
Show the content of the individual bytes allocated in memory in hexadecimal
.DATA
I SBYTE 1, -1
J SWORD 10FFh, -256
K DWORD 23456h
L BYTE 'DVC'
Question 3
Given the following definitions:
.DATA
wval LABEL WORD
barray BYTE 10h, 20h, 30h, 6 DUP (0Ah)
ALIGN 4
warray WORD 5 DUP (1000h)
pressKey EQU <"Press any key to continue ...", 0>
darray DWORD 5 DUP (56789ABh), 7 DUP (12345678h)
dval LABEL DWORD
prompt BYTE pressKey
What will be the value of EAX, AX, and AL after executing each of the following instructions? Assume that the address of barray is 404000h.
a. mov eax, TYPE warray
b. mov eax, LENGTHOF barray
c. mov eax, SIZEOF darray
d. mov eax, OFFSET warray
e. mov eax, OFFSET darray
f. mov eax, OFFSET prompt
g. mov eax, DWORD PTR barray
h. mov al, BYTE PTR darray
i. mov ax, wval
j. mov eax, dval
In: Computer Science
The population growth for Norway is:
1 birth every 1 minutes and 40 seconds
1 death every 3 minutes and 16 seconds
1 arrival every 57 seconds
1 departure every 1 minute and 49 seconds
Assume the current population is 35,201,142. Write a program that calculates the population n minutes from now. Declare a final integer called minutesElapsed and perform your calculations based on that
In: Computer Science
Hello, I am attempting to write a program which calculates the amount of fence pieces needed to achieve a certain distance. The program should take in the amount of fencing needed from the user, then ask them the size of the smaller piece. The fencing is to be made up of two sizes of fencing, the smaller being two feet less than the larger. Then, the program will tell the user how many of each piece is needed. However, I am having trouble understanding how the calculation should be performed. The assignment gives examples, so any help interpreting it would be appreciated.
A user enters that they need 50 feet of fencing and the smaller piece must be 3 feet. The program determines that the larger panel will be 5 feet. Then, the program determines that 6 3-foot pieces and 6 5-foot pieces are needed, plus an additional 2-foot piece.
A user enters that they need 50 feet of fencing and the smaller piece must be 4 feet. The program determines that the larger panel will be 6 feet. Then, the program determines that 5 4-foot pieces and 5 6-foot pieces are needed.
A user enters that they need 2 feet of fencing and the smaller piece must be 1 feet. The program determines that the larger panel will be 3 feet. Then, the program determines that 2 1-foot pieces and 0 3-foot pieces are needed.
A user enters that they need 52 feet of fencing and the smaller piece must be 3 feet. The program determines that the larger panel will be 5 feet. Then, the program determines that 7 3-foot pieces and 6 5-foot pieces are needed, plus an additional 1-foot piece.
Thank you!
In: Computer Science
Without using method size(), write recursive method stackSize(Stack > s1 ) that receives a stack and returns number of elements in the stack. The elements in the stack should not be changed after calling this method. please do it in java
In: Computer Science
Assembly language: please comment on every line of code explaining each part. include head comments describing what your program does.
Assignment 3A - A program that adds and subtracts 32-bit
numbers
After installing the assembler on the computer, enter the following
program, save it, assemble it and run it. Do not forget to add a
comment with your name in it.
You will hand in a listing (e.g., addsum.asm) that should include
your name
________________________________________
TITLE Add and Subtract (AddSum.asm)
;This program adds and subtracts 32-bit integers
; Jonathan Borda
INCLUDE Irvine32.inc
.code
main PROC
mov eax, 10000h ; EAX =
10000h
add eax, 40000h ; EAX =
50000h
sub eax, 20000h ; EAX =
30000h
call DumpRegs ; display
registers
exit
main ENDP
END main
In: Computer Science
Write multiple if statements:
If carYear is before 1967, print "Probably has few safety
features." (without quotes).
If after 1971, print "Probably has head rests.".
If after 1992, print "Probably has anti-lock brakes.".
If after 2000, print "Probably has tire-pressure monitor.".
End each phrase with period and newline. Ex: carYear = 1995
prints:
Probably has head rests. Probably has anti-lock brakes.
public class SafetyFeatures {
public static void main (String [] args) {
int carYear;
carYear = 1968;
In: Computer Science
import java.lang.UnsupportedOperationException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// parse the number of strings
int numStrings = Integer.parseInt(sc.nextLine());
// parse each string
String[] stringsArray = new String[numStrings];
for (int i = 0; i < numStrings; i++) {
stringsArray[i] = sc.nextLine();
}
// print whether there are duplicates
System.out.println(hasDuplicates(stringsArray));
}
private static boolean hasDuplicates(String[] stringsArray) {
// TODO fill this in and remove the below line
int numWords =
}
}
In: Computer Science
**JAVA** Exercise
•Consider an input file of test scores in reverse ABC order:
Yeilding Janet 87
White Steven 84
Todd Kim 52
Tashev Sylvia 95...
•Write code to print the test scores in ABC order using a stack.
–What if we want to further process the tests after printing?
Thank you for any and all help! :)
In: Computer Science
Compare and contrast a fully relational DBMS with Excel in the
following areas.
1 Volume of data (number of rows)
2 Relationships of tables
3 Searching efficiency
4 Normalization
5 Update concurrency
In: Computer Science
22.8 LAB 5 D FALL 19 : Using math functions
This lab problem demonstrates the use of import module. The Python programming language has many strengths, but one of its best is the availability to use many existing modules for various tasks, and you do not need to be an experienced computer programmer to start using these modules.
We have given you some incomplete code; note that the very first line of that code contains an import statement as follows:
import math
This statement enables your program to use a math module. A module is a collection of instructions saved together as a whole. So, in this lab you are using the math module. Any time we choose to use a module, we must use an import statement to bring this module into the program. When we import the math module, all the computer instructions contained in the math module are made available to our program, including any functions that have been defined.
If you are interested in finding out what is in the math module you can always go to the Python docs and take a look: Python Docs
Example of using the math module: print(math.floor(5.4)) will use the floor() function as defined in the math module, and in this case with the argument 5.4, will result in printing the value 5.
Below is the definition of your problem that we are asking you to solve using the math module.
Prompt the user for floating point numbers x, y and z. For the x value your you will the use the following prompt Enter x value:inside of your input statement. Using the same approach you will prompt the user for y and z.
- Given three floating-point numbers x, y, and z, your job is to output - the **square root** of x, - the **absolute value** of (y minus z) , and - the **factorial** of (the **ceiling** of z).
Example of a sample run:
Enter x value:5 Enter y value:6.5 Enter z value:3.2
Then the expected output from these entries is:
2.23606797749979 3.3 24
Hint: For finding out the square root you will need to use math.sqrt(), you need to use the website recommended above to find out which functions to use in order to solve the rest of the lab problem.
In: Computer Science
16) Define a 3 to 8 active low decoder. Which number is the input and which is the output? Is 8 related to 3? Explain.
17) Define a 8 to 1 multiplexer. Which number is the input and which is the output? Is 8 and 3 are the only numbers or there are other set(s) of numbers? Explain.
20) Design a combinational circuit that has two ASCII inputs and generates “1”only if the two ASCII are equivalent.
8) Define an Overflow condition.
In: Computer Science
use the web to identify the cost of hardware, software, and networking conponents for an RFID sysyem for company?
In: Computer Science
Nested Loops
Problem 3
Write a function called makesentence() that has three parameters: nouns, verbs, and gerunds. Each parameter is a list of strings, where nouns list has noun strings (such as 'homework'), verbs list has veb strings (such as 'enjoy'), and gerunds list has gerund strings (those -ing words, such as 'studying'). The function will go through all these lists in a systematic fashion to create a list of all possible sentences that use all the noun, verb, and gerund strings. The function then returns the list of sentences.
Each sentence has the following format: 'I' followed by a verb, followed by a noun, followed by 'when ', followed by a gerund, exactly in this order.. For example: 'I enjoy homework when studying' uses the noun 'homework', verb 'enjoy', and gerund 'studying'.
Consider that we have the following lists:
some_nouns = ['homework', 'music', 'breaks']
some_verbs = ['enjoy', 'ignore']
some_gerunds = ['studying', 'sleeping', 'hiking']
After we write the function definition, we call the function, save its return value in the variable result, and print out the result:
result = makesentence(some_nouns, some_verbs, some_gerund)
print(result)
The output of obtained from the call above is:
['I enjoy homework when studying', 'I enjoy homework when sleeping', 'I enjoy homework when hiking', 'I enjoy music when studying', 'I enjoy music when sleeping', 'I enjoy music when hiking', 'I enjoy breaks when studying', 'I enjoy breaks when sleeping', 'I enjoy breaks when hiking', 'I ignore homework when studying', 'I ignore homework when sleeping', 'I ignore homework when hiking', 'I ignore music when studying', 'I ignore music when sleeping', 'I ignore music when hiking', 'I ignore breaks when studying', 'I ignore breaks when sleeping', 'I ignore breaks when hiking']
Part A Think about how to solve this problem and the computational steps of your solution BEFORE you write the Python code. Explain (1) what computations you’ll instruct Python and (2) why. Write your explanations in the order in which the computations should occur.
Part B
#1 Using the explanations of the computational steps of your solution, in an Active Code scratchpad, write the implementation. The implementation has the following structure: your function definition, followed by the three list assignments, followed by the function call and print() call, as follows:
[ your function definition goes in here ]
some_nouns = ['homework', 'music', 'breaks']
some_verbs = ['enjoy', 'ignore']
some_gerunds = ['studying', 'sleeping', 'hiking']
result = makesentence(some_nouns, some_verbs, some_gerund)
print(result)
Copy and paste the code of your function definition
Copy and paste the output you get when you run & save your code
Part C
#1 What was the most challenging while solving Problem 3?
#2 Why?
In: Computer Science
Describe a polynomial time algorithm to solve following problem
Input: A boolean function in CNF such that each clause has exactly three literals.
Output: An assignment of the variables such that each clause has all TRUE literals or all FALSE literals.
In: Computer Science
Digital Forensics, Please describe in detail in your own language
Describe Linux their artifacts and their functionalities.
How they might be used by forensic examiners?
In: Computer Science