In MATLAB
Write a function to create an array of N numbers with a normal distribution. Call that from a script to create 1000 numbers, with a mean of 50 and a sigma of 10.
In: Computer Science
Problem 3. A digital computer has a memory unit with 32 bits per word. The instruction set consists of 122 different operations. All instructions have an operation code part (opcode) and an address part (allowing for only one address). Each instruction is stored in one word of memory. a) How many bits are needed for the opcode? b) How many bits are left for the address part of the instruction? c) What is the maximum allowable size for memory? d) What is the largest unsigned binary number that can be accommodated in one word of memory?
In: Computer Science
Problem 1. How many bits are required to address a 4M × 16 main memory under the following conditions. (“4M x 16” means there are 4x220 16-bit words.) a) The main memory is byte-addressable? b) The main memory is word-addressable? (For part b, assume a 16-bit word.)
In: Computer Science
In: Computer Science
Please explain step by step what is going on each step
Also show how the output is coming. I would rate positively.
Thank you so much .
#include
<stdio.h>
#include <string.h>
int main()
{
char
buffer[16], *pos;
printf("Enter
string: ");
if
(!(fgets(buffer,sizeof(buffer),stdin)))
{
printf("End
of file\n");
return
0;
}
printf("Length
of %s is %lu
\n",buffer,strlen(buffer));
if
((pos=strchr(buffer, '\n')) !=
NULL)
*pos
= '\0';
printf("Length
of %s is now
%lu \n",buffer,strlen(buffer));
return(0);
}
In: Computer Science
Assume we have two sequences of values S1 containing 1, 5, 3, 6, 7, 8 while S2 containing 2, 5, 6, 9, 7. We store these two sequences as sets and perform a set intersection and set difference. Write C++ code to do that respectively.
In: Computer Science
For each of the following Unix system calls, give a condition that causes it to fail: open, read, fork, execve, unlink.
In: Computer Science
create overloaded functions called lastValue. The first function should take as a parameter a string and the second function should take as a parameter an int. each of you functions should return an int value. in the case of the function that takes the string as an argument you will return the ascii value of the last character in the string. in the case of the function that takes an int parameter your function will return the last digit in the number c++
In: Computer Science
1. Write a program that computes the smallest and largest of a set of values that are stored in an array. Ask the user for the set size (and hence the array size). Populate the array with user input. (Java language)
In: Computer Science
FOR JAVA
Define a class QuadraticExpression that represents the quadratic expression ax^2 + bx + c: You should provide the following methods (1) default constructor which initalizes all the coefficients to 0 (2) a constructor that takes three parameters public QuadraticExpression(double a, double b, double c) (3) a toString() method that returns the expression as a string. (4) evaluate method that returns the value of the expression at x public double evaluate(double x) (5) set method of a, b, c public void setA(double newA) public void setB(double newB) public void setC(double newC) (6) public static QuadraticExpression sum( QuadraticExpression q1, QuadraticExpression q2): returns a new expression that is the sum of the q1 and q2 (7) public static QuadraticExpression scale( double r, QuadraticExpression q) returns a new expression that is r times q (8) public int numberOfRoots() returns number of roots, where 3 means infite number of roots (9) public void add( QuadraticExpression q) add q to the calling expression object (10) public double smallerRoot() throws Exception Depending on the equation ax^2 + bx + c = 0: if no roots, throw exception if single root, return it if two roots, return the smaller root if infinite root, return -Double.MAX_VALUE (11) public double largerRoot() throws Exception if no roots, throw exception if single root, return it if two roots, return the larger root if infinite root, return Double.MAX_VALUE (12) equals method This should OVERRIDE equals method from Object class return true if two expressions have same a, same b and same c (13) clone return a copy of the calling object (14) use javadoc style comments for the class, and the methods At minimum, include the author, parameters and return types for each method. (15) use javadoc to generate document for your class (16) test your class: you can write your own main to test your code; but you have to pass the test in QuadraticExpressionTest.java (17) submit a. QuadraticExpression.java b. QuadraticExpression.html on blackboard. (18) turn in printout of a. QuadraticExpression.java b. the output of your program
Please!! test before posting it
In: Computer Science
Consider the following schema:
Suppliers(sid: integer, sname: string, address: string)
Parts(pid: integer, pname: string, color: string)
Catalog(sid: integer, pid: integer, cost: real)
The key fields are underlined, and the domain of each field is listed after the field name. Therefore sid is the key for Suppliers, pid is the key for Parts, and sid and pid together form the key for Catalog. The Catalog relation lists the prices charged for parts by Suppliers.
WRITE THE FOLLOWING QUERIES IN RELATIONAL ALGEBRA WITH BASIC OPERATORS AND AGGREGATE FUNCTIONS ONLY
MEANS IF THE QUERIES CANNOT FULLY EXPRESSED BY BASIC OPERATORS, USE AGGREGATES.
1. Find the names of suppliers who supply some red part.
2. Find the sids of suppliers who supply some red or green part.
3. Find the sids of suppliers who supply some red part or are at 221 Packer Street.
4. Find the sids of suppliers who supply some red part and some green part.
5. Find the sids of suppliers who supply every part.
6. Find the sids of suppliers who supply every red part.
7. Find the sids of suppliers who supply every red or green part.
8. Find the sids of suppliers who supply every red part or supply every green part.
9. Find pairs of sids such that the supplier with the first sid charges more for some part than the supplier with the second sid.
10. Find the pids of parts supplied by at least two different suppliers.
11. Find the pids of the most expensive parts supplied by suppliers named Yosemite Sham.
12. Find the pids of parts supplied by every supplier at less than $200. (If any supplier either does not supply the part or charges more than $200 for it, the part is not selected.)
In: Computer Science
MySQL
Multiple Choice
Answer as soon as possible
1. Which one of the following is
not a Replication Data Format?
(a) Row
(b) Mixed
(c) Statement
(d) Sync
2. When executing the following statement on
the master:
UPDATE enormous_table SET col1 = 0;
Which replication format would be more efficient?
(Assume enormous_table is a large table with millions of
rows)
(a) Statement
(b) Row
(c) Neither
3. When executing the following statement on
the master:
INSERT INTO summary_table(col1, col2, sum_col3)
SELECT col1, col2, sum(col3)
FROM enormous_table
GROUP BY col1, col2;
Which replication format would be more efficient?
(Assume enormous_table is a large table with millions of
rows)
(a) Statement
(b) Row
(c) Neither
4. Which one of the following is a way to
detect if there is an error replicating data on the slave?
(a) Run SHOW MASTER STATUS and Look for an error description in
LAST_SQL_ERROR in the results.
(b) Run SHOW MASTER STATUS and Look for an error description in
INVALID_COMMAND_FOUND in the results.
(c) Run SHOW SLAVE STATUS and Look for an error description in
INVALID_COMMAND_FOUND in the results.
(d) Run SHOW MASTER STATUS and Look for an error description in
SYNCING = NO in the results.
(e) Run SHOW SLAVE STATUS and Look for an error description in
LAST_SQL_ERROR in the results.
5. Which one of the following is the correct
command to skip the next command in the binlog on the slave (this
is sometimes used to skip a command that is causing a replication
error)?
(a) SET GLOBAL SQL_SLAVE_SKIP = YES;
(b) SET GLOBAL SQL_SLAVE_SKIP_COMMANDS = 1;
(c) SET GLOBAL SQL_SLAVE_SKIP_ON_ERROR = YES;
(d) SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
6. Which one of the following is the command
for temporarily disabling the binlog on the master so you can run a
statement without it getting replicated to the slave(s)?
(a) SET REPLICATE_TO_SLAVE = NO;
(b) SET SQL_LOG_BIN = 0;
(c) SET ENABLE_BINLOG = 0;
(d) SET DISABLE_BINLOG = YES;
In: Computer Science
Respond to the following in a minimum of 175 words: Discuss your response to the following: What are some qualitative tools used to analyze data in Microsoft® Excel®? How do these tools assist users with their business decisions? Provide an example from a past or current work experience when the use of these tools would have helped the outcome of your spreadsheet. How was the data analyzed differently? Explain your answer.
In: Computer Science
6) What is the 6-bit 1's complement representation of -1710?
Write your answer in the format 0bXXXX... Where X's are binary digits. Include leading 0's (zeroes).
7) What is the 6-bit sign-magnitude representation of -1710?
Write your answer in the format 0bXXXX... Where X's are binary digits. Include leading 0's (zeroes).
9) What is the 8-bit 1's complement representation of 1710?
Write your answer in the format 0xHHHH... Where H's are hexidecimal digits. Include leading 0's (zeroes). Write hexidecimal digits, A-F, in capitals.
10) What is the 8-bit sign-magnitude representation of 1710?
Write your answer in the format 0xHHHH... Where H's are hexidecimal digits. Include leading 0's (zeroes). Write hexidecimal digits, A-F, in capitals.
In: Computer Science
USE PYTHON ONLY
Zeller’s congruence is an algorithm developed by Christian Zeller to calculate the day of the week. The formula is
h = (q + 26(m+1)//10 + k + k//4 +j//4 +5j) % 7
where
- h is the day of the week (0: Saturday, 1: Sunday, 2: Monday,
3: Tuesday, 4: Wednesday, 5: Thursday, 6: Friday).
- q is the day of the month.
- m is the month (3: March, 4: April, ..., 12: December). January
and February are counted as months 13 and 14 of the previous
year.
- j is year//100.
- k is the year of the century (i.e., year % 100).
Write a program that prompts the user to enter a year, month, and day of the month, and then it displays the name of the day of the week.
In: Computer Science