In programming, if statements are used to test conditions. The statement to be executed will be determined by the result of the conditions. A statement will be executed if its accompanying condition is true.
The errors in the given code segment are as follows:
The if condition on line 1 should be in a closed bracket; i.e. ()The if condition has more than 1 statements to execute. So, it requires a curly bracket; i.e. {}The second part of the first condition should be == 4 and not =4; because the proper operator to make comparison is == while = is used as an assignment operatorThe correct code is as follows:
if (numNeighbors >= 3 || numNeighbors == 4) {
++numNeighbors;
printf ("You are dead! \n “); }
else
--numNeighbors;
Read more about conditional statements at:
https://brainly.com/question/20228453
They are correct? thank you!
Answer:
[OPINION]
First one is correct.
For the second one, I think the leader should accept the invitation and forward it to the entire team. [As the team experienced success due to group work, so every team member should be invited... as the success was a result of the hardwork of every member]
About the third one, I think it depends on the person so you may be correct. But, if I was asked to choose I would have been chosen.... rational approach
This is just my opinion. Hope it helps you:)
you are the network administrator for a college. wireless access is widely used at the college. you want the most secure wireless connections you can have. which of the following would you use?
A WPA
B WEP2
CWEP
D WPA2
Answer:
D. WPA2
Explanation:
Required
Of the 4 options, which is the most secured?
WPA was created as a solution to the vulnerabilities in WEP/WEP2. Then, WPA was upgraded to WPA2.
WPA2 is the least vulnerable to hacks because for every user that is connected to the network through WPA2, a unique encryption is made available for such connection.
Hence, the most secure connection, of the 4 is WPA2.
Your location has been assigned the 172.149.254.0 /24 network. You are tasked with dividing the network into 13 subnets with the maximum number of hosts possible on each subnet.
Required:
a. What is the dotted decimal value for the subnet mask?
b. How many additional bits will you need to mask in the subnet mask?
Given:
Network IP address [tex]\bold{= 172.149.254.0 /24}[/tex]
Subnet numbers [tex]\bold{= 13}[/tex]
Calculating the borrow bits:
[tex]\to \bold{= ceil(\log_{2} 13) = 4 \ bits}[/tex]
a)
Calculating the dotted decimal value for the subnet mask:
[tex]\to \bold{11111111.11111111.11111111.00000000}\\\\\to \bold{255.255.255.240}\\\\[/tex]
b)
The additional bits which will be needed to mask the subnet mask that is = 4.
Learn more: brainly.com/question/2254014
A choropleth map is used to
Group of answer choices
do a scatter plot.
show live satellite images.
present geographical regions in 3D.
present geographical regions coloured, shaded, or graded according to some variable.
In what tab can a user find the workspace option?
Which Windows installation method requires the use of Windows deployment services (WDS)?
1. Network Installation
2. Repair Installation
3. Bootable flash drive installation
4. Unattended installation
Answer:
1. Network Installation
Explanation:
Given
Options (1) to (4)
Required
Which requires WDS for installation
WDS are used for remote installations where users do not have to be physically present before installations can be done; in other words, it is necessary for network based installations.
Of all the given options, (a) is correct because without WDS, network installation cannot be done.
In the context of the components of a typical expert system, _____ is similar to a database, but in addition to storing facts and figures it keeps track of rules and explanations associated with facts.
Answer:
Knowledge base.
Explanation:
Artificial intelligence (AI) also known as machine learning can be defined as a branch of computer science which typically involves the process of using algorithms to build a smart computer-controlled robot or machine that is capable of performing tasks that are exclusively designed to be performed by humans or with human intelligence.
Artificial intelligence (AI) provides smarter results and performs related tasks excellently when compared with applications that are built using conventional programming.
Generally, there are two (2) main characteristics of artificial intelligence (AI) systems and these include;
I. Non-algorithmic processing.
II. Symbolic processing.
In artificial intelligence (AI), the field of expert systems is the most important applied area because it models human knowledge.
Hence, expert systems represents knowledge as a set of rules by mimicking the expertise of humans in a particular field to uniquely proffer solutions to a problem.
Although, all expert systems are generally lacking in human capabilities and can only use inference procedures to proffer solutions to specific problems that would normally require human expertise or competence.
Some of the areas where expert systems can be applied are; monitoring, diagnosis, scheduling, classification, design, process control, planning, etc.
Basically, expert systems comprises five (5) main components and these are;
1. Explanation module.
2. Inference Engine.
3. Knowledge acquisition and learning module.
4. User Interface.
5. Knowledge Base.
In the context of the components that makes up an expert system, knowledge base is similar to a database because it is used for storing facts and figures, while keeping track of rules and explanations associated with facts. Thus, giving rise to the knowledge base management system (KBMS).
In the context of the components of a typical expert system, Knowledge base is similar to a database, but in addition to storing facts and figures, it keeps track of rules and explanations associated with facts.
An expert system is a form of artificial intelligence where computer imitate the decision making style of humans.
There are basically two types of the expert system and they are the inference engine and the knowledge base.
The knowledge base consists of the facts and rules and ways of interpreting them to arise to new insights. The inference engine applies logical rules to the knowledge base.
Learn more about knowledge base here:
https://brainly.com/question/9619145
What is system software? Write its types.
Answer:
There are two main types of software: systems software and application software. Systems software includes the programs that are dedicated to managing the computer itself, such as the operating system, file management utilities, and disk operating system (or DOS)
Answer:
There are two main types of software: systems software and application software. Systems software includes the programs that are dedicated to managing the computer itself, such as the operating system, file management utilities, and disk operating system (or DOS)
Explanation:
thanks for question
cpp Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, which indicates a threshold. Output all integers less than or equal to that last threshold value. Ex: If the input is:
Answer:
#include <iostream>
int main() {
// The length of the list
int l;
// The array containing the numbers
int *list;
// Threshold, last value in array
int thresh;
// Read in first value and create an array with the size of that value
scanf("%d", &l);
list = (int*) malloc(l * sizeof(int));
for(int i = 0; i < l; i++) {
scanf("%d", &list[i]);
}
thresh = list[l - 1];
// Print the values
for(int i = 0; i < l - 1; i++) {
if (list[i] <= thresh) {
printf("%d ", list[i]);
}
}
printf("\n");
free(list);
}
Explanation:
The program assumes at least two values are provided. The length of the list and the threshold.
We first read in an integer, and find out how many more integers we need to read. We create an array with the appropriate size, and loop through to fill the array with values. We know the last value is the threshold, and so we do one more loop to compare the values in the array with the threshold.
Which one is the result of the output given by a compute
Answer:
Images.
Sound.
Hardcopy
…
Answer:
it can be anything like sound or pictures
Explanation:
What is the iterative procedure of recursive and nonrecursive?
Answer:
nonrecursive
Explanation:
1. For this assignment you will print the steps for 8-bit by 8-bit multiplication.
2. Your program should read in two unsigned numbers from stdin, the first being the multiplicand and the second being the multiplier. Your program should verify that both values are within the range 0 to 255. If not, the program should print an appropriate error message and exit.
3. Your program should then initialize the simulated registers and echo the input values in decimal and also in binary.
4. Then your program should illustrate the eight steps required for multiplication using the same type of step diagrams as given in the lecture notes.
5. Finally, your program should print a check section that shows a summary of the multiplication in binary as well as in decimal. See the example below.
6. You may write your program in C, C++, or Java. If you choose to work in C, here is an example function that will allow you to represent an n-bit value within an int data type and print out the binary value in "length" bits. It uses the shift right operator and the bitwise and. (You can also choose to use unsigned int as the data type; since you are using only the lower 8 of the 32 bits in an int, there will be no apparent difference between using int and using unsigned int. However, if you choose to use char as the data type, you should use unsigned char to ensure that the compiler generates logical rather than arithmetic shifts.)
void prt_bin( int value, int length ){
int i;
for( i=(length-1); i>=0; i--){
if((value>>i)&1)
putchar('1');
else
putchar('0');
}
}
For example, if you declare acc as an int, then you could call prt_bin(acc,8) to print the 8-bit value in the accumulator.
You should format your output to exactly match the output below. 10% of the grade will be awarded for following the same format.
Sample Run is given below:
multiplicand: 33
multiplier: 55
c and acc set to 0
mq set to multiplier = 55 decimal and 00110111 binary
mdr set to multiplicand = 33 decimal and 00100001 binary
---------------------------------------------------
step 1: 0 00000000 00110111
+ 00100001 ^ add based on lsb=1
----------
0 00100001 00110111
>> shift right
0 00010000 10011011
---------------------------------------------------
step 2: 0 00010000 10011011
+ 00100001 ^ add based on lsb=1
----------
0 00110001 10011011
>> shift right
0 00011000 11001101
---------------------------------------------------
step 3: 0 00011000 11001101
+ 00100001 ^ add based on lsb=1
----------
0 00111001 11001101
>> shift right
0 00011100 11100110
---------------------------------------------------
step 4: 0 00011100 11100110
+ 00000000 ^ no add based on lsb=0
----------
0 00011100 11100110
>> shift right
0 00001110 01110011
---------------------------------------------------
step 5: 0 00001110 01110011
+ 00100001 ^ add based on lsb=1
----------
0 00101111 01110011
>> shift right
0 00010111 10111001
---------------------------------------------------
step 6: 0 00010111 10111001
+ 00100001 ^ add based on lsb=1
----------
0 00111000 10111001
>> shift right
0 00011100 01011100
---------------------------------------------------
step 7: 0 00011100 01011100
+ 00000000 ^ no add based on lsb=0
----------
0 00011100 01011100
>> shift right
0 00001110 00101110
---------------------------------------------------
step 8: 0 00001110 00101110
+ 00000000 ^ no add based on lsb=0
----------
0 00001110 00101110
>> shift right
0 00000111 00010111
---------------------------------------------------
check: binary decimal
00100001 33
x 00110111 x 55
---------------- ------
0000011100010111 1815
Answer:
Code:
#include<bits/stdc++.h>
using namespace std;
char* prt_bin( int value, int length, char s[]){
for(int i=(length-1); i>=0; i--){
if((value>>i)&1) {
s[length-1-i] = '1';
// putchar('1');
}
else {
s[length-1-i] = '0';
// putchar('0');
}
}
s[length] = '\0';
return s;
}
int main(){
int nbits = 8, c, acc;
char s[nbits+1];
int multiplicand, multiplier, mq, mdr;
cout<<"Multiplicand: ";
cin>>multiplicand;
cout<<"Multiplier: ";
cin>>multiplier;
if(multiplier<0 || multiplier>255 ||multiplicand<0 || multiplicand>255){
cout<<"Given Multiplicand or multiplier is incorrect. Exiting the program.\n";
return 0;
}
c = 0; acc = 0;
cout<<"c and acc set to 0\n";
mq = multiplier;
mdr = multiplicand;
cout<<"mq set to multiplier = "<<multiplier<<" decimal and "<<prt_bin(multiplier, nbits, s)<<" binary\n";
cout<<"mdr set to multiplicand = "<<multiplicand<<" decimal and "<<prt_bin(multiplicand, nbits, s)<<" binary\n";
printf("---------------------------------------------------\n");
for(int i=1;i<=nbits;i++){
printf("step %d: %d %s ",i, c, prt_bin(acc, nbits, s));
printf("%s\n",prt_bin(mq, nbits, s));
char lsb = s[nbits-1];
if(lsb=='1'){
printf(" + %c %s ^add based on lsb=%c\n", c, prt_bin(mdr, nbits, s), lsb);
printf(" ----------\n");
acc = acc + multiplicand;
}
else{
printf(" + %c %s ^no add based on lsb=%c\n", c, prt_bin(0, nbits, s), lsb);
printf(" ----------\n");
}
printf(" %d %s ", c, prt_bin(acc, nbits, s));
printf("%s\n",prt_bin(mq, nbits, s));
printf(" >> shift right\n");
mq = mq>>1;
if(acc%2==1){
mq = mq+128;
}
acc = acc>>1;
printf(" %d %s ", c, prt_bin(acc, nbits, s));
printf("%s\n",prt_bin(mq, nbits, s));
printf("---------------------------------------------------\n");
}
char sr[nbits*2+1];
printf("check: binary decimal\n");
printf(" %s %d\n", prt_bin(multiplicand, nbits, s), multiplicand);
printf(" x %s x %d\n", prt_bin(multiplier, nbits, s), multiplier);
printf(" ---------------- ------\n");
printf(" %s %d\n", prt_bin(multiplier*multiplicand, nbits*2, sr), multiplier*multiplicand);
return 0;
}
Write the code for the following problem.
Add a function to problem to display the last name and highest, last name and lowest and average exam score. Hint: for highest initialize a variable to 0 (high_var). If the array value is higher than the high_var then set high_var to the array value and set high_index to the position of the array. Proceed through the array until you get to the end. Do the same for finding the lowest using low_var set to 999 (higher than the highest value). For the average score, sum all the exam scores as you proceed through the loop. Use a for loop to go through each occurrence of the arrays. Note you can do all this with one for loop but if it makes more sense to you to use multiple for loops that is ok too.
Answer:
no
Explanation:
A hammer tool can only be used by one technician at a time to perform hitting. Accordingly, you have developed a Hammer class with a hit method. Objects of class Hammer are used to simulate different hammers, while threads are created to simulate users. Which situation needs to add the synchronized keyword to the hit method
Answer:
Explanation:
The synchronized keyword needs to be active on the hit method at any point where 2 or more threads (users) exists at any given moment. This is in order to prevent two or more users from trying to perform a hammer hit at the same time. This is what the synchronized keyword is used for. It prevents the more than one thread from calling the specific method at the same time. Instead it adds the action to a sequence so that the second thread calls the hit method only after the first thread's hit method finishes.
Who innovated an aeroplane?
Answer:
White brothers!!
Explanation:
Convert the following decimal numbers into their binary equivalent: a. 13
b. 32 or 42
c. 292
d 12
e. 61
f. 120
g.29
h. 44
67
98
Answer: a. 1101 b. 10000 or 101010 c. 100100100 d. 1100 e. 111101 f. 1111000 g. 11101 h. 101100 1000011 1100010
1.which screen appears after the password is typed (welcome, lock)
Answer:
it should be the welcome screen I will hope so lol
Answer:
welcomeyou don't know that much also
explain how data structures and algorithms are useful to the use of computer in data management
Answer:
programmers who are competent in data structures and algorithms can easily perform the tasks related to data processing ,automated reasoning ,or calculations . data structure and algorithms is significant for developers as it shows their problems solving abilities amongst the prospective employers .
When we have signals within 1-2 MHz band, using a waveguide is the most preferred choice for a transmission line. T or F?
Answer:
T
Explanation:
Discuss the scaled index addressing mode and comments on the following instructions?
a) MOV BX, [CX+5*AX]
b) MOV [DX5*DI+30H], CX
For option a:
The baseline register is [tex]\bold{BX}[/tex], while the index register is [tex]\bold{CX+5*AX}[/tex].
The multiplier for Accumulator [tex]\bold{AX }[/tex] will be 5.[tex]\bold{CX }[/tex] will be multiplied with this value.[tex]\bold{CX+5*AX}[/tex] will contain a memory address.The value at position [tex]\bold{CX+5*AX}[/tex] is accessed by [tex]\bold{[{CX+5*AX} ]}[/tex].The value retrieved from the address [tex][\bold{CX+5*AX}][/tex] is moved into Base register BX by the MOV instruction.For option b:
Its index register is [tex]\bold{CX }[/tex], whereas the base register is [tex]\bold{DX5*DI+30H}[/tex].
[tex]\bold{CX}[/tex] has a number, that is copied to a computed place below.After multiplying [tex]\bold{DI}[/tex] by [tex]\bold{5, DX}[/tex] will be multiplied by this [tex]\bold{5*DI}[/tex].To the aforementioned multiplied value,[tex]\bold{ 30H}[/tex] will be added.[tex]\bold{[DX5*DI+30H]}[/tex] is a value located at location [tex]\bold{DX5*DI+30H}[/tex]. [tex]\bold{DX5*DI+30H }[/tex] is a memory address number.As a result, the value of [tex]\bold{CX}[/tex] will be copied to the [tex]\bold{ [DX5*DI+30H] }[/tex]location.Learn more:
brainly.com/question/14319860
advantages of computational skill
Explanation:
algorithmic thinking - developing a set of instructions or sequence of steps to solve a problem;
evaluation - ensuring a solution is fit-for-purpose;
decomposition - breaking a problem down into its component parts;
How to use the AI System ?
ANSWER:
· New artificial intelligence systems are being developed to help teachers administer more effective testing that could uncover some of these often-hidden conditions. Once they can be properly identified, educators can tap into the resources available for a learning disability. Students can use AI to give reliable feedback.
Suppose you have a stack ADT (i.e., an Abstract Data Type that includes operations to maintain a stack. Design a flowchart or suitable logical diagram to show you could implement a queue’s enqueue and dequeue operations using two stacks, stack 1 and stack 2.
Answer:
One approach would be to move all items from stack1 to stack2 (effectively reversing the items), then pop the top item from stack2 and then put them back.
Assume you use stack1 for enqueueing. So enqueue(x) = stack1.push(x).
Dequeueing would be:
- For all items in stack1: pop them from stack1 and push them in stack 2.
- Pop one item from stack2, which will be your dequeue result
- For all items in stack2: pop them from stack2 and push them in stack 1.
Hope it makes sense. I'm sure you can draw a diagram.
consider a hard disk with the following specifications :
3.5 in diameter
Answer:
usable capacity = 10 GB
Number of cylinders = 256
Block size = 4 KB
(1)Bytes in each cylinder = (10*230)/(256) = (10*222) = 40 MegaBytes
(2)Number of Blocks in each cylinder = (10*222)/(212) = 10K
(3)capacity of one track = 40 MegaBytes/(10*2) = 2 MB
Rotation speed = 3840 RPM
Number of rotations per second = 3840/60 = 64
Transfer rate = (2*64) = 128 MB/sec
Explanation:
why do we need vector graphics for creating logo
Answer:
hope it will help uplease mark brillient
Answer:
So we can maintain high quality designs at any graphic scale.
Explanation:
Unlike other graphic formats which simply define colors for fixed pixels, vector graphics define points and shapes (vectors) which are then used to draw the graphic at the desired and appropriate resolution.
Our graphic can look good at any resolution, no matter how large it gets. If we take a png or jpg file and make it extremely large, you'll notice the image begins to get blurry, because the pixels are being stretched and colors are being predicted or matched for the larger scale.
(1)similarities between backspace key and delete key. (2) different between backspace key and delete key. (3) explain the term ergonomics. (4) explain the following. a click b right click c double click d triple click e drag and drop
Answer:
1.similarity:
they are both editing keys3.ergonomics are designed keying devices that alleviates wrist strain experienced when using ordinary keyboard for long hours
4.
.a click is pressing and releasing the left mouse button onceright click is pressing the right mouse button once to display a short cut menu with commands from which a user can make a selectiondouble click is pressing the left button twice in rapid successiondrag and drop is where by the user drags an icon or item from one location on the screen to another.Imagine that you wanted to write a program that asks the user to enter in 5 grade values. The user may or may not enter valid grades, and you want to ensure that you obtain 5 valid values from the user. Which nested loop structure would you use?
A. A "for" loop inside of a "while" loop
B. A "while" loop inside of a "for" loop
C. None of the above
D. Either a or b would work
The type of nested loop which I would use to write the program is:
B. A "while" loop inside of a "for" loopWhat is a Loop?This refers to the control flow statement which is used to iterate and lets a particular line(s) of code execute repeatedly
With this in mind, we can see that the type of nested loop which I would use to write the program is a "while" loop inside of a "for" loop because it is a conditional statement that continues to ask for the certain valid grades until it gets the right one.
Therefore, the correct answer is option B
Read more about loops here:
https://brainly.com/question/26098908
If you were driving the blue Prius in the situation pictured above, explain why the red Mustang should be given right-of-way at this intersection.
Answer:
The red Mustang should be given the right-of-way at this intersection because:
The red Mustang arrived first before the blue Prius and is closer to the stop sign before the arrival of the blue Prius. This implies that the red Mustang must have waited for its turn, unlike the blue Prius that just arrived at the intersection.
Explanation:
Traffic laws, regulations, and IPDE defensive driving strategy require that drivers always give way to the vehicle that arrived before them at an intersection. Assuming that multiple vehicles reach the intersection simultaneously, then the vehicle must be given the right-of-way. Alternatively, the traffic lights at the intersection should be obeyed and be allowed to regulate the movement of vehicles. IPDE defensive driving strategy requires drivers to be watchful of their driving spaces to determine the appropriate time to move.
Carlos manages a Linux system that users are able to SSH into in order to perform certain tasks. However, he has just installed a critical patch and wants to reboot the server to ensure that it has fully taken effect. Which of the following commands should he use to ensure that a reboot will not interrupt any logged in users?
a. w
b. id
c. whoami
d. uname -a
The answer is "Option b" which is "id", and its further calculation can be defined as follows:
In the Linux system, the id command is being used to find out the account and main indicators and numeric IDs of a current user and any other user on the system. In this, command the User name and genuine user ID.It is used to list all the groups of which a user is a member, and also display the security context of the current user.The wrong choice can be defined as follows:
In choice a, "w" is the use full command, which displays all users who are currently active.In choice c, "whoami" is used as our user name.In choice d, "uname-a" is used to shows information about the network.Therefore "Choice b" is the correct answer.
Learn more:
Linux system: brainly.com/question/3133247
how do you copy a file
Answer:
right click and press control c