Answer:
Explanation:
The following code is written in Python. It is a function that takes two string parameters and compares the lengths of both strings. If the string in variable s1 is greater then the function returns True, otherwise the function returns False. A test case has been provided and the output can be seen in the attached image below.
def compareStrings(s1, s2):
if len(s1) > len(s2):
return True
else:
return False
print(compareStrings("Brainly", "Competition"))
It is common for people to name directories as dir1, dir2, and so on. When there are ten or more directories, the operating system displays them in dictionary order, as dir1, dir10, dir11, dir12, dir2, dir3, and so on. That is irritating, and it is easy to fix. Provide a comparator that compares strings that end in digit sequences in a way that makes sense to a human. First compare the part before the digit as strings, and then compare the numeric values of the digits.
Your program should work with the provided test program
DirectorySortDemo.java.
Call the class you write DirectoryComparator.java.
Submit the two files in your submission.
DirectoryComparator.java
DirectorySortDemo.java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.collections;
public class DirectorySortDemo
{
public static void main (String [] args)
{
String dirNames ("dir12", "dir5", "dir9", "dirl", "dir4",
"lab10", "1ab2", "lab7", "lab17", "lab8",
"quiz8", "quiz10", "quiz11", "quiz12",
"dirll", "dir8", "dir7", "dir15", "dir3");
ArrayList directories = new
ArrayList<> (Arrays.asList (dirNames));
System.out.println ("Unsorted List:");
System.out.println (directories);
Collections.sort (directories, new DirectoryComparator ());
System.out.println ():
System.out-println ("Sorted List: ");
System.out.-println (directories);
Answer:
Here the code is given as follows,
Explanation:
Given an array of n distinct integers sorted in ascending order, write a function that returns a Fixed Point in the array, if there is any Fixed Point present in array, else returns -1. Fixed Point in an array is an index i such that arr[i] is equal to i. Note that integers in array can be negative. Examples: #include using namespace std; void removeDivByFive(int *arr,int& size) { int index=0; for(int i=0;i
Answer:
The function is as follows:
int returnsFixed(int arr [],int n){
int retVal = -1;
for(int i = 0; i<n;i++){
if(i == arr[i]){
retVal = i;
break;
}
}
return retVal;
}
Explanation:
This defines the functionl it receives the array and the length of the array
int returnsFixed(int arr [],int n){
This initializes the return value to -1
int retVal = -1;
This iterates through the array
for(int i = 0; i<n;i++){
This checks if i equals arr[i]
if(i == arr[i]){
If yes, the return value (i.e. the fixed point) is set to i
retVal = i;
And the code is exited
break;
} This ends the if condition
} This ends the iteration
This returns the calculated fixed point
return retVal;
}
Write a program in Cto define a structure Patient that has the following members
Answer:
Explanation:
The answer should be 1.16 or 61.1
Which attack form either exploits a software flaw or floods a system with traffic in order to prevent legitimate activities or transactions from occurring?
Answer:
Denial of service attack.
Explanation:
In Cybersecurity, vulnerability can be defined as any weakness, flaw or defect found in a software application or network and are exploitable by an attacker or hacker to gain an unauthorized access or privileges to sensitive data in a computer system.
This ultimately implies that, vulnerability in a network avail attackers or any threat agent the opportunity to leverage on the flaws, errors, weaknesses or defects found in order to compromise the security of the network.
Data theft can be defined as a cyber attack which typically involves an unauthorized access to a user's data with the sole intention to use for fraudulent purposes or illegal operations. There are several methods used by cyber criminals or hackers to obtain user data and these includes DDOS attack, SQL injection, man in the middle, phishing, sniffing, DOS attack, etc.
A denial of service (DOS) attack is a form of cyber attack that involves either the exploitation of a software flaw or overwhelmingly floods a computer system in a network with traffic in order to prevent authorized users from performing legitimate activities or transactions.
Some of the ways to prevent vulnerability or cyber attacks in a network are;
1. Ensure you use a very strong password with complexity through the use of alphanumerics.
2. You should use a two-way authentication service.
3. You should use encrypting software applications or services.
A blogger writes that the new "U-Phone" is superior to any other on the market. Before buying the U-Phone based on this review, a savvy consumer should (5 points)
consider if the blogger has been paid by U-Phone
assume the blogger probably knows a lot about U-Phones
examine multiple U-Phone advertisements
speak to a U-Phone representative for an unbiased opinion
Answer:
Speak to a U-Phone representative.
Explanation:
A representative will tell you the necessary details about the U-phone without any biases whatsoever, as they´re the closest to the company when it comes to detail about their products.
How does OOP keep both code and data safe from outside interference and
incuse?
Answer:
it is the process that binds together the data and code into a single unit and keeps both from being safe from outside interference and misuse. In this process, the data is hidden from other classes and can be accessed only through the current class's methods
Indicate whether the following actions are the actions of a person who will be a victim, or will not be a victim, of phishing attacks.
Replying to an e-mail requesting your user ID and password Phishing victim Not a phishing victim
Answer:
Phishing Victim
Explanation:
Replying to this email could make you a victim of a phishing scam. Phishing attacks are common challenges on security that internet users are faced with. It could lead to others getting hold of sensitive information like your password or bank details. email is one way the hackers used to get this information. replying to such an email could lead one to an unsecure website where information could be extracted
Which of the following restricts the ability for individuals to reveal information present in some part of the database?
a. Access Control
b. Inference Control
c. Flow Control
d. Encyption
Answer:
it would have to be flow control which would be C.
Explanation:
Flow Control is restricts the ability for individuals to reveal information present in some part of the database. Hence, option C is correct.
What is Flow Control?The management of data flow between computers, devices, or network nodes is known as flow control. This allows the data to be processed at an effective rate. Data overflow, which occurs when a device receives too much data before it can handle it, results in data loss or retransmission.
A design concern at the data link layer is flow control. It is a method that typically monitors the correct data flow from sender to recipient. It is very important because it allows the transmitter to convey data or information at a very quick rate, which allows the receiver to receive it and process it.
The amount of data transmitted to the receiver side without any acknowledgement is dealt with by flow control.
Thus, option C is correct.
For more information about Flow Control, click here:
https://brainly.com/question/28271160
#SPJ5
Write a RainFall class that stores the total rainfall for each of 12 months into an array of doubles. The program should have methods that return the following:
the total rainfall for the year
the average monthly rainfall
the month with the most rain
the month with the least rain
Demonstrate the class in a complete program.
Input Validation: Do not accept negative numbers for monthly rainfall figures.
import java.io.*;
import java.util.*;
public class Rainfall
{
Scanner in = new Scanner(System.in);
private int month = 12;
private double total = 0;
private double average;
private double standard_deviation;
private double largest;
private double smallest;
private double months[];
public Rainfall()
{
months = new double[12];
}
public void setMonths()
{
for(int n=1; n <= month; n++)
{
System.out.println("Enter the rainfall (in inches) for month #" + n + ":" );
months[n-1] = in.nextInt();
}
}
public double getTotal()
{
total = 0;
for(int i = 0; i < 12; i++)
{
total = total + months[i];
}
System.out.println("The total rainfall for the year is" + total);
return total;
}
public double getAverage()
{
average = total/12;
System.out.println("The average monthly rainfall is" + average);
return average;
}
public double getLargest()
{
double largest = 0;
int largeind = 0;
for(int i = 0; i < 12; i++)
{
if (months[i] > largest)
{
largest = months[i];
largeind = i;
}
}
System.out.println("The largest amout of rainfall was" + largest +
"inches in month" + (largeind + 1));
return largest;
}
public double getSmallest()
{
double smallest = Double.MAX_VALUE;
int smallind = 0;
for(int n = 0; n < month; n++)
{
if (months[n] < smallest)
{
smallest = months[n];
smallind = n;
}
}
System.out.println("The smallest amout of rainfall was" + smallest +
"inches in month " + (smallind + 1));
return smallest;
}
public static void main(String[] args)
{
Rainfall r = new Rainfall();
r.setMonths();
System.out.println("Total" + r.getTotal());
System.out.println("Smallest" + r.getSmallest());
System.out.println("Largest" + r.getLargest());
System.out.println("Average" + r.getAverage());
}
}
Answer:
Explanation:
The code provided worked for the most part, it had some gramatical errors in when printing out the information as well as repeated values. I fixed and reorganized the printed information so that it is well formatted. The only thing that was missing from the code was the input validation to make sure that no negative values were passed. I added this within the getMonths() method so that it repeats the question until the user inputs a valid value. The program was tested and the output can be seen in the attached image below.
import java.io.*;
import java.util.*;
class Rainfall
{
Scanner in = new Scanner(System.in);
private int month = 12;
private double total = 0;
private double average;
private double standard_deviation;
private double largest;
private double smallest;
private double months[];
public Rainfall()
{
months = new double[12];
}
public void setMonths()
{
for(int n=1; n <= month; n++)
{
int answer = 0;
while (true) {
System.out.println("Enter the rainfall (in inches) for month #" + n + ":" );
answer = in.nextInt();
if (answer > 0) {
months[n-1] = answer;
break;
}
}
}
}
public void getTotal()
{
total = 0;
for(int i = 0; i < 12; i++)
{
total = total + months[i];
}
System.out.println("The total rainfall for the year is " + total);
}
public void getAverage()
{
average = total/12;
System.out.println("The average monthly rainfall is " + average);
}
public void getLargest()
{
double largest = 0;
int largeind = 0;
for(int i = 0; i < 12; i++)
{
if (months[i] > largest)
{
largest = months[i];
largeind = i;
}
}
System.out.println("The largest amount of rainfall was " + largest +
" inches in month " + (largeind + 1));
}
public void getSmallest()
{
double smallest = Double.MAX_VALUE;
int smallind = 0;
for(int n = 0; n < month; n++)
{
if (months[n] < smallest)
{
smallest = months[n];
smallind = n;
}
}
System.out.println("The smallest amount of rainfall was " + smallest +
" inches in month " + (smallind + 1));
}
public static void main(String[] args)
{
Rainfall r = new Rainfall();
r.setMonths();
r.getTotal();
r.getSmallest();
r.getLargest();
r.getAverage();
}
}
You know different types of networks. If two computing station high speed network link for proper operation which of the following network type should be considered as a first priority?
MAN
WAN
WLAN
LAN
All of these
Answer:
All of these.
PLZ MARK ME BRAINLIEST.
A cashier distributes change using the maximum number of five-dollar bills, followed by one-dollar bills. Write a single statement that assigns num_ones with the number of distributed one-dollar bills given amount_to_change. Hint: Use %.
Sample output with input: 19
Change for $ 19
3 five dollar bill(s) and 4 one dollar bill(s)
1 amount_to_change = int(input())
2
3 num_fives amount_to_change // 5
4
5 Your solution goes here
6 I
7 print('Change for $, amount_to_change)
8 print(num_fives, 'five dollar bill(s) and', num_ones, 'one dollar bill (s)')
Answer:
Explanation:
The code that was provided in the question contained a couple of bugs. These bugs were fixed and the new code can be seen below as well as with the solution for the number of one-dollar bills included. The program was tested and the output can be seen in the attached image below highlighted in red.
amount_to_change = int(input())
num_fives = amount_to_change // 5
#Your solution goes here
num_ones = amount_to_change % 5
print('Change for $' + str(amount_to_change))
print(num_fives, 'five dollar bill(s) and', num_ones, 'one dollar bill (s)')
In the forward chaining technique, used by the inference engine component of an expert system, the _____ condition is evaluated first.
Answer:
"if" is the right response.
Explanation:
Forward chaining is being utilized just to split the logical sequential order down as well as operate throughout every component once the preceding one is accomplished, from start to finish.Its whole algorithm begins with proven information that activates all the rules, which are fulfilled as well as makes established realities even more complete.A recursive method may call other methods, including calling itself. A recursive method has:
1. a base case -- a case that returns a value or exits from a method without performing a recursive call.
2. a recursive case -- calling the method again with a smaller case..
Study the recursive method given below.
For example, this call recursiveMethod (5); returns 15:
public static int recursiveMethod (int num) (
if (num == 0)
return 1;
else {
if (numX2!=0)
return num * recursiveMethod (num -1);
else
return recursiveMethod (num-1);
}
}
1 What is the base case?
2. What does the following statement check?
3. What does the method do?
Answer:
Hence the answer is given as follows,
Explanation:
Base Case:-
If (num == 0) //This is the base case for the given recursive method
return 1;
If(num % 2!=0) checks whether num is odd.
The above condition is true for all odd numbers and false for even numbers.
if the remainder is not equal to zero when we divide the number with 2 then it is odd.
The method:-
The above recursive method calculates the product of odd numbers up to the given range(that is num)
For num=5 => 15(5*3*1).
For num=7 => 105(7*5*3*1).
For num=10 => 945(9*7*5*3*1).
In python,
Here's some fake data.
df = {'country': ['US', 'US', 'US', 'US', 'UK', 'UK', 'UK'],
'year': [2008, 2009, 2010, 2011, 2008, 2009, 2010],
'Happiness': [4.64, 4.42, 3.25, 3.08, 3.66, 4.08, 4.09],
'Positive': [0.85, 0.7, 0.54, 0.07, 0.1, 0.92, 0.94],
'Negative': [0.49, 0.09, 0.12, 0.32, 0.43, 0.21, 0.31],
'LogGDP': [8.66, 8.23, 7.29, 8.3, 8.27, 6.38, 6.09],
'Support': [0.24, 0.92, 0.54, 0.55, 0.6, 0.38, 0.63],
'Life': [51.95, 55.54, 52.48, 53.71, 50.18, 49.12, 55.84],
'Freedom': [0.65, 0.44, 0.06, 0.5, 0.52, 0.79, 0.63, ],
'Generosity': [0.07, 0.01, 0.06, 0.28, 0.36, 0.33, 0.26],
'Corruption': [0.97, 0.23, 0.66, 0.12, 0.06, 0.87, 0.53]}
I have a list of happiness and six explanatory vars.
exp_vars = ['Happiness', 'LogGDP', 'Support', 'Life', 'Freedom', 'Generosity', 'Corruption']
1. Define a variable called explanatory_vars that contains the list of the 6 key explanatory variables
2. Define a variable called plot_vars that contains Happiness and each of the explanatory variables. (Hint: recall that you can concatenate Python lists using the addition (+) operator.)
3. Using sns.pairplot, make a pairwise scatterplot for the WHR data frame over the variables of interest, namely the plot_vars. To add additional information, set the hue option to reflect the year of each data point, so that trends over time might become apparent. It will also be useful to include the options dropna=True and palette='Blues'.
Answer:
Here the answer is given as follows,
Explanation:
import seaborn as sns
import pandas as pd
df = {'country': ['US', 'US', 'US', 'US', 'UK', 'UK', 'UK'],
'year': [2008, 2009, 2010, 2011, 2008, 2009, 2010],
'Happiness': [4.64, 4.42, 3.25, 3.08, 3.66, 4.08, 4.09],
'Positive': [0.85, 0.7, 0.54, 0.07, 0.1, 0.92, 0.94],
'Negative': [0.49, 0.09, 0.12, 0.32, 0.43, 0.21, 0.31],
'LogGDP': [8.66, 8.23, 7.29, 8.3, 8.27, 6.38, 6.09],
'Support': [0.24, 0.92, 0.54, 0.55, 0.6, 0.38, 0.63],
'Life': [51.95, 55.54, 52.48, 53.71, 50.18, 49.12, 55.84],
'Freedom': [0.65, 0.44, 0.06, 0.5, 0.52, 0.79, 0.63, ],
'Generosity': [0.07, 0.01, 0.06, 0.28, 0.36, 0.33, 0.26],
'Corruption': [0.97, 0.23, 0.66, 0.12, 0.06, 0.87, 0.53]}
dataFrame = pd.DataFrame.from_dict(df)
explanatory_vars = ['LogGDP', 'Support', 'Life', 'Freedom', 'Generosity', 'Corruption']
plot_vars = ['Happiness'] + explanatory_vars
sns.pairplot(dataFrame,
x_vars = explanatory_vars,
dropna=True,
palette="Blues")
????????????????????????????????
(c) 4
Explanation:The function strpos() is a function in php that returns the position of the first occurrence of a particular substring in a string. Positions are counted from 0. The function receives two arguments. The first argument is the string from which the occurrence is to be checked. The second argument is the substring to be checked.
In this case, the string is "Get Well Soon!" while the substring is "Well"
Starting from 0, the substring "Well" can be found to begin at position 4 of the string "Get Well Soon!".
Therefore, the function strpos("Get Well Soon!", "Well") will return 4.
Then, with the echo statement, which is used for printing, value 4 will be printed as output of the code.
1. What is memory mapped I/O?
Answer:
Memory-mapped I/O and port-mapped I/O are two complementary methods of performing input/output between the central processing unit and peripheral devices in a computer. An alternative approach is using dedicated I/O processors, commonly known as channels on mainframe computers, which execute their own instructions.
Write a programmer defined function that compares the ASCII sum of two strings. To compute the ASCII sum, you need to compute the ASCII value of each character of the string and sum them up. You will thus need to calculate two sums, one for each string. Then, return true if the first string has a larger ASCII sum compared to the second string, otherwise return false. In your main function, prompt the user to enter two strings with a suitable message and provide the strings to the function during function call. The user may enter multiple words for either string. Then, use the Boolean data returned by the function to inform which string has the higher ASCII sum.
Answer:
The program in Python is as follows:
def ASCIIsum(str1,str2):
asciisum1 = 0; asciisum2 = 0
for chr in str1:
asciisum1 += (ord(chr) - 96)
for chr in str2:
asciisum2 += (ord(chr) - 96)
if asciisum1 > asciisum2:
return True
else:
return False
str1 = input("Enter first string: ")
str2 = input("Enter second string: ")
if ASCIIsum(str1,str2) == True:
print(str1,"has a higher ASCII value")
else:
print(str2,"has a higher ASCII value")
Explanation:
This defines the function
def ASCIIsum(str1,str2):
This initializes the ascii sum of both strings to 0
asciisum1 = 0; asciisum2 = 0
This iterates through the characters of str1 and add up the ascii values of each character
for chr in str1:
asciisum1 += (ord(chr) - 96)
This iterates through the characters of str2 and add up the ascii values of each character
for chr in str2:
asciisum2 += (ord(chr) - 96)
This returns true if the first string has a greater ascii value
if asciisum1 > asciisum2:
return True
This returns false if the second string has a greater ascii value
else:
return False
The main begins here
This gets input for first string
str1 = input("Enter first string: ")
This gets input for second string
str2 = input("Enter second string: ")
If the returned value is True
if ASCIIsum(str1,str2) == True:
Then str1 has a greater ascii value
print(str1,"has a higher ASCII value")
If otherwise
else:
Then str2 has a greater ascii value
print(str2,"has a higher ASCII value")
Complete the calcAverage() method that has an integer array parameter and returns the average value of the elements in the array as a double.(Java program)
Ex: If the input array is:
1 2 3 4 5
then the returned average will be:
3.0
Answer:
Explanation:
The following Java program has the method calcAverage(). It creates a sum variable which holds the sum of all the values in the array and the count variable which holds the number of elements in the array. Then it uses a For Each loop to loop through the array and go adding each element to the sum variable. Finally it calculates the average by dividing the sum by the variable count and returns the average to the user. A test case has been created in the main method using the example in the question. The output can be seen in the image attached below.
class Brainly {
public static void main(String[] args) {
int[] myArr = {1, 2, 3, 4, 5};
System.out.println(calcAverage(myArr));
}
public static double calcAverage(int[] myArr) {
double sum = 0;
double count = myArr.length;
for (int x: myArr) {
sum += x;
}
double average = sum / count;
return average;
}
}
Analyze the following code:
// Enter an integer Scanner input = new Scanner(System.in);
int number = input.nextInt(); if (number <= 0) System.out.println(number);
1) The if statement is wrong, because it does not have the else clause;
2) System.out.println(number); must be placed inside braces;
3) If number is zero, number is displayed;
4) If number is positive, number is displayed.
5) number entered from the input cannot be negative.
Answer:
3) If number is zero, number is displayed;
Explanation:
The code snippet created is supposed to take any input number from the user (positive or negative) and print it to the console if it is less than 0. In this code the IF statement does not need an else clause and will work regardless. The System.out.println() statement does not need to be inside braces since it is a simple one line statement. Therefore, the only statement in the question that is actually true would be ...
3) If number is zero, number is displayed;
Answer:
If number is zero, number is displayed
Explanation:
Given
The above code segment
Required
What is true about the code segment
Analyzing the options, we have:
(1) Wrong statement because there is no else clause
The above statement is not a requirement for an if statement to be valid; i.e. an if statement can stand alone in a program
Hence, (1) is false
(2) The print statement must be in { }
There is only one statement (i.e. the print statement) after the if clause. Since the statement is just one, then the print statement does not have to be in {} to be valid.
Hence, (2) is false
(3) number is displayed, if input is 0
In the analysis of the program, we have: number <=0
i.e. the if statement is true for only inputs less than 0 or 0.
Hence, number will be printed and (3) is false
(4) number is displayed for positive inputs
The valid inputs have been explained in (3) above;
Hence, (4) is false.
(5) is also false
Cardinality ratios often dictate the detailed design of a database. The cardinality ratio depends on the real-world meaning of the entity types involved and is defined by the specific application. For the binary relationships below, suggest cardinality ratios based on the common-sense meaning of the entity types. Clearly state any assumptions you make.
Entity 1 Cardinality Ratio Entity 2
1. Student SocialSecurityCard
2. Student Teacher
3. ClassRoom Wall
4. Country CurrentPresident
5. Course TextBook
6. Item (that can
be found in an
order) Order
7. Student Class
8. Class Instructor
9. Instructor Office
10. E-bay Auction item E-bay bid
Solution :
ENTITY 1 CARDINALITY RATIO ENTITY 2
1. Student 1 to many Social security card
A student may have more than one
social security card (legally with the
same unique social security number),
and every social security number belongs
to a unique.
2. Student Many to Many Teacher
Generally students are taught by many
teachers and a teacher teaches many students.
3.ClassRoom Many to Many Wall
Do not forget that the wall is usually
shared by adjacent rooms.
4. Country 1 to 1 Current President
Assuming a normal country under normal
circumstances having one president at a
time.
5. Course Many to Many TextBook
A course may have many textbooks and
text book may be prescribed for different
courses.
6. Item Many to Many Order
Assuming the same item can appear
in different orders.
7. Student Many to Many Class
One student may take several classes.
Every class usually has several students.
8. Class Many to 1 Instructor
Assuming that every class has a unique
instructor. In case instructors were allowed
to team teach, this will be many-many.
9. Instructor 1 to 1 Office
Assuming every instructor has only one
office and it is not shared. In case of offices
shared by 2 instructors, the relationship
will be 2-1. Conversely, if any instructor has a joint
appointment and offices in both departments,
then the relationship will be 1-2. In a very general
case, it may be many-many.
10. E-bay Auction item 1-Many E-bay bid
1 item has many bids and a bid is unique
to an item.
Gray London is a retired race car driver who helped Dale Earnhardt, Jr. get his start. He is writing a book and making a video about the early days or Dale Earnhardt. He is trying to decide whether to market these items directly over the Internet or to use intermediaries. To make this decision, he needs to know the pros and cons of each route. Provide that information and make a recommendation to him.
Answer:
Explanation:
Marketing your product directly over the internet can lead to much greater profits and there are many options that you can choose from in order to target the correct audience. Unfortunately, doing so does require marketing knowledge and is basically like growing a business. If you were to use intermediaries they already have the knowledge necessary to market your product but will take a percentage of the profits, which will ultimately limit your gains. Since Gray London is a race car driver, I am assumming that he does not have any prior technological expertise or marketing expertise, therefore I would recommend using intermediaries.
SQLite is a database that comes with Android. Which statements is/are correct?
The content of an SQLite database is stored in XML formatted files because XML is the only file format supported by Android OS.
A SQLite database is just another name for a Content Provider. There is no difference as the SQLite implementation implements the Content Provider interface.
If an app creates an SQLite database and stores data in it, then all of the data in that particular database will be stored in one, single file.
A database query to an SQLite database usually returns a set of answers
To access individual entries, SQLite provides a so-called Cursor to enumerate all entries in the set.
This is yet another example of the Iterator pattern.
Answer:
1. Wrong as per my knowledge, SQLite may be an electronic database software that stores data in relations(tables).
2. Wrong. Content provider interface controls the flow of knowledge from your android application to an external data storage location. Data storage is often in any database or maybe it'll be possible to store the info in an SQLite database also.
3.Right. SQLite uses one file to store data. It also creates a rollback file to backup the stored data/logs the transactions.
4. Wrong. The queries are almost like a traditional electronic database system, the queries are going to be answered as per the conditions given and should return a group of answers or one answer depending upon the info and sort of query used.
5. Right. A cursor helps to point to one entry within the database table. this may be very helpful in manipulating the present row of the query easily.
Large computer programs, such as operating systems, achieve zero defects prior to release. Group of answer choices True False PreviousNext
Answer:
The answer is "False"
Explanation:
It is put to use Six Sigma had 3.4 defects per million opportunities (DPMO) from the start, allowing for a 1.5-sigma process shift. However, the definition of zero faults is a little hazy. Perhaps the area beyond 3.4 DPMO is referred to by the term "zero faults.", that's why Before being released, large computer programs, such as operating systems, must have no faults the wrong choice.
What Are the Benefits of Using Leads Automation Tool?
Answer:
Here are the top benefits of using the latest leads automation tool for your personal pursuit, professional service, and other types of businesses.
Frees Up A Lot of Time & ResourcesCompound Connection Growth StrategyViewing ProfilesSending Connection RequestsEndorses Skills of Your First Level ContactsBuild your networkImportance of Leads Automation Tool For LinkedIn
Unlike a traditional and non-automation approach, the best LinkedIn leads automation tool 2020 makes the process far more easier and efficient. It helps to win a good number of connections which would eventually make it easier for businesses to pitch their products and turn newly gained connections into potential customers.
Moreover, businesses will also get more views and new messages in your LinkedIn inbox. The best leads automation tool free are especially useful when you have multiple LinkedIn accounts as you will get rid of time-consuming hectic tasks.
Write a removeDuplicates() method for the LinkedList class we saw in lecture. The method will remove all duplicate elements from the LinkedList by removing the second and subsequent elements. If there is only one copy of an element, it is not removed. The list size should shrink accordingly based on the number of duplicates removed.
Answer:
removeDuplicates() function:-
//removeDuplicates() function removes duplicate elements form linked list.
void removeDuplicates() {
//declare 3 ListNode pointers ptr1,ptr2 and duplicate.
//initially, all points to null.
ListNode ptr1 = null, ptr2 = null, duplicate = null;
//make ptr1 equals to head.
ptr1 = head;
//run while loop till ptr1 points to second last node.
//pick elements one by one..
while (ptr1 != null && ptr1.next != null)
{
// make ptr2 equals to ptr1.
//or make ptr2 points to same node as ptr1.
ptr2 = ptr1;
//run second while loop to compare all elements with above selected element(ptr1->val).
while (ptr2.next != null)
{
//if element pointed by ptr1 is same as element pointed by ptr2.next.
//Then, we have found duplicate element.
//Now , we have to remove this duplicate element.
if (ptr1.val == ptr2.next.val)
{
//make duplicate pointer points to node where ptr2.next points(duplicate node).
duplicate = ptr2.next;
//change links to remove duplicate node from linked list.
//make ptr2.next points to duplicate.next.
ptr2.next = duplicate.next;
}
//if element pointed by ptr1 is different from element pointed by ptr2.next.
//then it is not duplicate element.
//So, move ptr2 = ptr2.next.
else
{
ptr2 = ptr2.next;
}
}
//move ptr1 = ptr1.next, after check duplicate elements for first node.
//Now, we check duplicacy for second node and so on.
//so, move ptr1 by one node.
ptr1 = ptr1.next;
}
}
Explanation:
Complete Code:-
//Create Linked List Class.
class LinkedList {
//Create head pointer.
static ListNode head;
//define structure of ListNode.
//it has int val(data) and pointer to ListNode i.e, next.
static class ListNode {
int val;
ListNode next;
//constructor to create and initialize a node.
ListNode(int d) {
val = d;
next = null;
}
}
//removeDuplicates() function removes duplicate elements form linked list.
void removeDuplicates() {
//declare 3 ListNode pointers ptr1,ptr2 and duplicate.
//initially, all points to null.
ListNode ptr1 = null, ptr2 = null, duplicate = null;
//make ptr1 equals to head.
ptr1 = head;
//run while loop till ptr1 points to second last node.
//pick elements one by one..
while (ptr1 != null && ptr1.next != null)
{
// make ptr2 equals to ptr1.
//or make ptr2 points to same node as ptr1.
ptr2 = ptr1;
//run second while loop to compare all elements with above selected element(ptr1->val).
while (ptr2.next != null)
{
//if element pointed by ptr1 is same as element pointed by ptr2.next.
//Then, we have found duplicate element.
//Now , we have to remove this duplicate element.
if (ptr1.val == ptr2.next.val)
{
//make duplicate pointer points to node where ptr2.next points(duplicate node).
duplicate = ptr2.next;
//change links to remove duplicate node from linked list.
//make ptr2.next points to duplicate.next.
ptr2.next = duplicate.next;
}
//if element pointed by ptr1 is different from element pointed by ptr2.next.
//then it is not duplicate element.
//So, move ptr2 = ptr2.next.
else
{
ptr2 = ptr2.next;
}
}
//move ptr1 = ptr1.next, after check duplicate elements for first node.
//Now, we check duplicacy for second node and so on.
//so, move ptr1 by one node.
ptr1 = ptr1.next;
}
}
//display() function prints linked list.
void display(ListNode node)
{
//run while loop till last node.
while (node != null)
{
//print node value of current node.
System.out.print(node.val + " ");
//move node pointer by one node.
node = node.next;
}
}
public static void main(String[] args) {
//Create object of Linked List class.
LinkedList list = new LinkedList();
//first we create nodes and connect them to form a linked list.
//Create Linked List 1-> 2-> 3-> 2-> 4-> 2-> 5-> 2.
//Create a Node having node data = 1 and assign head pointer to it.
//As head is listNode of static type. so, we call head pointer using class Name instead of object name.
LinkedList.head = new ListNode(1);
//Create a Node having node data = 2 and assign head.next to it.
LinkedList.head.next = new ListNode(2);
LinkedList.head.next.next = new ListNode(3);
LinkedList.head.next.next.next = new ListNode(2);
LinkedList.head.next.next.next.next = new ListNode(4);
LinkedList.head.next.next.next.next.next = new ListNode(2);
LinkedList.head.next.next.next.next.next.next = new ListNode(5);
LinkedList.head.next.next.next.next.next.next.next = new ListNode(2);
//display linked list before Removing duplicates.
System.out.println("Linked List before removing duplicates : ");
list.display(head);
//call removeDuplicates() function to remove duplicates from linked list.
list.removeDuplicates();
System.out.println("")
//display linked list after Removing duplicates.
System.out.println("Linked List after removing duplicates : ");
list.display(head);
}
}
Output:-
Assign courseStudent's name with Smith, age with 20, and ID with 9999. Use the print member function and a separate cout statement to output courseStudents's data. End with a newline. Sample output from the given program:
#include
#include
using namespace std;
class PersonData {
public:
void SetName(string userName) {
lastName = userName;
};
void SetAge(int numYears) {
ageYears = numYears;
};
// Other parts omitted
void PrintAll() {
cout << "Name: " << lastName;
cout << ", Age: " << ageYears;
};
private:
int ageYears;
string lastName;
};
class StudentData: public PersonData {
public:
void SetID(int studentId) {
idNum = studentId;
};
int GetID() {
return idNum;
};
private:
int idNum;
};
int main() {
StudentData courseStudent;
/* Your solution goes here */
return 0;
}
Answer:
Replace /* Your solution goes here */
with the following:
courseStudent.SetName("Smith");
courseStudent.SetAge(20);
courseStudent.SetID(9999);
courseStudent.PrintAll();
cout <<courseStudent.GetID();
Explanation:
From the given code segment, we have the following methods defined under the StudentData class;
SetName -> It receives name from the main
SetAge -> It receives age from the main
SetID --> It receives ID from the main and passes it to GetID method
printID --> Prints all the required output.
So, we have:
Pass name to setName
courseStudent.SetName("Smith");
Pass age to setAge
courseStudent.SetAge(20);
Pass ID to setID
courseStudent.SetID(9999);
Print all necessary outputs
courseStudent.PrintAll();
Manually print the student ID
cout <<courseStudent.GetID();
Functions IN C LANGUAGE
Problem 1
Function floor may be used to round a number to a specific decimal place. The statement
y = floor( x * 10 + .5 ) / 10;
rounds x to the tenths position (the first position to the right of the decimal point). The
statement
y = floor( x * 100 + .5 ) / 100;
rounds x to the hundredths position (the second position to the right of the decimal
point).
Write a program that defines four functions to round a number x in various ways
a. roundToInteger( number )
b. roundToTenths( number )
c. roundToHundreths( number )
d. roundToThousandths( number )
For each value read, your program should print the original value, the number rounded to
the nearest integer, the number rounded to the nearest tenth, the number rounded to
the nearest hundredth, and the number rounded to the nearest thousandth.
Input Format
Input line contain a float number.
Output Format
Print the original value, the number rounded to the nearest integer, the number rounded
to the nearest tenth, the number rounded to the nearest hundredth, and the number
rounded to the nearest thousandth
Examples
Example 1
Input 1
24567.8
Output 1
24567.8 24568 24570 24600
How can COUNTIF, COUNTIFS, COUNT, COUNTA, and COUNTBLANK functions aide a company to support its mission or goals
Answer:
Following are the responses to these questions:
Explanation:
It employs keywords to autonomously do work tasks. Users can type numbers directly into the formulas or use the following formulae, so any data the cells referenced provide would be used in the form.
For instance, this leadership involves accounting, and Excel is concerned with organizing and organizing numerical data. In this Equation, I can discover all its information in the data. This idea is simple me count the number many cells containing a number, and also the number of integers. It counts integers in any sorted number as well. As both financial analysts, it is helpful for the analysis of the data if we want to maintain the same number of neurons.
Create and configure databases in oracle database management system operation administration
Answer:
You typically create a database during Oracle Database software installation. However, you can also create a database after installation.
Reasons to create a database after installation are as follows:
You used Oracle Universal Installer (OUI) to install software only, and did not create a database. You want to create another database (and database instance) on the same host computer as an existing Oracle database. In this case, this chapter assumes that the new database uses the same Oracle home as the existing database. You can also create the database in a new Oracle home by running OUI again. You want to make a copy of (clone) a database.
Write a program that launches 1,000 threads. Each thread adds 1 to a variable sum that initially is 0. You need to pass sum by reference to each thread. In order to pass it by reference, define an Integer wrapper object to hold sum. Run the program with and without synchronization to see its effect. Submit the code of the program and your comments on the execution of the program.
Answer:
Following are the code to the given question:
import java.util.concurrent.*; //import package
public class Threads //defining a class Threads
{
private Integer s = new Integer(0);//defining Integer class object
public synchronized static void main(String[] args)//defining main method
{
Threads t = new Threads();//defining threads class object
System.out.println("What is sum ?" + t.s);//print value with message
}
Threads()//defining default constructor
{
ExecutorService exe = Executors.newFixedThreadPool(1000);//defining ExecutorService class object
System.out.println("With SYNCHRONIZATION........");//print message
for(int i = 1; i <= 1000; i++)//defining a for loop
{
exe.execute(new SumTask2());//calling execute method
System.out.println("At Thread " + i +" Sum= " + s + " , ");//print message with value
}
exe.shutdown();//calling shutdown method
while(!exe.isTerminated())//defining while loop that calls isTerminated method
{
}
}
class SumTask2 implements Runnable//calling SumTask2 that inherits Runnable class
{
public synchronized void run()//defining method run
{
int value = s.intValue() + 1;//defining variable value that calls intvalue which is increment by 1
s = new Integer(value);//use s to hold value
}
}
}
Output:
Please find the attached file.
Explanation:
In this code, a Threads class is defined in which an integer class object and the main method is declared that creates the Threads class object and calls its values.
Outside the method, the default constructor is declared that creates the "ExecutorService" and prints its message, and use a for loop that calls execute method which prints its value with the message.
In the class, a while loop is declared that calls "isTerminated" method, and outside the class "SumTask2" that inherits Runnable class and defined the run method and define a variable "value" that calls "intvalue" method which is increment by 1 and define s variable that holds method value.