C++ Problem: In the bin packing problem, items of different weights (or sizes) must be packed into a finite number of bins each with the capacity C in a way that minimizes the number of bins used. The decision version of the bin packing problem (deciding if objects will fit into <= k bins) is NPcomplete. There is no known polynomial time algorithm to solve the optimization version of the bin packing problem. In this homework you will be examining three greedy approximation algorithms to solve the bin packing problem.
- First-Fit: Put each item as you come to it into the first (earliest opened) bin into which it fits. If there is no available bin then open a new bin.
- First-Fit-Decreasing: First sort the items in decreasing order by size, then use First-Fit on the resulting list.
- Best Fit: Place the items in the order in which they arrive. Place the next item into the bin which will leave the least room left over after the item is placed in the bin. If it does not fit in any bin, start a new bin.
Implement the algorithms in C++. Your program named bins.cpp should read in a text file named bin.txt with multiple test cases as explained below and output to the terminal the number of bins each algorithm calculated for each test case. Example bin.txt: The first line is the number of test cases, followed by the capacity of bins for that test case, the number of items and then the weight of each item. You can assume that the weight of an item does not exceed the capacity of a bin for that problem.
3
10
6
5 10 2 5 4 4
10
20
4 4 4 4 4 4 4 4 4 4 6 6 6 6 6 6 6 6 6 6
10
4
3 8 2 7
Sample output: Test Case 1 First Fit: 4, First Fit Decreasing: 3, Best Fit: 4
Test Case 2 First Fit: 15, First Fit Decreasing: 10, Best Fit: 15
Test Case 3 First Fit: 3, First Fit Decreasing: 2, Best Fit: 2
xekksksksksgBcjqixjdaj
Convert 2910 to binary, hexadecimal and octal. Convert 5810 to binary, hexadecimal and octal. Convert E316 to binary, decimal and octal. Convert 5916 to binary, decimal and octal. Convert 010010102 to decimal, octal and hexadecimal. Convert 001010102 to decimal, octal and hexadecimal. Convert 438 to binary, decimal and hexadecimal. Convert 618 to binary, decimal and hexadecimal.
Answer:
2910 to binary = 101101011110
2910 to hexadecimal = B5E
2910 to octal = 5536
E316 to binary = 1110001100010110
E316 to octal = 161426
E316 to decimal = 58134
5916 to binary = 101100100010110
5916 to decimal = 22806
5916 to octal = 54426
010010102 to decimal = 149
010010102 to octal = 225
010010102 to hexadecimal = 95
FOR 438 and 618, 8 is not a valid digit for octal..
The following numbers are inserted into a linked list in this order:
10, 20, 30, 40, 50, 60
What would the following statements display?
pCur = head->next;
cout << pCur->data << " ";
cout << pCur->next->data << endl;
a) 20 30
b) 40 50
c) 10 20
d) 30 40
Answer:
A. 20 30
Explanation:
Given
Linked list: 10, 20, 30, 40, 50, 60
Required
The output of the following code segment
pCur = head->next;
cout << pCur->data << " ";
cout << pCur->next->data << endl;
A linked list operates by the use of nodes which begins from the head to the next node, to the next, till it reaches the last;
The first line of the code segment; "pCur = head->next; " shifts the node from the head to the next node
The head node is the node at index 0 and that is 10;
This means that the focus has been shifted to the next at index 1 and that is 20;
So, pCur = 20
The next line of the code segment; cout << pCur->data << " "; prints pCur and a blank space
i.e. "20 " [Take note of the blank space after 20]
The last line "cout << pCur->next->data << endl; " contains two instructions which are
1. pCur = next->data;
2. cout<<pCur->data;
(1) shifts focus to the next node after 20 ; This gives pCur = 30
(2) prints the value of pCur
Hence, the output of the code segment is 20 30
Write a program that reads a list of words. Then, the program outputs those words and their frequencies. Ex: If the input is: hey hi Mark hi mark the output is: hey 1 hi 2 Mark 1 hi 2 mark 1
Answer:
#Declare variable to get the input
#list from the user
input_list = input()
#split the list into words by space
list = input_list.split()
#Begin for-loop to iterate each word
#to get the word frequency
for word in list:
#get the frequency for each word
frequency=list.count(word)
#print word and frequency
print(word,frequency)
Explanation:
This program that we are told to write will be done by using python programming language/ High-level programming language.
The question wants us to write a program in which the output will be as below;
hey 1
hi 2
Mark 1
hi 2
mark 1
Just by imputing hey hi mark hi mark.
Just copy and run the code below.
#Declare variable to get the input
#list from the user
input_list = input()
#split the list into words by space
list = input_list.split()
#Begin for-loop to iterate each word
#to get the word frequency
for word in list:
#get the frequency for each word
frequency=list.count(word)
#print word and frequency
print(word,frequency)
In this exercise we have to use the knowledge in computational language in python to write the following code:
We have the code can be found in the attached image.
So in an easier way we have that the code is
input_list = input()
list = input_list.split()
for word in list:
frequency=list.count(word)
print(word,frequency)
See more about python at brainly.com/question/18502436
TCPDump is used by Wireshark to capture packets while Wireshark own function is:
a. to provide a graphical user interface (GUI) and several capture filters.
b. to act as an intrusion prevention system (IPS) by stopping packets from a black-listed website or packets with payloads of viruses.
c. to defend the network against TCP SYN Flooding attacks by filtering out unnecessary TCP packets.
d. yet to be defined.
Answer:
a. to provide a graphical user interface (GUI) and several capture filters
Explanation:
TcPDump is a command line tool used to capture packets. TcPDump is used to filter packets after a capture has been done. To control network interfaces, TcPDump need to be assigned root privileges. Data is represented in form of text
Wireshark provide a graphical user interface (GUI) and several capture filters. It is a graphical tool used in packet capture analysis. Data is represented in wireshark as text in boxes.
import java.util.Scanner; public class ArraySum { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); final int NUM_ELEMENTS = 8; // Number of elements int[] userVals = new int[NUM_ELEMENTS]; // User numbers int i = 0; // Loop index int sumVal = 0; // For computing sum // Prompt user to populate array System.out.println("Enter " + NUM_ELEMENTS + " integer values..."); for (i = 0; i < NUM_ELEMENTS; ++i) { System.out.print("Value: "); userVals[i] = scnr.nextInt(); } // Determine sum sumVal = 0; for (i = 0; i < NUM_ELEMENTS; ++i) { sumVal = sumVal + userVals[i]; } System.out.println("Sum: " + sumVal); return; } }
Answer:
There's nothing wrong with the question you posted except that it's not well presented or arranged.
When properly formatted, the program will be error free and it'll run properly.
The programming language used in the question is Java programming lamguage.
in java, the sign ";" signifies the end of each line and lines that begins with // represent comments. Using this understanding of end of lines and comments, the formatted code goes thus
import java.util.Scanner;
public class Arraysum {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
final int NUM_ELEMENTS = 8;
// Number of elements
int[] userVals = new int[NUM_ELEMENTS];
// User numbers
int i = 0;
// Loop index
int sumVal = 0;
// For computing sum
// Prompt user to populate array
System.out.println("Enter " + NUM_ELEMENTS + " integer values...");
for (i = 0; i < NUM_ELEMENTS; ++i) {
System.out.print("Value: ");
userVals[i] = scnr.nextInt();
}
// Determine sum
sumVal = 0;
for (i = 0; i < NUM_ELEMENTS; ++i)
{
sumVal = sumVal + userVals[i];
}
System.out.println("Sum: " + sumVal); return;
}
}
Also, see attachment for source file
Describe and list advantages and disadvantages of each of the following backup types:
full, differential, incremental, selective, CPD, and cloud.
Answer:
Full back up
It creates complete copy of the source of data. This feature made it to the best back up with good speed of recovery of the data and simplicity.However, because it is needed for backing up of a lot of data, it is time consuming process,Besides it also disturbs the routine application of the technologist infrastructure. In addition large capacity storage is needed for the storage of the large volume of back up with each new creation.
Incremental back up: back up work at high speed thus saves time, Little storage capacity is needed. This type of back up can be run as many time as wished.
However, the restoration of data takes time, due to the time spent for restoration of initial back up and the incremental.
Differential Back up has very fast back up operation, because it only requires two pieces of back up.This is however slower compare to the Incremental.
The selective back up enable selection of certain type of file or folders for back up.
it can only be used to back up folders only when important data are needed only.Thus the storage capacity is low.
CPD eliminates back up window and reduces the recovery point objective.However, it has issue of compatibility with the resources to back up.,it is also expensive because its solutions are disk based.
Cloud based is affordable and save cost,It is easier to access. it is efficient,it can be access remotely for convenience.
However, Internet sources and some bandwidth must be available for access., always depends on third party providers,There is also problems encountered when switching providers.
Explanation:
A new operating system uses passwords that consist of three characters. Each character must be a digit between 0 and 9. For example, three distinct possible passwords are 123, 416, and 999. The system uses 32-bit salt values. The system also allows one login attempt every second and never locks out users regardless of how many failed attempts occur. If an adversary has obtained a copy of the password file and conducts an offline brute-force attack by trying every password combination until the adversary obtains username and password combination. The use of a 32-bit salt value
Answer:
Brute force is technique that is used for cracking password
In this case the system uses only three characters(0-9). By applying Brute force attack in "hit and try" manner we easily crack the password.
Explanation:
Solution
There are a wide variety of password cracking mechanisms.Brute force is one of the popular password cracking technique.Brute force attack is generally used to crack small passwords.
In the given example the system uses only three characters(0-9).By using Brute force attack in "hit and try" manner we easily crack the password.There are only 10 possible passwords for this type of system.Because we can arrange 0-9 only in 10 ways.But for Systems with long passwords it is difficult to find it in hit and try manner.But instead of having plain password each password have a random salt value.
In a system of 32 bit salt value there are 2^32 different key values.
By increasing the salt value from 32 bits to 64 bits there are 2^64 different key values.It increases the time taken to crack a password for an attacker.so by changing salt value from 32 to 64 bits will make it more harder for the adversary's attack to be successful.
Charles Montesquieu believed that the
Legislative Branch should do what?
A. Make laws
B. Enforce laws
C. Interpret laws
elles sone. All Rights Resed.
Answer:
A. Make Laws
Explanation:
Montesquieu believed the ways to go about limiting the power of a monarch would be to split up power among 3 groups, Judicial, Legislative and Executive. The American Presidential system and Constitution used Montesquieu's writings as a foundation for their principles.
Judicial Interprets lawsLegislative Makes lawsExecutive Enforces LawWhat is a manifold on a vehicle
Answer:
the part of an engine that supplies the fuel/air mixture to the cylinders
Explanation:
There is also an exhaust manifold that collects the exhaust gases from multiple cylinders into a smaller number of pipes
When implementing a physical database from a logical data model, you must consider database performance by allowing data in the database to be accessed more rapidly. In order to increase data availability, the DBA may break up data that are accessed together to be stored together. Which method will improve the performance of this structure when running queries? What are advantages and disadvantages of this method?
Answer:
A method used to improve the performance of structure when running queries is known as Partitioning indexes.
The advantages of partitioning indexes are, It enables data management operations for example, index creation and rebuilding, It increases query performance.
The disadvantages are, one cannot define the primary index of partitioned table to be unique unless the whole partitioning column set is part of the primary index definition.
Explanation:
Solution
Partitioning indexes are known as b -tress indexes that shows hon how to break up the index into separate or different partitions.
Partitioning is usually done to enhance the performance and increased availability. when data are spread over multiple partitions, one can be able to operate on one partition without affecting others. i.e to run utilities, or to take data offline.
Almost all DBMS products support partitioning, but in various ways. we must be sure to know the nuances of an individual a particular DBMS execution before partitioning.
The advantages of Partitioned indexes are as follows:
It enables data management operations for example, index creation and rebuilding
It increases performance of query
It can significantly the impact of schedule downtime for maintenance operations
Disadvantages:
The primary index of partitioned table cannot be described to be unique except if the whole partitioning column set is part of the primary index definition.
A vSphere Administrator is receiving complaints a database VM is experiencing performance issues. The VM is a member of the high priority resource pool and the cluster has not experienced contention.
Which condition should be checked to address immediate performance concerns?
A. VM snapshots
B. VMFS version
C. Resource Pool share value
D. Configured CPU shares
Answer:
C. Resource Pool share value.
Explanation:
The vSphere is a term used to describe the VMware’s virtualization cloud platform. The vSphere comprises of the following, vCenter Server, ESXi, Virtual Machine File System (VMFS) and vCenter Client.
If a vSphere Administrator receive complaints that a database Virtual Machine (VM) is experiencing performance issues and the Virtual Machine (VM) is a member of the high priority resource pool and the cluster has not experienced contention.
In order to address immediate performance concerns, the vSphere Administrator should check the Resource Pool share value.
VMware resource pool refers to the aggregated central processing unit and memory allocated to a Virtual Machine (VM) for flexible management of the resources.
Also, the vSphere Administrator should install VMware tools to check which processes are having high CPU usage by using vimtop, as well as checking if vCenter Server is swapping.
A laptop computer has two internal signals: An unplugged signal, which is '1' if the laptop's power supply is connected, and '0' otherwise. A low battery signal, which is '0' if the laptop's battery has reached an almost empty state, and '1' otherwise. Suppose the laptop's power control system accepts a single hibernate signal which determines if the laptop should change its current operating state and shut down. If the laptop should shut down when the battery is low and its charger is unplugged, which gate could be used to produce the hibernate signal?
Answer:
The correct usage is a NOR gate which is indicated in the explanation.
Explanation:
The truth table for the given two signals, namely
p=unplugged signal
q=low battery signal
can form a truth table of following form
Here p has 2 states
1 if the power supply is connected
0 otherwise
Similarly q has 2 states
0 if the battery has reached almost zero state
1 otherwise
As the condition for the Hibernate Signal is given as to only activate when the battery is low and the power supply is not connected. This indicate that the value of Hibernate signal should be 1 when both p and q are 0.
Using this condition, the truth table is formed as
unplugged signal | low battery signal | Hibernate Signal
0 | 0 | 1
0 | 1 | 0
1 | 0 | 0
1 | 1 | 0
Now the truth table of NOR is given as
a | b | a or b | ~(a or b)
0 | 0 | 0 | 1
0 | 1 | 1 | 0
1 | 0 | 1 | 0
1 | 1 | 1 | 0
This indicates that the both truth tables are same thus the NOR gate is to be used for this purpose.
public class Student {
private String getFood() {
return "Pizza";
}
public String getInfo() {
return this.getFood();
}
}
public class GradStudent extends Student {
private String getFood() {
return "Taco";
}
public void teach(){
System.out.println("Education!");
getInfo();
}
}
What is the output from this:
Student s1 = new GradStudent();
s1.teach();
Education! would be printed, followed by a run-time error when getInfo is called.
Education! Pizza
This code won't run because it won't compile.
Education! Taco
This code causes a run-time error because getInfo is not declared in the GradStudent class.
Answer:
getInfo(); ==
getSy.Info()
Explanation:
Get System Info
Use a one-dimensional array to solve the following problem: A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who grosses $5,000 in sales in a week receives $200 plus 9% of $5,000, or a total of $650. Write an app (using an array of counters) that determines how many of the salespeople earned salaries in each of the following ranges (assume that each salesperson's salary is an integer). a) $200–299
b) $300–399
c) $400–499
d) $500–599
e) $600–699
f) $700–799
g) $800–899
h) $900–999
i) $1000 and over
Summarize the results in tabular format.
Answer: Provided in the explanation section
Explanation:
import java.util.Scanner;
public class commission
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int totals[]={0,0,0,0,0,0,0,0,0};
int n,sales,i,index;
double salary;
System.out.print("how many salesmen do you have? ");
n=input.nextInt();
for(i=1;i<=n;i++)
{System.out.print("Salesman "+i+" enter sales: ");
sales=input.nextInt();
salary=200+(int)(.09*sales);
System.out.printf("Salary=$%.2f\n",salary);
index=(int)salary/100-2;
if(index>8)
index=8;
totals[index]++;
}
System.out.println("SUMMARY\nSALES\t\tCOUNT");
for(i=0;i<8;i++)
System.out.println("$"+(i*100+200)+"-"+(i*100+299)+"\t"+totals[i]);
System.out.println("$1000 and over\t"+totals[i]);
}
}
cheers i hope this helped !!
Consider that a large online company that provides a widely used search engine, social network, and/or news service is considering banning ads for the following products and services from its site: e-cigarettes, abortion clinics, ice cream, and sugared soft drinks. Which, if any, do you think they should ban? Give reasons. In particular, if you select some but not all, explain the criteria for distinguishing.
Answer:
I think that they should ban ads for all four products. These products, e-cigarettes, abortion clinics, ice cream, and sugared soft drinks, are all discreet adult products that should not be advertised because of their health hazards. Since the "large online company provides a widely used search engine, social network, and/or news service, which are mainly patronized by younger people, such ads that promote products injurious to individual health should be banned. Those who really need or want these products know where they could get them. Therefore, the products should not be made easily accessible to all people. Nor, should ads promote their patronage among the general population.
Explanation:
Advertisements create lasting and powerful images which glamourize some products, thereby causing the general population, especially children, to want to consume them without any discrimination of their health implications. If online banning is then contemplated, there should not be any distinguishing among the four products: e-cigarettes, abortion clinics, ice cream, and sugared soft drinks.
Convert each of the following for loops into an equivalent while loop. (You might need to rename some variables for the code to compile, since all four parts a-d are in the same scope.)
// a.
System.out.println("a.");
int max = 5;
for (int n = 1; n <= max; n++) {
System.out.println(n);
}
System.out.println();
// b.
System.out.println("b.");
int total = 25;
for (int number = 1; number <= (total / 2); number++) {
total = total - number;
System.out.println(total + " " + number);
}
System.out.println();
// c.
System.out.println("c.");
for (int i = 1; i <= 2; i++) {
for (int j = 1; j <= 3; j++) {
for (int k = 1; k <= 4; k++) {
System.out.print("*");
}
System.out.print("!");
}
System.out.println();
}
System.out.println();
// d.
System.out.println("d.");
int number = 4;
for (int count = 1; count <= number; count++) {
System.out.println(number);
number = number / 2;
}
Answer:
~CaptnCoderYankee
Don't forget to award brainlyest if I got it right!
Which of the following statements about CASE is not true?CASE tools provide automated graphics facilities for producing charts.CASE tools reduce the need for end user participation in systems development.CASE tools have capabilities for validating design diagrams and specifications.CASE tools support collaboration among team members.CASE tools facilitate the creation of clear documentation
Answer:
CASE tools reduce the need for end user participation in systems development.
Explanation:
CASE is an acronym for Computer-aided Software Engineering and it comprises of software application tools that provide users with automated assistance for Software Development Life Cycle (planning, analysing, designing, testing, implementation and maintenance). The CASE tools helps software developers in reducing or cutting down of the cost and time of software development, as well as the enhancement of the software quality.
Some other benefits of using the CASE tools are;
- CASE tools provide automated graphics facilities for producing charts.
- CASE tools have capabilities for validating design diagrams and specifications.
- CASE tools support collaboration among team members.
- CASE tools facilitate the creation of clear documentation.
- CASE tools checks for consistency, syntax errors and completeness.
The CASE tools can be grouped as, requirement and structure analysis, software design, test-case and code generation, reverse engineering, and document production tools.
Examples of CASE tools are flowchart maker, visible analyst (VA), dreamweaver, net-beans, microsoft visio, adobe illustrator and photoshop etc.
The following if statement uses an overloaded > operator to determine whether the price of a Car object is more than $5000. Car is a struct and myCar is an object of Car. Each Cor object has two variables: id (int) and price (float). As you can see in the following code, the ID of myCar is 12345 and the price is $6,000. Car myCar - [12345, 6000.); float price - 5000; if (myCar > price) cout << "My car price is more than $5,000/n": Which one of the following function prototypes is correct syntax to overload the > operator based on the if statement above. void operator> float price: O bool operator>(Car & car, float price): bool operator (float amt): bool operator> Car & your Car): None of the above
Answer:
The correct syntax to overload is bool operator (float amt): so, the third statement is right.
Explanation:
Solution
From the given question we have to find which statements is correct for the following function prototype.
Now,
Since the price of a Car object is above $5000, the car here is considered a struct and myCar is an object of Car
Both Car object consists of two variables which are id (int) and price (float)
Thus, from the given example the corresponding code says that the ID of myCar is represented as follows:
myCar - [12345, 6000);
The float price = 5000
Then,
cout << "My car price is more than $5,000/n"
Therefore the following statement bool operator (float amt): is the right syntax to overload.
Write a program that lets the Michigan Popcorn Company keep track of their sales for seven different types of popcorn they produce: plain, butter, caramel, cheese, chocolate, turtle and zebra. It should use two parallel seven-element arrays: an array of strings that holds the seven popcorn names and an array of integers that holds the number of bags of popcorn sold during the past month for each popcorn flavor. The names should be stored using an initialization list at the time the flavors array is created. The program should prompt the user to enter the number of bags sold for each flavor. Once the popcorn data has been entered, the program should produce a report for each popcorn type, total sales, and the names of the highest selling and lowest selling products. Be sure to include comments throughout your code where appropriate. Complete the C++ code using Visual Studio or Xcode, compress (zip) and upload the entire project folder to the Blackboard assignment area by clicking on the Browse My Computer button or by dragging the file inside the Attach Files box g
Answer:
#include <iostream>using namespace std;int main(){ // declare and initialize popcorn name array string popcorn_name[7] = {"plain", "butter", "caramel", "cheese", "chocolate", "turtle", "zebra"}; // declare and initialize sales array with 7 elements int sales[7]; // A loop to prompt user to enter sales for each popcorn for(int i=0; i < 7; i++){ cout<<"Enter number of sales for " + popcorn_name[i] + " :"; cin>>sales[i]; } // Find maximum sales int max = sales[0]; int maxIndex = 0; for(int j=1; j < 7; j++){ if(max < sales[j]){ max = sales[j]; maxIndex = j; } } // Find minimum sales int min = sales[0]; int minIndex = 0; for(int k=1; k < 7; k++){ if(min > sales[k]){ min = sales[k]; minIndex = k; } } // Print popcorn name and sales for(int l=0; l < 7 ; l++){ cout<<popcorn_name[l]<<"\n"; cout<<"Sales: "<< sales[l]<<"\n\n"; } // Print popcorn name with maximum and minimum sales cout<<"Highest selling: "<< popcorn_name[maxIndex]<<"\n"; cout<<"Lowest selling: "<<popcorn_name[minIndex]<<"\n"; return 0;}Explanation:
Create two arrays to hold the list of popcorn name and their sales (Line 5-8). Next prompt user to input the sales for each popcorn (Line 10-14). Get the maximum sales of the popcorn (Line 17-24) and minimum sales (Line 27-34). Print the popcorn name and sales (Line 37-40) and the popcorn name with highest and lowest selling (Line 43-44).
In which contingency plan testing strategy do individuals follow each and every IR/DR/BC procedure, including the interruption of service, restoration of data from backups, and notification of appropriate individuals?
a. Full-interruption
b. Desk check
c. Simulation
d. Structured walk-through
Answer:Full-interruption--A
Explanation: The Full-interruption is one of the major steps for a Disaster Recovery Plan, DRP which ensures businesses are not disrupted by saving valuable resources during a disaster like a data breach from fire or flood.
Although expensive and very risky especially in its simulation of a disruption, this thorough plan ensures that when a disaster occurs, the operations are shut down at the primary site and are transferred to the recovery site allowing Individuals follow every procedure, ranging from the interruption of service to the restoration of data from backups, also with the notification of appropriate individuals.
Type a statement using srand() to seed random number generation using variable seedVal. Then type two statements using rand() to print two random integers between (and including) 0 and 9. End with a newline. Ex: 5 7 Note: For this activity, using one statement may yield different output (due to the compiler calling rand() in a different order). Use two statements for this activity. Also, after calling srand() once, do not call srand() again. (Notes)
GIVEN:
#include
#include // Enables use of rand()
#include // Enables use of time()
int main(void) {
int seedVal = 0;
/* Your solution goes here */
return 0;
}
2). Type two statements that use rand() to print 2 random integers between (and including) 100 and 149. End with a newline. Ex:
101
133
Note: For this activity, using one statement may yield different output (due to the compiler calling rand() in a different order). Use two statements for this activity. Also, srand() has already been called; do not call srand() again.
GIVEN:
#include
#include // Enables use of rand()
#include // Enables use of time()
int main(void) {
int seedVal = 0;
seedVal = 4;
srand(seedVal);
/* Your solution goes here */
return 0;
}
Answer:
1. The solution to question 1 is as follows;
srand(seedVal);
cout<<rand()%10<<endl;
cout<<rand()%10<<endl;
2. The solution to question 2 is as follows
cout<<100+rand()%50 <<endl;
cout<<100+rand()%50 <<endl;
Explanation:
The general syntax to generate random number between interval is
Random Number = Lower Limit + rand() % (Upper Limit - Lower Limit + 1)
In 1;
The solution starts by calling srand(seedVal);
The next two statements is explained as follows
To print two random integers between intervals of 0 and 9 using rand()"
Here, the lower limit = 0
the upper limit = 9
By substituting these values in the formula above; the random number will be generated as thus;
Random Number = 0 + rand() % (9 - 0 + 1)
Random Number = 0 + rand() % (10)
Random Number = rand() % (10)
So, the instruction to generate the two random variables is rand() % (10)
2.
Similar to 1 above
To print two random integers between intervals of 100 and 149 using rand()"
Here, the lower limit = 100
upper limit = 149
By substituting these values in the formula above; the random number will be generated as thus;
Random Number = 100 + rand() % (149 - 100 + 1)
Random Number = 100 + rand() % (50)
So, the instruction to generate the two random variables is 100 + rand() % (50)
Which of the following is true about operating system.
a. acts as an intermediary between the computer user and the computer hardware.
b. program that manages the computer hardware.
c. provides a basis for application progra
Answer:
google kis kam ka hai us se puch lo
During an investigation of a cybercrime, the law enforcement officers came across a computer that had the hard drive encrypted. Chose the best course of action they should take to access the data on that drive.
a. Use image filtering techniques to see what's behing the encrypted files.
b. Try to convince the owner of the computer to give you to decryption key/password.
c. Identify the encryption algorithm and attempt a brute force attack to get access to the file.
d. Disconnect the hard drive from power so the encryption key can be exposed on the next power up.
e. Try to copy the drive bit by bit so you can see the files in each directory.
Answer:
b. Try to convince the owner of the computer to give you to decryption key/password.
Explanation:
Encrypted hard drives have maximum security and high data protection. to access them you need to enter a password to unlock them.
The image filtering technique is a method that serves to selectively highlight information contained in an image, for which it does not work.
The encryption algorithm is a component used for the security of electronic data transport, not to access data on an encrypted hard drive.
The encryption key is used in encryption algorithms to transform a message and cannot be exposed by disconnecting the hard drive from its power source.
For the PSoC chip what is the minimum voltage level in volts that can be considered to logic one?
Answer:
Asian man the man is one 1⃣ in a and the perimeters are not only
web pages with personal or biograpic information are called
Answer:
Web pages with personal or biographic information are called. a. Social Networking sites. c.
Explanation:
random integer between 3 and 13 (inclusive)
Answer:
6
Explanation:
Answer:
4
Explanation:
It is between 3 and 13. Please answer some of my questions too! :)
1. Implement the function dict_intersect, which takes two dictionaries as parameters d1 and d2, and returns a new dictionary which contains only those keys which appear in both d1 and d2, whose values are a tuple of the corresponding values from d1 and d2.
E.g., dict_intersect({'a': 'apple', 'b': 'banana'}, {'b': 'bee', 'c': 'cat'}) should return {'b': ('banana', 'bee')}
2. Implement the function consolidate, which accepts zero or more sequences in the star parameter seqs, and returns a dictionary whose keys consist of values found in those sequences, which in turn map to numbers indicating how many times each value appears across all the sequences.
E.g., consolidate([1,2,3], [1,1,1], [2,4], [1]) should return the dictionary {1: 5, 2: 2, 3: 1, 4: 1}.
Answer:
1
def dict_intersect(d1,d2): #create dictionary
d3={} #dictionaries
for key1,value1 in d1.items(): #iterate through the loop
if key1 in d2: #checking condition
d3[key1]=(d1[key1],d2[key1]) #add the items into the dictionary
return d 3
print(dict_intersect({'a': 'apple', 'b': 'banana'}, {'b': 'bee', 'c': 'cat'})) #display
2
def consolidate(*l1): #create consolidate
d3={} # create dictionary
for k in l1: #iterate through the loop
for number in k: #iterate through the loop d3[number]=d3.get(number,0)+1 #increment the value
return d 3 #return
print(consolidate([1,2,3], [1,1,1], [2,4], [1])) #display
Explanation:
1
Following are the description of program
Create a dictionary i.e"dict_intersect(d1,d2) " in this dictionary created a dictionary d3 .After that iterated the loop and check the condition .If the condition is true then add the items into the dictionary and return the dictionary d3 .Finally print them that are specified in the given question .2
Following are the description of program
Create a dictionary consolidate inside that created a dictionary "d3" .After that iterated the loop outer as well as inner loop and increment the value of items .Return the d3 dictionary and print the dictionary as specified in the given question .
what is computer aided design
Three examples of parameter-parsing implementation models are: (1)________, (2)________, and (3)________.
Answer:1) Parse-by-value
2) Parse-by-reference
3) Parse-by-name
Explanation: Parameter parsing refers to a communication among procedures or functions.
The values of a variable procedure are transferred to the called procedure by some mechanisms. Different techniques of parameter-parsing include; parse-by-value, parse-by-reference, parse-by-copy restore, parse-by-name.