Answer:
B. False
Explanation:
Binary search does not work in an unsorted list, therefore it will not return the correct answer in 0(n) time.
For an unsorted list, linear search is the better way of searching for algorithms.
For a binary search, it goes through a sorted list to locate a desired element. It repeats its processes until it picks the correct element it is looking for.
3. How many bytes of storage space would be required to store a 400-page novel in which each page contains 3500 characters if ASCII were used? How many bytes would be required if Unicode were used? Represent the answer in MB
Answer:
A total of 79.3mb will be needed
The breastbone or ________________ extends down the chest.
Answer:
The sternum or breastbone is a long flat bone located in the central part of the chest.
The sternum or breastbone is a long flat bone located in the central part of the chest.
In the middle of the chest, there is a long, flat bone known as the sternum or breastbone. It forms the front of the rib cage and is joined to the ribs by cartilage, assisting in the protection of the heart, lungs, and major blood arteries from harm. It is one of the longest and largest flat bones in the body, somewhat resembling a necktie. The manubrium, body, and xiphoid process are its three regions.
Therefore, the sternum or breastbone is a long flat bone located in the central part of the chest.
Learn more about the breastbone here:
https://brainly.com/question/32917871.
#SPJ2
Your car must have two red stoplights, seen from ______ feet in the daytime, that must come on when the foot brake is pressed.
A. 100
B. 200
C. 300
D. 400
Answer:
the answer is 300 feet in the daytime
Write a program that reads the input.txt file character by character and writes the content of the input file to output.txt with capitalize each word (it means upper case the first letter of a word and lowercase remaining letters of the word)
Answer:
def case_convertfile( file_name):
with open(" new_file","x") as file:
file.close( )
with open("file_name", "r") as txt_file:
while True:
word = txt_file.readline( )
word_split= word.split(" ")
for word in word_split:
upper_case = word.uppercase( )
file= open("new_file","w+")
file= open("new_file","a+")
file.write(upper_case)
txt_file.close( )
file.close( )
Explanation:
This python function would open an existing file with read privilege and a new file with write and append privileges read and capitalize the content of the old file and store it in the new file.
CHALLENGE ACTIVITY 3.7.2: Type casting: Reading and adding values.
Assign totalowls with the sum of num_owls A and num_owls_B.
Sample output with inputs: 34
Number of owls: 7
1. total_owls -
2.
3. num_owls A - input
4. num_owls_B - input
5.
6. " Your solution goes here
7.
8. print("Number of owls:', total_owls)
Answer:
total_owls = 0
num_owls_A = int(input())
num_owls_B = int(input())
total_owls = num_owls_A + num_owls_B
print("Number of owls:", total_owls)
Explanation:
Initialize the total_owls as 0
Ask the user to enter num_owls_A and num_owls_B, convert the input to int
Sum the num_owls_A and num_owls_B and set it to the total_owls
Print the total_owls
avg_owls=0.0
num_owls_zooA = int(input())
num_owls_zooB = int(input())
num_owls_zooC = int(input())
num_zoos = 3
avg_owls = (num_owls_zooA + num_owls_zooB + num_owls_zooC) / num_zoos
print('Average owls per zoo:', int(avg_owls))
There is a problem while you are trying the calculate the average owls per zoo.
As you may know, in order to calculate the average, you need to get the total number of owls in all the zoos, then divide it to the number of zoos. That is why you need to sum num_owls_zooA + num_owls_zooB + num_owls_zooC and divide the result by num_zoos
Be aware that the average is printed as integer value. That is why you need to cast the avg_owls to an int as int(avg_owls)
Learn more about integer value on:
https://brainly.com/question/31945383
#SPJ6
The web development team is having difficulty connecting by ssh to your local web server, and you notice the proper rule is missing from the firewall. What port number would you open on your webserver?
a. Port 21
b. Port 22
c .Port 25
d. Port 80
e. Port 443
Answer:
Option b (Port 22) seems to the appropriate choice.
Explanation:
Below seem to be some measure you should take to correct this mistake.
Verify whether Droplet's host IP address seems to be right. Verify existing connection supports communication over all the utilized SSH port. Any access points can be able to block port 22 and sometimes customized SSH. For illustration, you could do this by checking different hosts who used the same port, using only a recognized working SSH connection. These could help you identify unless the current problem is not particular to clients' Droplet. Authenticate the Droplet configuration settings. Verify that they're not being configured to DROP 's preferred policy, and do not apply the port to require connectivity.The SSH server also operates on port 22, by default.
Other choices don't apply to the specified scenario. So that the argument presented above will be appropriate.
The port number would you open on your webserver is Port 22
For better understanding let's explain SSH means.
Service Name and Transport Protocol Port Number Registry. where the service name is Secure Shell (SSH) Protocol and it has the port number of 22 therefore this mean that SSH will only work with port 22 using it for other port will only result in difficulty in connection. SSH has other names like Secure Shell or Secure Socket Shell. it is known as a network protocol that helps its users with system administrator.From the above we can therefore say that the answer The port number would you open on your webserver is Port 22, is correct
Learn more about SSH and port from:
https://brainly.com/question/13054022
What is resource Management in Wireless Communication ? Explain its Advantages?
Answer:
Resource management is the system level transmission cellular networks and wireless communication.
Explanation:
Wireless communication is the process to continue to the address for faster response time,to the resource management.
Transmission is the provided by that more utilization and wireless resources available,and to discovered data.
Wireless communication system to demand the larger bandwidth and transmission using development to the system.
Wireless communication resources management the larger bandwidth and reliable transmission consumed all the system layer.
Resource management techniques tool are used in a preliminary concepts or mathematical tools,and average limited power battery.
Resource management are they necessary mathematical and fundamental tools are used in wireless communication.
Wireless communication in the provide that wireless industry in a wireless communication.
Explain how Deep Packet Inspection works (DPI). How is this technology beneficial to Perimeter Security? Lastly, describe a scenario where the use of DPI may be considered a privacy concern.
Answer:
Answered below
Explanation:
Deep packet inspection is a kind of data processing that thoroughly inspects data sent over a computer network and acts on it by rerouting, logging or blocking it. Uses of DPI include;
To ensure that data is in the correct format, internet censorship, to check for malicious code, and also eavesdropping.
DPI uses port mirroring and optical splitter to acquire packets for inspection. It combines the functionality of an intrusion detection system and intrusion prevention system with a traditional stateful firewall.
DPI is therefore helpful in perimeter security by keeping unauthorized users out and at the same time protecting authorized users from attack. Privacy concerns have been raised over the inspection of content layers of internet protocols such as in the case of censorship and government regulations and control.
Input a list of positive numbers, find the mean (average) of the numbers, and output the result. Use a subprogram to input the numbers, a function to find the mean, and a subprogram to output the result. Use a subprogram to Input the numbers, a Function to find the mean and a subprogram to output the Result.
Answer:
def inputNumber():
l = []
num = int(input("Enter the number of integers you want to enter\n"))
for i in range(0,num):
print("Enter the ", i+1, " integers ")
a = float(input())
l.append(a)
return l
def averageCalculator(l):
total = 0
for i in l:
total += i
avg = total/len(l)
return avg
def printoutput(avg):
print("The average of numbers is ", avg)
l = inputNumber()
avg = averageCalculator(l)
printoutput(avg)
Explanation:
A subprogram may be considered as a method where we pass some values in the arguments and return some value.
The answer is written in python language, where we have used
inputNumber() subprogram to get the input from the user.
function averageCalculator() to calculate the average.
printoutput() subprogram to print the output or the average of the numbers.
Please refer to the attached image for better understanding of the indentation of code.
Now, let us learn about them one by one:
inputNumber(): We get the number of values to be entered as an integer value and then get the numbers as float.
Store the values in a list and return the list to the caller main program.
averageCalculator(l): Contains a list as argument as we got from inputNumber(). It sums all the numbers and divides with total number to find the average. Returns the average value to the caller main program.
printoutput(avg): Contains an argument which is the average calculated in the averageCalculator(). It prints the argument passed to it.
Suppose that the tuition for a university is $10,000 this year and increases 4% every year. In one year, the tuition will be $10,400. Write a program using for loop that computes the tuition in ten years and the total cost of four years’ worth of tuition after the tenth year.
Answer:
The programming language is not stated; however, I'll answer using Python programming language (See attachment for proper format)
tuition = 10000
rate = 0.04
for i in range(1,15):
tuition = tuition + tuition * rate
if i <= 10:
print("Year "+str(i)+" tuition:",end=" ")
print(round(tuition,2))
if i == 14:
print("Tuition 4th year after:",end=" ")
print(round(tuition,2))
Explanation:
The first 2 lines initializes tuition and rate to 10000 and 0.04 respectively
tuition = 10000
rate = 0.04
The next line iterates from year 1 to year 14
for i in range(1,15):
This line calculates the tuition for each year
tuition = tuition + tuition * rate
The next 3 lines prints the tuition for year 1 to year 10
if i <= 10:
print("Year "+str(i)+" tuition:",end=" ")
print(round(tuition,2))
The next 3 lines prints the tuition at the 4th year after year 10 (i.e. year 14)
if i == 14:
print("Tuition 4th year after:",end=" ")
print(round(tuition,2))
a_____________ may have its value change during program execution. options. flowchart,counter, Algorithm,None of them
Answer:
i think is "none of them"
Your system is infected with a virus that can modify signature each time it is executed to fool antivirus software. Which type of virus is this?
Answer:Polymorphic Virus
Explanation:
Malware that can change its signature each time is polymorphic
1. Describe your Microsoft word skills that need to be improved upon the most. 2. Explain the Microsoft word skills you are most confident in performing. 3. How can your Microsoft word processing skills affect your overall writing skills on the job?
Answer:
The answer varies from person to person.
Explanation:
All kinds of people are using Word, so people would recognize if the answer if plagiarized. So, simply answer truthfully; no matter h1ow embarrasing.
The Microsoft word skills that I will need to improve upon the most is how to be faster when typing.
It should be noted that the Microsoft word skill that I am mostly confident in performing is the creation of word documents and text formatting.
Lastly, Microsoft word processing skills have affected my overall writing skills on the job as it has helped in improving my writing and grammar.
Learn more about Microsoft on:
https://brainly.com/question/20659068
By using ____, you can use reasonable, easy-to-remember names for methods and concentrate on their purpose rather than on memorizing different method names.
Answer:
Polymorphism
Explanation:
If we use polymorphism so we can apply the names that could be easy to remember for the methods' purpose.
The information regarding the polymorphism is as follows:
The person has various attributes at the same timeFor example, a man could be a father, a husband, an entrepreneur at the same time.In this, the similar person has different types of behavior in different situations.Therefore we can conclude that If we use polymorphism so we can apply the names that could be easy to remember for the methods' purpose.
Learn more about the behavior here: brainly.com/question/9152289
Given an integer n and an array a of length n, your task is to apply the following mutation to a:
Array a mutates into a new array b of length n.
For each i from 0 to n - 1, b[i] = a[i - 1] + a[i] + a[i + 1].
If some element in the sum a[i - 1] + a[i] + a[i + 1] does not exist, it should be set to 0. For example, b[0] should be equal to 0 + a[0] + a[1].
Example
For n = 5 and a = [4, 0, 1, -2, 3], the output should be mutateTheArray(n, a) = [4, 5, -1, 2, 1].
b[0] = 0 + a[0] + a[1] = 0 + 4 + 0 = 4
b[1] = a[0] + a[1] + a[2] = 4 + 0 + 1 = 5
b[2] = a[1] + a[2] + a[3] = 0 + 1 + (-2) = -1
b[3] = a[2] + a[3] + a[4] = 1 + (-2) + 3 = 2
b[4] = a[3] + a[4] + 0 = (-2) + 3 + 0 = 1
So, the resulting array after the mutation will be [4, 5, -1, 2, 1].
Input/Output
[execution time limit] 3 seconds (java)
[input] integer n
An integer representing the length of the given array.
Guaranteed constraints:
1 ≤ n ≤ 103.
[input] array.integer a
An array of integers that needs to be mutated.
Guaranteed constraints:
a.length = n,
-103 ≤ a[i] ≤ 103.
[output] array.integer
The resulting array after the mutation.
Answer:
The program written in Java is as follows
import java.util.Scanner;
public class mutilate {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
int n;
System.out.print("Array Length: ");
n = input.nextInt();
while(n<1 || n > 103) {
System.out.print("Array Length: ");
n = input.nextInt();
}
int a []= new int [n];
int b []= new int [n];
System.out.print("Enter Elements of the Array: ");
for(int i =0;i<n;i++) {
a[i] = input.nextInt();
}
System.out.print("Output: ");
for(int i =0;i<n;i++) {
if(i == 0) {
b[i] = 0+a[i]+a[i+1];
}
else if(i == n-1) {
b[i] = a[i - 1]+a[i]+0;
}
else {
b[i] = a[i - 1]+a[i]+a[i+1];
}
System.out.print(b[i]+" ");
}
}
}
Explanation:
This line allows the program accepts user input
Scanner input = new Scanner(System.in);
This line declares integer n
int n;
The next two line prompts user for length of the array and also accepts input
System.out.print("Array Length: ");
n = input.nextInt();
The following while iteration ensures that the user input is between 1 and 103
while(n<1 || n > 103) {
System.out.print("Array Length: ");
n = input.nextInt();
}
The next two lines declares array a and b
int a []= new int [n];
int b []= new int [n];
The next for iteration allows user enter values for array a
System.out.print("Enter Elements of the Array: ");
for(int i =0;i<n;i++) {
a[i] = input.nextInt();
}
The next for iteration calculates and prints the values for array b based on the instruction in the question
System.out.print("Output: ");
for(int i =0;i<n;i++) {
if(i == 0) {
b[i] = 0+a[i]+a[i+1];
}
else if(i == n-1) {
b[i] = a[i - 1]+a[i]+0;
}
else {
b[i] = a[i - 1]+a[i]+a[i+1];
}
System.out.print(b[i]+" ");
}
Does clicking ads and pop ups like the one shown in this image could expose your computer to malware?
Answer: Yes, clicking adds/popups like the one in the image could cause your computer/electronic to catch viruses/malware.
Explanation: The cause to this is when you click an ad/popup you're exposing yourself to a potential dangerous/visious site. You're unaware to where the popup could bring you, and for all we know it could bring us to a fake site for a download which is really a visious malware to be downloaded to your device.
Which of the following peripheral devices can be used for both input and output? mouse touch screen on a tablet computer printer CPU
Answer:
mouse printer CPU touch screen
Explanation:
on a tablet computer hope this helps you :)
Enum fruit_tag {
BLUEBERRY,
BANANA,
PINEAPPLE,
WATERMELON
};
typedef enum fruit_tag fruit_t;
void printFruit(fruit_t myFruit) {
switch(myFruit) {
case BLUEBERRY:
printf("a blueberry");
break;
case BANANA:
printf("a banana");
break;
case PINEAPPLE:
printf("a pineapple");
break;
case WATERMELON:
printf("a watermelon");
break;
}
}
void compareFruit(fruit_t fruit1, fruit_t fruit2) {
if (fruit1 > fruit2) {
printFruit(fruit1);
printf(" is larger than ");
printFruit(fruit2);
}
else {
printFruit(fruit1);
printf(" is smaller than ");
printFruit(fruit2);
}
}
int main(void) {
fruit_t myFruit = PINEAPPLE;
fruit_t otherFruit = BLUEBERRY;
compareFruit(myFruit, otherFruit);
return 0;
What is the output?
Answer:
The output is "a pineapple is larger than a blueberry ".
Explanation:
In the given C language code Enum, typedef, and two methods "printfruit and compareFruit" is declared, that can be defined as follows:
In the enum "fruit_tag" there are multiple fruit name is declared that use as the datatypes. In the next line, the typedef is defined, that enum to define another datatype that is "fruit_t". In the next step, the printFruit method is defined that accepts "myFruit" variable in its parameter and use the switch case to to check value. In the "compareFruit" method, it accepts two parameters and uses the if-else block to check its parameters value and print its value. In the main method, two variable "myFruit and otherFruit" variable is declared that stores the values and pass into the "compareFruit" method and call the method.Review the given requirements using the checklist and discover possible problems with them. The following requirements are for a library system which is an interactive system providing access to a large document database and which allows the automated ordering and electronic delivery of documents to local and remote end-users. Some requirements for this system are: Req. 1 The user interface shall be html. Users shall access the system via standard web browsers such as Netscape and Internet Explorer. Req. 2 The system shall primarily an end-user system. Users shall use the system within the constraints of the permissions assigned by the administrator to identify, locate, order and receive documents. Req. 3 Users shall communicate with the system mainly via the html interface. Req. 4 User shall provide input to the system via the html interface. Req. 5 The system shall give output to the user via the html interface, email and print. The print output shall mainly be documents.
Answer:
Redundancy
Req. 1 and Req. 3 are seemed to say the same thing. We need to remove the first sentence in Req. 1
Conflict and understandability
Req. 1 states that access is through web browser while Req. 4 states that access is via html. We have to re-write the Req. 3 to make it clear that users do not actually have to write directly html to communicate with the system.
Completeness
Req. 5 states that print out will “mainly” be documents. What else might be printed? What other inputs will be produced?
Either remove mainly or clarify other print out.
What version of html or web browser is assumed in Req. 1 and Req. 3?
Explanation:
What will be displayed after the following code executes? mystr = 'yes' yourstr = 'no' mystr += yourstr * 2 print(mystr)
Answer:
yesnono
Explanation:
mystr = 'yes'
yourstr = 'no'
mystr += yourstr * 2
mystr = "yes"yourstr * 2 = "no"+"no"yes + no+noyesnonoGiving BRANLIEST IFF CORRECT What is the label called for each column in a database? Field File Record Title
Answer:
Title
Explanation:
the others describe other items in a database
Answer:
Title
Explanation: idek but I got it correct on a quiz
The fact that the speed of a vehicle is lower than the prescribed limits shall relieve the driver from the duty to decrease speed when approaching and crossing an intersection. True or false
Explanation:
the answer is false ........
The fact that the speed of a vehicle is lower than the prescribed limits shall relieve the driver from the duty to decrease speed when approaching and crossing an intersection is not true.
What is intersection in the traffic rules?An intersection serves as the point where many lanes cross on the road which is a point where driver is required to follow the traffic rules.
However, the above statement is not true because , a driver can decide not decrease speed when approaching and crossing an intersection, even though it is a punishable offense in traffic rules.
Read more on traffic rules here: https://brainly.com/question/1071840
#SPJ2
A computer uses a programmable clock in square-wav e mode. If a 500 MHz crystal is used, what should be the value of the holding register to achieve a clock resolution of (a) a millisecond (a clock tick once every millisecond)
Answer:
500,000
Explanation:
A computer uses a programmable clock in square-wave mode. If a 500 MHz crystal is used, what should be the value of the holding register to achieve a clock resolution of (a) a millisecond (a clock tick once every millisecond)
1 millisecond = 1 million second = 1,000,000
For a 500 MHz crystal, Counter decrement = 2
Therefore value of the holding register to a clock resolution of 1,000,000 seconds :
1,000,000/2 = 500,000
GIVING BRANLIEST IFFF CORRECT James uses a database to track his school football team. Which feature in a database allows James to list only the players that didn't play in the last game? Title Filter Search Sort
Answer:
filter
Explanation:
the filter feature allows him to fetch data that only meets a certain criteria(those who didn't play in the last game)
The FILTER feature in a database allows James to list on the players that did not play in the game.
What is the filter feature in EXCEL?The FILTER feature in Excel is used to clear out a number of statistics primarily based totally on the standards which you specify. The feature belongs to the class of Dynamic Arrays functions.
The end result is an array of values that mechanically spills into a number cells, beginning from the Cells wherein you input a formula.
Thus, The FILTER feature in a database allows James to list on the players that did not play in the game.
Learn more about FILTER feature here:
https://brainly.com/question/11866402
#SPJ2
Write down the complete AJAX code to avoid page caching.
Answer:
AZAX is key sentence for without reloading page.
Explanation:
AJAX is also known as XHR. If some one wants to send the file without reloading then look ahead at the search function and prompt the users by auto saving the documents. This request is sent to the server. The server return the data to your network. Whenever you have seen the file form, some action on the page. You will see some request from AJAX server request on your functional area. AJAX is called a reloading file without page. AZAX is stands for Asynchronous java scripts And XML. AJAX is used to send an email. AZAX is not used in front end, it is used from back end process.
Objects for AJAXJava ScriptWord Press Action.ProtectionError handling processGenerating a signature with RSA alone on a long message would be too slow (presumably using cipher block chaining). Suppose we could do division quickly. Would it be reasonable to compute an RSA signature on a long message by first finding what the message equals (taking the message as a big integer), mod n, and signing that?
Answer:
Following are the algorithm to this question:
Explanation:
In the RSA algorithm can be defined as follows:
In this algorithm, we select two separate prime numbers that are the "P and Q", To protection purposes, both p and q combines are supposed to become dynamically chosen but must be similar in scale but 'unique in length' so render it easier to influence. Its value can be found by the main analysis effectively.
Computing N = PQ.
In this, N can be used for key pair, that is public and private together as the unit and the Length was its key length, normally is spoken bits. Measure,
[tex]\lambda (N) = \ lcm( \lambda (P), \lambda (Q)) = \ lcm(P- 1, Q - 1)[/tex] where [tex]\lambda[/tex] is the total function of Carmichaels. It is a privately held value. Selecting the integer E to be relatively prime from [tex]1<E < \lambda (N)[/tex]and [tex]gcd(E, \lambda (N) ) = 1;[/tex] that is [tex]E \ \ and \ \ \lambda (N)[/tex]. D was its complex number equivalent to E (modulo [tex]\lambda (N)[/tex] ); that is d was its design multiplicative equivalent of E-1.
It's more evident as a fix for d provided of DE ≡ 1 (modulo [tex]\lambda (N)[/tex] ).E with an automatic warning latitude or little mass of bigging contribute most frequently to 216 + 1 = 65,537 more qualified encrypted data.
In some situations it's was shown that far lower E values (such as 3) are less stable.
E is eligible as a supporter of the public key.
D is retained as the personal supporter of its key.
Its digital signature was its module N and the assistance for the community (or authentication). Its secret key includes that modulus N and coded (or decoding) sponsor D, that must be kept private. P, Q, and [tex]\lambda (N)[/tex] will also be confined as they can be used in measuring D. The Euler totient operates [tex]\varphi (N) = (P-1)(Q - 1)[/tex] however, could even, as mentioned throughout the initial RSA paper, have been used to compute the private exponent D rather than λ(N).
It applies because [tex]\varphi (N)[/tex], which can always be split into [tex]\lambda (N)[/tex], and thus any D satisfying DE ≡ 1, it can also satisfy (mod [tex]\lambda (N)[/tex]). It works because [tex]\varphi (N)[/tex], will always be divided by [tex]\varphi (N)[/tex],. That d issue, in this case, measurement provides a result which is larger than necessary (i.e. D > [tex]\lambda (N)[/tex] ) for time - to - time). Many RSA frameworks assume notation are generated either by methodology, however, some concepts like fips, 186-4, may demand that D< [tex]\lambda (N)[/tex]. if they use a private follower D, rather than by streamlined decoding method mostly based on a china rest theorem. Every sensitive "over-sized" exponential which does not cooperate may always be reduced to a shorter corresponding exponential by modulo [tex]\lambda (N)[/tex].
As there are common threads (P− 1) and (Q – 1) which are present throughout the [tex]N-1 = PQ-1 = (P -1)(Q - 1)+ (P-1) + (Q- 1))[/tex], it's also possible, if there are any, for all the common factors [tex](P -1) \ \ \ and \ \ (Q - 1)[/tex]to become very small, if necessary.
Indication: Its original writers of RSA articles conduct their main age range by choosing E as a modular D-reverse (module [tex]\varphi (N)[/tex]) multiplying. Because a low value (e.g. 65,537) is beneficial for E to improve the testing purpose, existing RSA implementation, such as PKCS#1, rather use E and compute D.
Ann, a user, reports that she is no longer able to access any network resources. Upon further investigation, a technician notices that her PC is receiving an IP address that is not part of the DHCP scope. Which of the following explains the type of address being assigned?
A. Unicast address
B. IPV6
C. DHCP6
D. APIPA
Answer: APIPA
Explanation:
Automatic Private IP Addressing (APIPA) is a Windows based operating systems feature that allows a computer to assign itself automatically to an IP address even though there is DHCP server to perform the function.
From the information that has been provided in the question, we can see that the type of address that is used is APIPA.
If the processor has 32 address lines in its address bus; i.e. 32-bit address range, what is its address space or range; i.e. what is the smallest and largest address that can be represented
Answer:
The answer is "0 to 4294967295"
Explanation:
Given bit:
32 bits
Calculating smallest and largest bits:
In any processor, it works only on the 0 and 1 bit and it also stores 0 and 1 values. so, the smallest address in bit value is= 0 and the largest bit value can be defined as follows:
largest address value in bits:
[tex]\Longrightarrow 2^{32}-1\\\\\Longrightarrow 4294967296 -1\\\\\Longrightarrow 4294967295\\\\[/tex]
smallest address= 0
largest address = 4294967295
2- (8 point) Write a program using the instructions below. Assume that integers are stored in 4 bytes. a) Define an array of type int called apples with five elements, and initialize the elements to the even integers from 2 to 10. b) Define a pointer aPtr that points to a variable of type int. c) Print the elements of array values using a for statement. d) Write two separate statements that assign the starting address of the array to pointer variable aPtr. e) What physical address is aPtr pointing to? f) Print the elements of array values using pointer/offset notation. g) What address is referenced by aPtr + 3? What value is stored at that location? h) Assuming aPtr points to apples[4], what address is referenced by aPtr -= 4? What value is stored at that location?
Answer:
a)
int apples [5] = {2, 4, 6, 8, 10};
b)
int *aPtr //this is the pointer to int
Another way to attach a pointer to a an int variable that already exists:
int * aPtr;
int var;
aPtr = &var;
c)
for (int i = 0; i < size; i++){
cout << values[i] << endl; }
d)
aPtr = values;
aPtr = &values[0];
both the statements are equivalent
e)
If its referring to the part d) then the address is:
cout<<aPtr;
f)
for (int i = 0; i < size; ++i) {
cout<<*(vPtr + i)<<endl; }
g)
cout << (aPtr + 3) << endl; // address referenced by aPtr + 3
cout << *(aPtr + 3) << endl; // value stored at that location
This value stored at location is 8
h)
aPtr = &apples[4];
aPtr -= 4;
cout<<aPtr<<endl;
cout<<*aPtr<<endl;
Explanation:
a)
int apples [5] = {2, 4, 6, 8, 10};
In this statement the array names is apples, the size of the array is specified in square brackets. so the size is 5. The type of array apples is int this means it can store integer elements. The values or elements of the array apples are even integers from 2 to 10. So the elements of array are:
apples[0] = 2
apples[1] = 4
apples[2] = 6
apples[3] = 8
apples[4] = 10
b)
In this statement int *aPtr
The int* here is used to make the pointer aPtr points to integer object. Data type the pointer is pointing to is int. The asterisk symbol used with in makes this variable aPtr a pointer.
If there already exists an int type variable i.e. var and we want the pointer to point to that variable then declare an int type pointer aPtr and aPtr = &var; assigns the address of variable var to aPtr.
int * aPtr;
int var;
aPtr = &var;
c)
The complete program is:
int size= 5;
int values[size] = {2,4,6,8,10};
for (int i = 0; i < size; i++){
cout << values[i] << endl; }
The size of array is 5. The name of array is values. The elements of array are 2,4,6,8,10.
To print each element of the values array using array subscript notation, the variable i is initialized to 0, because array index starts at 0. The cout statement inside body of loop prints the element at 0-th index i.e. the first element of values array at first iteration. Then i is incremented by 1 each time the loop iterates, and this loop continues to execute until the value of i get greater of equal to the size i.e. 5 of values array.
The output is:
2
4
6
8
10
d)
aPtr = values;
This statement assigns the first element in values array to pointer aPtr. Here values is the address of the first element of the array.
aPtr = &values[0];
In this statement &values[0] is the starting address of the array values to which is assigned to aPtr. Note that the values[0] is the first element of the array values.
e)
Since &values[0] is the starting address of the array values to which is assigned to aPtr. So this address is the physical address of the starting of the array. If referring to the part d) then use this statement to print physical address is aPtr pointing to
cout<<aPtr;
This is basically the starting address of the array values to which is assigned to aPtr.
The output:
0x7fff697e1810
f)
i variable represents offset and corresponds directly to the array index.
name of the pointer i.e. vPtr references the array
So the statement (vPtr + i) means pointer vPtr that references to array values plus the offset i array index that is to be referenced. This statement gives the address of i-th element of values array. In order to get the value of the i-th element of values array, dereference operator * is used. It returns an ith value equivalent to the address the vPtr + i is pointing to. So the output is:
2
3
6
8
10
g)
values[0] is stored at 1002500
aPtr + 3 refers to values[3],
An integer is 4 bytes long,
So the address that is referenced by aPtr + 3 is
1002500 + 3 * 4 = 1002512
values[3] is basically the element of values array at 3rd index which is the 4th element of the array so the value stored at that referred location is 8.
h)
Given that aPtr points to apples[4], so the address stored in aPtr is
1002500 + 4 * 4 = 1002516
aPtr -= 4 is equivalent to aPtr = aPtr - 4
The above statement decrements aPtr by 4 elements of apples array, so the new value is:
1002516 - 4 * 4 = 1002500
This is the address of first element of apples array i.e 2.
Now
cout<<aPtr<<endl; statement prints the address referenced by aPtr -= 4 which is 1002500
cout<<*aPtr<<endl; statement prints the value is stored at that location which is 2.
the part of the computer that contains the brain , or central processing unit , is also known the what ?
Answer:
system unit
Explanation:
A system unit is the part of a computer that contains the brain or central processing unit. The primary device such as central processing unit as contained in the system unit perform operations hence produces result for complex calculations.
The system unit also house other main components of a computer system like hard drive , CPU, motherboard and RAM. The major work that a computer is required to do or performed is carried out by the system unit. Other peripheral devices are the keyboard, monitor and mouse.