Answer:
#HERE IS CODE IN PYTHON
#function to find length of shortest and longest string in the array
def fun(list2):
#find length of shortest string
mn=len(min(list2))
#find length of longest string
mx=len(max(list2))
#return both the value
return mn,mx
#array of strings
list2 = ['Ford', 'Volvo', 'BMW', 'MARUTI','TATA']
# call the function
mn,mx=fun(list2)
#print the result
print("shortest length is:",mn)
print("longest length is:",mx)
Explanation:
Create an array of strings.Call the function fun() with array as parameter. Here min() function will find the minimum string among all the strings of array and then len() function will find its length and assign to "mn". Similarly max() will find the largest string and then len() will find its length and assign to "mx". Function fun() will return "mn" & "mx".Then print the length of shortest and longest string.
Output:
shortest length is: 3
longest length is: 5
Final answer:
The problem involves writing a Java method to find the lengths of the shortest and longest strings in an array. The method iterates through each string to update and find the minimum and maximum lengths. It returns these lengths as an integer array.
Explanation:
To tackle the problem of finding the lengths of the shortest and longest strings in an array, we'll use a programming approach. Let's assume we are using Java for this solution. The method will iterate through the array, comparing the lengths of each string to find the minimum and maximum lengths.
Here is a simple Java method that accomplishes this:
public static int[] findShortestAndLongestStringLen(String[] array) {
if (array == null || array.length == 0) return new int[] {-1, -1}; // Handle empty or null array
int minLength = Integer.MAX_VALUE;
int maxLength = Integer.MIN_VALUE;
for (String str : array) {
if (str.length() < minLength) {
minLength = str.length();
}
if (str.length() > maxLength) {
maxLength = str.length();
}
}
return new int[] {minLength, maxLength};
}
This method initializes two variables, minLength and maxLength, with the maximum and minimum values an integer can have, respectively. It iterates through each string in the array, updating these values based on the length of each string. Finally, it returns an array of two integers: the shortest length found (minLength) and the longest (maxLength).
Business service management is an approach for linking __________ or metrics of IT to business goals to determine the impact on the business.
a. key performance indicators (KPIs)
b. critical success factors (CSFs)
c. scorecards
d. financials
Answer:a) Key performance indicators (KPIs)
Explanation: Key performance indicators are the measurement key for evaluation of the performance of the organization on the basis of long time period. They help in providing the knowledge about the business's financial achievement , organizational plan, and other factors.
It is creates the factor/goal that should be focused more for improvement of the business.It creates the critical key so that the progress in the achieving the goal evaluated can be done.
Other options are incorrect because critical success factor(CSF) is the factor for achieving successful and positive outcome in business ,scorecard are for the noting the score of positive and negative factors and financial is the term for the finance and money in the business.Thus the correct option is option (a).
Write a program that finds the max binary tree height. (This Is an extremely short piece of code!)
Answer:
{
if(root==NULL)
return 0;
int l_height=height(root->left);//calculating height of left subtree.
int r_height=height(root->right);//calculating height of right subtree.
return 1+max(l_height,r_height);//returning the maximum from left and right height and adding 1 height of root.
}
Explanation:
The above written program is in C++.It find the height of a maximum height of the binary tree.The function uses recursion to find the height.
First the left subtree's height is calculated then right subtree's then finding the maximum from both of them and adding 1 height of the root.
. In testing, what is the role of an oracle?
Answer:
The role of test oracle is to determine if a test has passed or failed. Oracle compares the outputs of the system under a test, for a given test-case input, and the output(s) that should have. A test oracle works on specifying constraints on the output(s) for a set of inputs. An oracle could be:
a program which tells if the output is correct. documentation that specifies the correct output for inputs. a human that can tell whether it is correct an output.What is ‘Software Quality Assurance’?
Answer: Software quality assurance is considered as the means under which one monitors the software processes and techniques used in order to ensure quality. The techniques using which this is attained are varied, and thus may also include ensuring accordance to more than one standards. It is referred to as a set of techniques that ensures the quality of projects in software process. These mostly include standards that administrators use in order to review and also audit software activities, i,e, these software meet standards.
Why is all the info on the topology map required?
Answer: Topology/topographic maps are the maps that contain all the description and details about the human invented and natural components on the Earth like landscapes,etc.They give the realistic data along with the contour lines, structure etc.
The main purpose it contains the detailed information , because it is used in the professional field by the workers or experts and used for the three dimensional structure as the change in the landscapes and fields always persist .It is also used for the recreational infrastructure which requires a accurate and precise detailing.
SYN segments have ________.
headers
headers and data fields
headers, data fields, and trailers
data fields only
Answer: Headers
Explanation:
SYN segment is known as synchronization and the SYN sends the signal and then sending the a request to the server. The synchronization segment only include header and it does not carry any type of the data field as, the information are basically convey in the form of opening connection.
The SYN message only include the ISN number of the client as ISN is the initial sequence data number. And it also does not include any trailers.
The break statement is required in the default case of a switch selection to the exit structure properly. True/False
Answer: True
Explanation: Break statements are the statements is for the termination of the loop .It is considered as the statements that control the loop. For the default case ,default method is used in the switch selection statements.
The Switch selection statement,due to the working of the break statement will exit or terminate. Thus, the statement given in the question is correct.
What are data structures and algorithms? Why are they important to software developer?
Explanation:
Data structure is a way of gathering and organizing the data in such a way that we can perform operation on the data very efficiently.There are different types of data structures such as :-
ArraysLinked listStacksQueuesTreesGraphsThese are the basic data structures.
Algorithm:-It is a finite set of instructions written to accomplish a certain task.An algorithm's performance is measured on the basis of two properties:-
Time complexity.Space complexity.Software developers need to know data structures and algorithms because all the computers rely on data structures and algorithms so if you know data structures and algorithms better you will know the computer better.
Write one line of code to print animals, an array of Animal objects.
Answer:
console.log(Animal);
Explanation:
The statement written above prints the array Animal which contains objects.There are two to three ways to print the array Animal in javascript. One of the method is written in the answer it prints the arrays in the console of the browser.
You can go to the console by pressing F12 and then clicking on the console.
Other methods to print are
Simple write Animal after defining the array.Use alert.document.write()In which of the following situations should you contact support? Check all that apply.
(A) You need help using the site.
(B) You can’t register.
(C) You are unable to submit your answers.
(D) You do not understand why an answer was marked as incorrect, but you have not yet read the explanation.
Answer:
I'd say A, B, C
Explanation:
A, If you can't figure out what you're supposed to do, that'd be a valid reason to contact support.
B, If you can't register that sounds like a problem on their end and they should be notified
C, If you can't submit answers that'd be the same as B.
You wouldn't select D, that would be on you not the site.
Write a short program that allows the user to input a positive integer and then
outputs a randomly generated integer between 1 and the input number.
Answer:
// code in C++.
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variables
int n;
cout<<"Enter a positive number:";
// read number
cin>>n;
// check number is positive or not
while(n<0)
{
// if number is negative
cout<<"Wrong input!!"<<endl;
// ask again to enter again
cout<<"Enter again:";
// read number again
cin>>n;
}
// generate random number between 1 to n
int ran=rand()%n +1;
// print random number
cout<<"Random number between 1 to "<<n<<" is: "<<ran<<endl;
return 0;
}
Explanation:
Read a number from user.Then if input number is negative then ask user to enter a positive number again.After this generate a random number between 1 to n.Print that random number.
Output:
Enter a positive number:-12
Wrong input!!
Enter again:9
Random number between 1 to 9 is: 2
How does wireshark software help us in the security realm?
Answer:
The wire-shark is the free and open source software tool that is basically used as packet analyzer for software analyzer and network troubleshooting.
The basic ability of the wire-shark it is used in the protocol development and capture the traffic in various form of the network such as wired and wireless.
It is the type of software that help in the security domain as it basically provide the software tool t filter all the traffic and problem in the software which increased the security of the system and provide high efficiency.
Which of the following statements is true about a file stream?
Select one:
a. It is optional to provide the file name to open for reading or writing.
b. You cannot use a single object to read as well as to write.
c. A file stream object can be used to open more than one file simultaneously.
d. A file should be closed after all the operations associated with it are complete
Answer: (c) A file stream object can be used to open more than one file simultaneously.
Explanation: File stream is application that is found on desktop that helps in accessing the files on demand and requirement of the Google Drive. The files team can access direction and updating takes place automatically.
It also helps in the accessing one or more files in a series through individual file stream object. After all the accessing and activities file gets closed as well and the updates gets save automatically.
Other options are incorrect because accessing the file for reading or writing requires file name mandatory and single object can open a file but cannot be used for writing and reading.Thus ,the correct options are option(c) .
Write a program that takes as input two opposite corners of a rectangle: (x1,y1) and (x2,y2). Finally, the user is prompted for the coordinates of a third point (x,y). The program should print Boolean value True or False based on whether the point (x,y) lies inside the rectangle. If the point lies on the rectangle, the program should print False.
Answer:
A python3 script is given below
Explanation:
Hi there!
In this program it is assumed that the rectangle will always be parallel to the x and y axis
# First we define three lists where the coordinates will be stored
# The notrect variable will help us if the p1 and p2 coordinates are along the same axis and therefore the will not make a rectangle,in the assumed sense
p1, p2, p3 = [],[],[]
notrect = False
# In this for cycle we ask the user for the coordinates and check if the first two make a rectangle
for i in range(3):
if i<2:
x = float(input('Please write x'+str(i+1)+': '))
y = float(input('Please write y'+str(i+1)+': '))
else:
x = float(input('Please write x: '))
y = float(input('Please write y: '))
if i==0: p1 = [x,y]
elif i==1: p2 = [x,y]
else: p3 = [x,y]
# If they do not make the rectangle we no longer ask for the third and exit the program
if p1 and p2:
if p1[0] == p2[0] or p1[1] == p2[1]:
notrect = True
print('These ponits does not make a rectangle')
break
#If notrect = True we say Bye to the user and nothing else happens
if notrect:
print('Bye')
# If they do make the rectangle we save the x and y coordinates of the rectangle separately, and sort them
else:
x = [p1[0],p2[0]]
y = [p1[1],p2[1]]
x.sort()
y.sort()
# If the x and y coordinates of the third point are between the x and y coordinates of the vertices of the rectangle the last point is indeed inside the rectangle, and print a True. Otherwise, we print a False
print((p3[0]>x[0] and p3[0]<x[1]) and p3[1]>y[0] and p3[1]<y[1])
The required codes are attached below:
Boolean value:
In programming, we generally need to implement values that can only have one of two values, either true or false. For this purpose, Java provides a special data type, i.e., boolean, which can take the values true or false.
Learn More information about the topic Boolean value:
https://brainly.com/question/26413022
Enter the name of your school or work URL and generate report.What score did it receive?
Answer:
Harold Washington College. 21.1
Which of these characteristics is most important to a systems analyst? (1 point) (Points : 1.5) communicator
problem solver
programmer
project manager
Answer: Problem solver
Explanation:
Problem solver is the most important characteristics for the system analyst as it important for the organization to control all the problems.
System analysis basically define the problem in the particular organization to be solved and also provide the proper architecture in the system.
The good and strong problem solving ability makes the organization more efficient in the decision making problem and also improve the overall system analyst in the organization.
What is nominal data?
Answer:
Nominal data is the used as the scale for providing a label or topic to the variable and not providing any quantity for the measurement. It provides the data in form of symbols,character,letter etc. which is known as the qualitative measure.
They are usually collected and clustered to make the measurement according to the categories. Nominal data is known as the nominal scale.It does not act as the normal data.
Write a Function procedure that determines whether a given Integer is divisible by 5 or not. The function should accept one argument having a data type of Integer and return True if that Integer is divisible by 5, False otherwise.
Answer:
bool isdivisor(int x) // function definition
{
if(x%5==0) // check Integer is divisible by 5
{
return true;
}
else
{
return false;
}
}
Explanation:
#include <iostream>// header file
using namespace std; // using namespace std;
bool isdivisor(int num); // prototype
int main() // main function
{
bool t; // bool variable
int num; // variable declarartion
cout<<" enter the num:";
cin>>num; // input number
t=isdivisor(num); // calling
if(t)
cout<<" number is divisible by 5 ";
else
cout<<" number is not divisible by 5";
return 0;
}
bool isdivisor(int x) // function definition
{
if(x%5==0)
{
return true;
}
else
{
return false;
}
}
Output:
enter the num:50
number is divisible by 5
Explanation:
In this program we have a declared a Boolean function i.e isdivisor that accept one argument of type int.
check if(x%5==0) it return true otherwise false .
Each phase of the system development life cycle is accomplished as a discrete, separate step. (1 point) (Points : 1.5) True
False
Answer: False
Explanation: System development life cycle is the cycle that is responsible for the functioning of the system's operation.The steps of the system's cycle are development, evaluation,testing,analysis ,designing,documentation and implementation.These steps are necessary for the successful conduction of the system.
The accomplishment of the these steps are dependent on each other. The software or hardware components have to go through each step to get evaluated properly. Thus the accomplishment of each step is based on the complete cycle.Thus the statement given is false.
PROBLEM 4 Residential and business customers are paying different rates for water usage. Residential customers pay $0.005 per gallon for the first 6000 gallons. If the usage is more than 6000 gallons, the rate will be $0.007 per gallon after the first 6000 gallons. Business customers pay $0.006 per gallon for the first 8000 gallons. If the usage is more than 8000 gallons, the rate will be $0.008 per gallon after the first 8000 gallons. For example, a residential customer who has used 9000 gallons will pay $30 for the first 6000 gallons ($0.005 * 6000), plus $21 for the other 3000 gallons ($0.007 * 3000). The total bill will be $51. A business customer who has used 9000 gallons will pay $48 for the first 8000 gallons ($0.006 * 8000), plus $8 for the other 1000 gallons ($0.008 * 1000). The total bill will be $56. Write a program to do the following. Ask the user which type the customer it is and how many gallons of water have been used. Calculate and display the bill
Answer:
// here is program in C.
#include <stdio.h>
//main function
int main(void) {
// variables
char type;
int gallon;
double tot_cost=0;
printf("Enter the type of customer(B for business or R for residential):");
// read the type of customer
scanf("%c",&type);
// if type is business
if(type=='b'||type=='B')
{
printf("please enter the number of gallons:");
// read the number of gallons
scanf("%d",&gallon);
// if number of gallons are less or equal to 8000
if(gallon<=8000)
{
// calculate cost
tot_cost =gallon*0.006;
printf("\ntotal cost is: $ %lf",tot_cost);
}
else
{
// if number of gallons is greater than 8000
// calculate cost
tot_cost=(8000*0.006)+((gallon-8000)*0.008);
printf("\ntotal cost is: $ %lf",tot_cost);
}
}
// if customer type is residential
else if(type=='r'||type=='R')
{
printf("please enter the number of gallons:");
// read the number of gallons
scanf("%d",&gallon);
// if number of gallons are less or equal to 6000
if(gallon<=6000)
{
// calculate cost
tot_cost=gallon*0.007;
printf("\ntotal cost is: $ %lf",tot_cost);
}
else
{// if number of gallons is greater than 6000
// calculate cost
tot_cost=(6000*0.005)+((gallon-6000)*0.007);
printf("\ntotal cost is: $ %lf",tot_cost);
}
}
return 0;
}
Explanation:
Ask user to enter the type of customer and assign it to variable "type". If the customer type is business then read the number of gallons from user and assign it to variable "gallon". Then calculate cost of gallons, if gallons are less or equal to 8000 then multiply it with 0.006.And if gallons are greater than 8000, cost for first 8000 will be multiply by 0.006 and for rest gallons multiply with 0.008.Similarly if customer type is residential then for first 6000 gallons cost will be multiply by 0.005 and for rest it will multiply by 0.007. Then print the cost.
Output:
Enter the type of customer(B for business or R for residential):B
please enter the number of gallons:10000
total cost is: $ 64.000000
In Load/Store Architecture, memory is only referenced by load and store instructions.
True
False
Answer:True
Explanation: Load-store architecture is the architecture in the computer system field that contains the instruction collection.These sets of the instructions are dived in the two parts named as the ALU(arithmetic and logical) operation section and memory access section.
The ALU operation part handles the arithmetic calculation and evaluation between the registers whereas the memory access part handles the load and store actions only between the register and memory.Thus , the given statement is true.
When no class constructors are supplied by the author of a class, C++ itself supplies a default constructor that does nothing.
Select one:
a. TRUE
b. FALSE
Answer:
The correct answer for the given question is an option(a) i.e "TRUE".
Explanation:
A constructor is those who initializes the object of a class it means they are used to initializes the member variable of a class.
When no constructor is supplied by the author in the class. There is always a default constructor is created when we create an object for the class. The object of the class automatically created a default constructor.
Hence the given statement is "true" .
Which is a non-functional requirement?
Answer: Non-functional requirement (NFR) are the requirements that display the attributes of the software system such as usability,maintainability, performance etc. The operations of the operating system is judged by these factors which acts as the standard.
This gives the knowledge about the effectiveness and efficiency of the system after the evaluation of the system on these parameters.If the negative result for the non functional requirement is gained after the evaluation , this indicates the failure of the system.
Example:-throughput of operating system.
What is wrong with the following code? How should it be fixed?
1 public class H2ClassH {
2 final int x;
3
4. int H2ClassH () {
5 if (x == 7) return 1;
6 return 2; 7 } // end 8 } // end class H2ClassH
Answer:
Final variable x is not initialized.
Explanation:
In this JAVA code we have a final variable named x.The thing with final variable is that they act like constants in C++.Once initialized cannot be changed after that and we have to initialize them at the time of declaration.
In JAVA if we do not initialize the final variable the compiler will throw compile time error.Final variables are only initialized once.
.What is the /procfile system used for?
Answer:
The proc file system is basically used in the UNIX operating system and it acts as communication medium in the kernel space and the users.
It basically contain data or information about the processing system when it started and running.
The proc file system is the standardized and convenient method for providing the dynamic accessing data in the kernel. As, it is basically created dynamically during the boots up time and store information in the hierarchical type of file in the system.
A(n) ______________ is one that continually offers an improved product that customers are eager to purchase.
Select one:
a. Disruptive technology
b. Sustaining technology
c. Innovative technology
d. None of the above
Answer: b)Sustaining technology
Explanation: Sustaining technology is the technology that is used for enhancing the product than before . The improvement is made in the product to improve it's marketing and increasing it's value. In this way, the customer will tend to purchase the product .
Other options are incorrect because disruptive technology is the damaging the marketing of current product by using new marketing product, innovative technology is the technology that changing product to make it interesting.Thus, the most suitable option is option(b).
(Find the number of days in a month) Write a program that prompts the user to enter the month and year and displays the number of days in the month. For example, if the user entered month 2 and year 2000, the program should display that February 2000 has 29 days. If the user entered month 3 and year 2005, the program should display that March 2005 has 31 days
Answer:
// here is code in java.
import java.util.*;
// class definition
public class Main
{
public static void main(String[] args) {
// scanner object to read input from user
Scanner s=new Scanner(System.in);
// array of months
String mon[] ={
null , "January" , "February" , "March" , "April", "May",
"June", "July", "August", "September", "October",
"November", "December"};
// array which store number of days corresponding to months
int days[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
// ask user to enter month
System.out.print("enter the month:");
// read month
int m=s.nextInt();
// ask user to enter year
System.out.print("enter the year:");
// read year
int year=s.nextInt();
// check the leap year
if(m==2 &&(((year % 4 == 0) && (year % 100!= 0)) || (year%400 == 0)))
{
System.out.println(mon[m]+" "+year+" has 29 days.");
}
else
System.out.println(mon[m]+" "+year+" has "+days[m]+" days");
}
}
Explanation:
Declare and initial month array and days array.Then read the month and year From user with the scanner object.Check if entered year is a leap year or not.Then based on the year and month print the number of days .
Output:
enter the month:2
enter the year:2000
February 2000 has 29 days.
enter the month:3
enter the year:2005
March 2005 has 31 days.
Final answer:
To determine the number of days in a month, one must consider the regular pattern where most months have 30 or 31 days and February has 28 or 29 days depending on whether it is a leap year. A program can be written to take a user's input for month and year and then calculate and display the correct number of days using validation for leap years and the known month lengths.
Explanation:
To create a program that displays the number of days in a month based on user input of the month and year, one must consider the irregularities of the Gregorian calendar. The program should take into account that most months have at least 30 days, except February, which has 28 days in a common year and 29 days in a leap year. A leap year occurs every four years, except in cases where the year is divisible by 100 but not by 400. Thus, years like 2000 and 2400 are leap years, but 1900 and 2100 are not.
A mnemonic that can help remember the number of days in each month is: 'Thirty days hath September, April, June, and November. All the rest have thirty-one, save the second one alone, which has four and twenty-four, till leap year gives it one day more.' Additionally, the 'knuckle mnemonic' can be used, where protruding knuckles represent months with 31 days and the spaces in between represent shorter months.
Example Program in Python:
month = int(input('Enter month (1-12): '))
year = int(input('Enter year: '))
if month in (4, 6, 9, 11):
days = 30
elif month == 2:
if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
days = 29
else:
days = 28
else:
days = 31
print('Number of days: ', days)
This basic Python program prompts the user for the month and year and then prints out the correct number of days in that month, considering whether it is a leap year for February.
Write a program that can compare the unit (per lb) cost of sugar sold in packages with different weights and prices. The program prompts the user to enter the weight and price of package 1, then does the same for package 2, and displays the results to indicate sugar in which package has a better price. It is assumed that the weight of all packages is measured in lb.
Answer:
The c++ program is given below.
#include <iostream>
using namespace std;
int main() {
double w1, p1, w2, p2, cost1, cost2;
cout << "Enter the weight of first sugar packet" << endl;
cin >> w1;
cout << "Enter the price of first sugar packet" << endl;
cin >> p1;
cout << "Enter the weight of second sugar packet" << endl;
cin >> w2;
cout << "Enter the price of second sugar packet" << endl;
cin >> p2;
cost1 = p1/w1;
cost2 = p2/w2;
if(cost1 < cost2)
cout << "Sugar in first package has better price." << endl;
else if(cost1 > cost2)
cout << "Sugar in second package has better price." << endl;
else if(cost1 == cost2)
cout << "Sugar in both packages has same price." << endl;
return 0;
}
OUTPUT
Enter the weight of first sugar packet
2
Enter the price of first sugar packet
45
Enter the weight of second sugar packet
3
Enter the price of second sugar packet
65
Sugar in second package has better price.
Explanation:
This program compares the unit cost of two sugar packages.
This program is designed to take user input but the user input is not validated since this is not mentioned in the question.
1. The double variables are declared for weights and prices for sugar in two packages.
2. Also, double variables are declared to hold the calculated values of unit cost per price for both the packages.
double w1, p1, w2, p2, cost1, cost2;
3. The program takes user input for weight and price for two sugar packages.
4. The unit cost for both sugar packages is calculated.
cost1 = p1/w1;
cost2 = p2/w2;
5. The unit cost for both packages are compared and the message is displayed on the output accordingly.
6. If the unit cost for both packages are the same, the message is displayed on the output accordingly.
7. The program ends with a return statement.
. double x = 5; declares that x is a...............variable.
Answer:
x is a double type variable.
Explanation:
Here is x is a variable of type double which stores the value 5. The main purpose of a double datatype is storing the decimal point values. The precision of double datatype is two times more than the precision of float datatype. So on displaying the value of x in c++ it prints "5".
Following are the program of double datatype in c++
#include <iostream> // header file
using namespace std; // namespace
int main() // main function
{
double x=5; // variable declaration
cout<<x; // displaying the value of x
return 0;
}
Output:
5
You have been asked to report on the feasibility of installing an IP CCTV camera system at your organization. Detail the pros and cons of an IP CCTV system and how you would implement the system.
Answer and Explanation:
IP CCTV:
New dangers are acquainted with the security world as frameworks move from conventional simple to IP organize empowered frameworks especially in video reconnaissance. Web Protocol (IP) give an open stage to incorporation at the information level of various security and life wellbeing gadgets and applications.
Pros: of IP CCTV :
Lower starting expense: Harnessing the IT framework decreases establishment costs in cabling, related control and electrical plugs.Wide-spread similarityGives adaptability and versatilityHigher security and versatilityThe tight programming joining between frameworks make them progressively canny and diminishes security holes, accelerate the reaction time.Cons of IP CCTV
It rotates around system security and programmers danger.The hazard increments if camera is gets to from the portable or telephone.The hazard increments if camera is gets to from the portable or telephone.