Answer:
// here is code in java.
public class NAMES
{
// main method
public static void main(String[] args)
{
int n=4;
// print the upper half
for(int a=1;a<=n;a++)
{
for(int b=1;b<=n-a;b++)
{
// print the spaces
System.out.print(" ");
}
// print the * of upper half
for(int x=1;x<=a*2-1;x++)
{
// print the *
System.out.print("*");
}
// print newline
System.out.println();
}
// print the lower half
for(int y=n-1;y>0;y--)
{
for(int z=1;z<=n-y;z++)
{
// print the spaces
System.out.print(" ");
}
for(int m=1;m<=y*2-1;m++)
{
// print the *
System.out.print("*");
}
// print newline
System.out.println();
}
}
}
Explanation:
Declare a variable "n" and initialize it with 4. First print the spaces (" ") of the upper half with the help of nested for loop.Then print the "*" of the upper half with for loop. Similarly print the lower half in revers order. This will print the required shape.
Output:
*
***
*****
*******
*****
***
*
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.
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) .
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.
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).
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.
Immediate address is determined by a value in a register.
True
False
Answer: False
Explanation:
The given statement is false as, in the immediate addressing the value of operand is basically store in the instruction.
In the register addressing the address filed is basically denote as the register which contain the operand.
In the immediate addressing, the mode of the data is the specific part of the instruction and the operand is basically specify in instruction of the immediate addressing itself.
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.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.
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 are the advantages and disadvantages of using wireless communications? What are the advantages and disadvantages of using wired communications? Under what conditions is a wireless channel preferred over a wired channel? [Hint: use a table to compare and contrast the advantages and disadvantages of wired versus wireless communications.] Please give sources if possible
Answer:
Advantages of wireless communication:-
Flexibility in transferring the message through communication for which the sender and receiver can be in any place.Speed of the communication is accurate and fastDue to no wiring , the cost of the wireless communication is less.Disadvantages of wireless communication:-
The security is less as the data can be accessed by unauthorized sources at times.The setting up of wireless communication complex and expensive.Advantages of wired communication:-
Simple configurationHigher bandwidth is present in the cableHigh reliabilityDisadvantages of wired communication:-
Mobility is present for communicationInstallation requires lot of time due to cablingRequires extra devices for covering large areas for communicationWireless communication is more preferable than wired communication in the conditions like communication connection that should face low damage and longer life which is not present in cable connection as they break or get disrupted.The flexibility of moving while communication is required by most people so, they use wireless communication .
The advantages and disadvantages of wireless communications include portability, ease of installation, and flexibility as advantages, while they suffer from potential security issues, interference, and varying reliability. On the other hand, wired communications boast high stability, speed, and security but lack the mobility and ease of deployment that wireless offers. Wireless channels are preferred over wired when mobility, ease of setup, or physical cabling constraints are considerations.
Wireless communications offer the key advantages of mobility, ease of installation, and the ability to connect multiple devices without the need for physical cables. However, disadvantages include security concerns, as wireless communications can be more susceptible to unauthorized access, interference from other devices or physical barriers that can disrupt signals, and potentially less reliability in terms of consistent connectivity.
Wired communications, by contrast, offer greater security, as physical access to the network is required for connectivity, and are typically more stable and faster, as they are less likely to be affected by interference. The main disadvantages include the lack of mobility, as devices are tethered to specific locations by cables, and challenges in the installation process, especially in areas where running cables is difficult or impractical. Wireless channels are often preferred in situations where mobility is necessary, such as in conference rooms or public spaces, where devices are frequently moved or added, and where installing cables would be difficult or costly.
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()Which part of the cable is used to carry data?
Answer:Inner conductor of cable
Explanation: The cable used for the transmission of data maintains the communication between the devices. The layer is made up the layers like jacket layer which is the outermost layer for the protection of wiring in cable .
A shield is also present on the inner conductor of the cable for the protection of the data from interference. The inner conductor is the part which transmits the data. Various types of the metal and alloys are used for making the conductor.It is a very sensitive part so it is protected with jackets of layer.
(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.
.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.
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.
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.
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" .
Complete the following conversions. You MUST show all of your work to receive full credit.
Convert the following decimal numbers to binary.
a. 357
b. 67
c. 252
d. 65000
e. 5795
Answer:
a. 101100101
b. 1000011
c. 11111100
d. 1111110111101000
e. 1011010100011
Explanation:
To convert any decimal number to binary you need to make a succession of divisions by 2, in the image I provide, you can see how the process was done, every time you divide your number by 2 you'll have a remainder, being this 0 or 1, this will become your binary number. It's important to notice that using this method you'll divide from right to left, but you'll take your remainders in the opposite direction (right to left) to form your binary number.
Hope you find this information useful! Good luck!
To convert decimal numbers to binary, divide by 2 and record the remainders until the quotient is zero. The binary representation is then read from the bottom up. This method is applied to convert the given decimal numbers to their binary equivalents.
Explanation:Converting decimal numbers to binary requires dividing the number by 2 and recording the remainder until the quotient is 0. Here's how you can convert the given decimal numbers to binary:
a. 357 in binary: Divide 357 by 2, remainder is 1, quotient is 178. Continue this process until the quotient is 0. The binary number will be the remainders read in reverse order: 101100101.b. 67 in binary: Same process as above, resulting in 1000011.c. 252 in binary: Following the same steps, we arrive at 11111100.d. 65000 in binary: This larger number follows the pattern, converting to 1111110110010000.e. 5795 in binary: After converting, the binary equivalent is 1011010010011.
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.
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
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
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 .
How are IP addresses usually written?
Explanation:
There are two versions of Internet Protocol(IP) present in which the IP address are written which are IPv4 and IPv6.The numbers in IPv4 are 32 bit long while in IPv6 the numbers are 128 bits long.
So let's see IPv4 addresses
IP addresses are written in human readable form.There are 4 groups of 8 bits which represent the corresponding decimal numbers.These groups are separated by (.) .Since there are 8 bits hence the numbers range is 0-255.
for ex:- 124.45.65.210
There are 3 dots the numbers are in the range of 0-255.There should be no leading zeroes present in the IP address.
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 are the disadvantages of cloud computing?
Answer: Cloud computing is the service that helps the usage of the services of the computer system parts (hardware and software) over a network .The disadvantages of the cloud computing are as follows:-
Cloud hacking-there are cases of the cloud hacking which is a incident against the security of the cloud computing devices.Technical problem-there is no quick fix provision for the mending the technical issue in the cloud computing network .Restricted features:-there are limitation on the number of features that are found in the different cloud computing such as accessibility , security, space.etc.
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.
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
. 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
If your database is in archivelog mode, how can you force an archive?
A. Issue an alter database switch logfile command.
B. Issue an alter system switch logfile command.
C. Issue an alter system log_archive_start command.
D. There is no command to force an archive; they happen automatically.
Answer: (B) Issue an alter system switch logfile command.
Explanation:
When the database is in the archive log mode then, the issue in the alter system switch logfile command force the particular switch. It basically produce achieve redo log which is smaller in the size by the dedicated size of the parameter log buffer.
It also govern the particular size of the RAM (Random access memory) buffer by redo log. This command is basically faster to return in the program by the use of redo log.
On the other hand, all the options are incorrect as this command only alter the system and does not alter the database. Therefore, Option (B) is correct.