Answer:
double *prices=new double [256];
Explanation:
To allocate memory on heap we use new keyword.In the above statement an array name prices is declared and the memory allocated to it is on the heap memory.
First look at double * prices.It is a pointer this pointer is created on the stack memory which holds starting address of the array present on the heap memory of size 256..
Register addressing is the fastest way to access memory.
True
False
Answer:
True.
Explanation:
In operating system memory management registers are the fastest way to access memory but their storing capacity is least .They can store data less than 1kb but the access time for register is around 5 ns.
Registers are the smallest unit of memory.The bigger the memory the more is the access time.
Hence the answer to this question is True.
If variable x has value 2 and y has value 1, which values could result from the following Jack expression?
x + 3 * 4 - y
Answer:
The result of the given expression is 13.
Explanation:
Here x and y are the two variable which has value 2 and 1 respectively.
x+3*4-y
Here operator * is more precedence then that + operator so
=2+(3*4)-1
2+12-1 now + operator is more precedence then that - operator so
=(2+12)-1
=(14-1)
=13
Following are the program in C language
#include <stdio.h>// header file
int main() // main function
{
int x=2,y=1; // variable declaration
printf("%d",x+3*4-1); b// final result
return 0;
}
Output:13
What is the output of the code below?
for (int j = 1; j <= 10; j++)
{
if (j == 3)
{
break;
}
cout << j << endl;
}
Output:
for (int j = 1; j <= 10; j++)
{
if (j == 3)
{
continue;
}
cout << j << endl;
}
Output:
Expert
Answer:
The first output for the following code is given below :
1
2
The second output for the following code is given below
1
2
4
5
6
7
8
9
10
Explanation:
In the first code the loop will iterated
When j=1 the condition of if block will not be executed so it print 1 on console and increment the value of j.
After increment of j it becomes 2 again if block does not executed because the condition of if block is not true so it print 2 on console and increased the value of j.
When j=3 if condition block is executed and it terminate the loop immediately .
Therefore output is :
1
2
In the second code the loop will iterate
When j=1 the condition of if block is not executed so it print 1 on console and increment the value of j.
After increment the value of j it becomes 2 .Again if block will not be executed so it print 2 on console and increased the value of j.
After increment the value of j becomes 3.This time if block will executed ,it will moved directly control to the beginning of the loop and skip the current execution of statements that means it skip the value j=3 and increment the value of j .
Now j=4 this process is same follow untill when j<=10 when j=11 the loop is false and loop will terminate .
Therefore output is :
1
2
4
5
6
7
8
9
10
A host is rebooted and you view the IP address that it was assigned. The address is 169.254.141.45. Which of the following happened? (Please select one of the four options)
The host received an APIPA address
The host received a public address
The host receive a multicast address
The host received a private address
Answer: The host received an APIPA address
Explanation:
The IP address 169.254.141.45 is within the range of IP address between 169.254.0.0 and 169.254.255.255, which are reserved by the IANA (Internet Assigned Numbers Authority) for those IP addresses denoted as APIPA addresses, where APIPA stands for Automatic Private IP Address.
This means that any IP Address in this range , will be not be in conflict with routable IP addresses.
Why is WPS desirable?
Answer:
WPS is known as wireless protected setup that is basically used for the wireless security purpose. The WPS system is basically make the connection easily between the router and other network devices.
The WPS desirable as it make the connection and configuration of the network more simple with the given access point.
In WPS, the users contain the pin and it is 8 digit long pin that is basically associate with the access point.
A(n) --------- statement is displayed on the screen to explain to the user what to enter
Answer: Prompt
Explanation:
The prompt statement is basically used to define the users about the details that what to enter on the screen that is displayed and sort the input data so that it can easily enter.
In the program, the prompt statement and the dialog boxes are used to enter the input data or information in the terminal screen and window.
For example:
In the C++ language, the std::cout function is basically used for the output value and the std::cin function is used to get the input value.
In the java programming, the system.out.ptintln() function is basically used to tell the users to enter the input value in the program.
Write a recursive function that returns the number of 1 in the binary representation of N. Use the fact that this is equal to the number of 1 in the representation of N/2, plus 1, if N is odd.
Answer:
#here is code in python
# recursive function that counts the number of 1's
def bin_count(num):
#base condition
if num==0:
return (0)
elif num == 1:
return (1)
else:
#recursive call
return bin_count(num//2)+bin_count(num%2)
#read a number
num=int(input("enter a number:"))
#call the function
print("number of 1's is:",bin_count(num))
Explanation:
Read a number from user and call the function bin_count() with parameter num. In the function, if num=0 then it will return 0.If num is 1 then return 1 else it will count the number of 1's inn the binary representation of the number and return the count.
Output:
enter a number:63
number of 1's is: 6
. Why use a sensitivity analysis?
Answer:
Sensitivity analysis is the method in which it basically predict the final outcome of the decision. It analysis each variable individually and identify the dependency of the output value on the particular value of the input.
The advantage of the sensitivity analysis is that it reduce the overall risk of the particular strategy and also impact of the system.
It basically work on the basic principle that firstly changed the structure and model and then observe the particular behavior of the model.
a = [2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 33 34 35 36 37 38 39 40]
b = [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 43 45 47 49 50 54 59 60]
In MATLAB, only using fully-vectorised code (ie. no loops) divide A by B element by element.
Answer:
[tex]C = a./b[/tex]
Explanation:
In MATLAB, the following command:
[tex]C = A./B[/tex]
Performs the element by elemet division of A and B. This comand is called Right-array division.
So, in your case, we could divide A by B element by element, only using fully-vectorised code (ie. no loops), with the following code:
[tex]a = [2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 33 34 35 36 37 38 39 40];
b = [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 43 45 47 49 50 54 59 60];
C = a./b[/tex];
C would be the element by element division of A and B, with no loops.
Convert AB4F from hexadecimal to binary.
Answer:
AB4F=1010101101001111.
Explanation:
Every bit of hexadecimal number is a 4 bit binary number.So to convert a number from hexadecimal to binary number by finding the corresponding binary number for each bit of hexadecimal number and then write it in the same sequence.
A=1010
B=1011
4=0100
F=1111
Writing in the same sequence of the hexadecimal number.
AB4F = 1010101101001111.
Discuss how cryptology is used on the Internet for e-business or e-commerce. Provide examples and types of cryptographic tools and techniques
E-commerce deals with a wide range of products and services on the internet. Therefore, it is crucial to recognize security and a high degree of confidence required in the authenticity and privacy of online transactions. Sometimes, it can be challenging to trust the internet where these kinds of transactions are made; thus, the need for cryptography. Cryptography provides data security and reduces the risk of cybercrimes, such as hacking and phishing.
Modern Cryptography services can be seen as data authentication, user authentication, data confidentiality, and no-repudiation of origin. The most common type of cryptographic tools and techniques is the use of the RSA Algorithm. It is used for securing communications between web browsers and e-commerce sites. The interactions make use of an SSL certificate, which is based on public and private keys. PKI (Public-Key Infrastructure) is also another excellent example of cryptographic tools and techniques. Based on several things, PKI is used to identify or authenticate the identity of the other party on the internet.
write c++ program bmi.cpp that asks the user bmi.cpp the weight (in kilograms) and height (in meters).
The program then calculates and writes to the screen BMI (body-mass index) that user with two decimal places.
Answer:
// here is code in C++(bmi.cpp).
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variables
float weight,height;
cout<<"enter the weight(in kilograms):";
//read the weight
cin>>weight;
cout<<"enter the height(in meters):";
//read the height
cin>>height;
// calculate the bmi
float bmi=weight/(pow(height,2));
// print the body-mass index with two decimal places
cout<<"BMI is: "<<fixed<<setprecision(2)<<bmi<<endl;
return 0;
}
Explanation:
Read the weight from user and assign it to variable "weight",read height and assign it to variable "height".Then find the body-mass index as (weight/height^2).Here weight should be in kilograms and height should be in meters.
Output:
enter the weight(in kilograms):75
enter the height(in meters):1.8
BMI is: 23.15
Final answer:
The C++ program calculates a user's BMI by asking for their weight in kilograms and height in meters, then outputs the result with two decimal places using the formula BMI = Weight / height².
Explanation:
The Body Mass Index (BMI) is an important measurement used to categorize weight categories that could lead to health issues. In this C++ program, the user will be prompted to enter their weight in kilograms and height in meters. The program will then calculate their BMI using the formula BMI = Weight / height² (kg/m²), and display it on the screen with two decimal places.
Here is a sample C++ program that calculates BMI:
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
double weight, height, bmi;
cout << "Please enter your weight in kilograms: ";
cin >> weight;
cout << "Please enter your height in meters: ";
cin >> height;
bmi = weight / (height * height);
cout << "Your BMI is " << fixed << setprecision(2) << bmi << endl;
return 0;
}
The program ensures the BMI is presented with two decimal places using the iomanip library functions fixed and setprecision. After compilation, the user can run the program, input their data, and get their BMI value on the screen.
. Planning a BI implementation is a complex project and includes typical project management steps. Therefore, the first step in the BI planning process is to _____.
a. define the scope
b. define the budget
c. identify the resources needed
d. define the timeline
Answer:
The correct answer is option a. "define the scope".
Explanation:
Define the scope is one critical step of project management that must take places when the planning of the project is being done. It involves defining certain critical aspects of the project such as: goals, deliverables, features, tasks, deadlines, and costs. Since BI planning includes typical project management steps, define the scope must be the first step.
Write a program that applies the Euclidean algorithm to find the greatest common divisor of two integers. Input should be two integers a and b and output should be the greatest common divisor of a and b. Test your program with several examples using both positive and negative values for a and b.
Answer:
// here is code in c++.
#include <bits/stdc++.h>
using namespace std;
// function that return greatest common divisor
int g_c_d(int num1, int num2)
{
if (num1 == 0)
return num2;
return g_c_d(num2 % num1, num1);
}
// main function
int main()
{
// variables
int num1,num2;
cout<<"enter two numbers:";
// read two numbers from user
cin>>num1>>num2;
// call the function and print the gcd of both
cout<<"greatest common divisor of "<<num1<<" and "<<num2<<" is "<<g_c_d(num1.num2)<<endl;
}
Explanation:
Read two numbers from user and assign them to variables "num1" and "num2".Call the function g_c_d() with parameter "num1" and "num2".According to Euclidean algorithm, if we subtract smaller number from the larger one the gcd will not change.Keep subtracting the smaller one then we find the gcd of both the numbers.So the function g_c_d() will return the gcd of both the numbers.
Output:
enter two numbers:5 9
greatest common divisor of 5 and 9 is 1
enter two numbers:-25 15
greatest common divisor of -25 and 15 is 5
The Euclidean algorithm is used to find the greatest common divisor of two integers, which is implemented in a Python program that works with both positive and negative integers. An example demonstrates that the GCD of 48 and 18 as well as -48 and 18 is 6.
The question involves writing a program that uses the Euclidean algorithm to calculate the greatest common divisor (GCD) of two integers. The Euclidean algorithm is a method for finding the greatest common divisor of two numbers, which is the largest number that divides both of them without leaving a remainder.
The program will take two integers as input and provide their greatest common divisor as output. To accommodate both positive and negative input values, the algorithm can be implemented as follows in Python:
def gcd(a, b):
while b != 0:
a, b = b, a % b
return abs(a)
# Examples using the function
gcd_result1 = gcd(48, 18)
print(f'The GCD of 48 and 18 is {gcd_result1}')
# The function can also handle negative values
gcd_result2 = gcd(-48, 18)
print(f'The GCD of -48 and 18 is {gcd_result2}')
This example demonstrates that the greatest common divisor of 48 and 18 is 6, and the GCD of -48 and 18 is also 6 because the GCD is always a non-negative number.
The frequency of a sine wave is defined as:
a.the number of cycles per second
b.the maximum amplitude of the wave
c.the time for one cycle
d.the difference between the high frequency and the low frequency
Answer:
a.the number of cycles per second
Explanation:
The frequency of a sine wave is defined as the number of cycles per second.
Frequency is the inverse of the time period. The frequency of a sine wave is given by 1/TimePeriod . It is generally expressed in units of Hertz(Hz) or sec^-1. Larger the time period, lower will be the frequency and vice versa. So for higher frequency waves we need to ensure that the time period is small.
Why do we have some network devices that have more than one IP address?
Answer:
This is because a device can have more than a network interface.
Explanation:
IP address has to be unique in a network but a device can have more than a network interface. This is because the device has multiple network cards and for each of the interfaces we can set up an unique ip address in a LAN. For example almost all laptops have at least two network interfaces: one is the ethernet interface, we can connect an ethernet cable to this interface. The other one is the WiFi interface, we can connect to internet using this interface. In this case we can have more than one IP address but they have to be unique.
If the program does not handle an unchecked exception:
a.)
the program is halted and the default exception handler handles the exception
b.)
the program must handle the exception
c.)
the exception is ignored
d.)
this will cause a compilation error
Answer:a.) The program is halted and the default exception handler handles the exception
Explanation: If a exception is left out by the program handler then the processing is stopped and the control of exception handling is done to another handler. The unchecked exception is thus handled by the default exception handler.
Exception occur in the executing programs that try to stop the function by terminating it .The method used for the handling of the program is try catch and throw technique. Unchecked exception are found while the run-time and thus target the processing of the program.Thus,the correct option is option(a).
Other options are incorrect because the current program cannot handle the exception as it has left it unchecked, exception cannot be ignored because it stops the program and compilation error will not be caused.
___ should be considered by managers to ensure that newer hardware is compatible with older hardware.
Backward compatibility
Forward compatibility
Integrative compatibility
Reverse compatibility
Answer:
Backward Compatibility
Explanation:
Backward Compatibility means either the Software or Hardware systems which are compatible with the older versions of the software and hardware.It basically means the newer versions of the software or hardware are compatible with the older versions of the same software or hardware.The core technology in both the newer versions and hardware may remain the same. The newer versions uses the same data and technology of the older versions with some upgrades.So, option (A) is correct option.Forward Compatibility is related to the same concept. Forward Compatibility means the older versions of the software and hardware are compatible with the upcoming newer versions of software and hardware. So, option (B) Is wrong option.There are no terms called (C) Integrative Compatibility (D) Reverse compatibility. So, options (C) and (D) are false.Explain what might happen if two stations are accidentally assigned the same hardware address?
Answer: If two different station are addressed with the same hardware address then there are chances of occurrence of the failure in the network at irregular intervals.The failure or error will occur because of the both the devices are seen as one by the network due to same address.
An intelligent network system id used ,it can identify the error can help in the prevention of the failure.Other option for configuring the situation is assigning the MAC(media access control)address to devices which are unique in nature thus, no device can have same address.
Which of the following is not a valid SQL command? (Points : 2) UPDATE acctmanager SET amedate = SYSDATE WHERE amid = 'J500';
UPDATE acctmanager SET amname = UPPER(amname);
UPDATE acctmanager SET amname = UPPER(amname) WHERE amid = 'J500';
UPDATE acctmanager WHERE amid = 'J500';
Answer:
UPDATE acctmanager WHERE amid = 'J500';
Explanation:
The statement written above is not valid SQL statement because there is no SET after UPDATE. Update is always used with SET.If you are updating something then you need to specify the value with which that value should be replaced.
UPDATE acctmanager SET amname = UPPER(amname);
This statement does not contains WHERE clause but it will run all the values of amname column will get updated in the table acctmanager.
What is memory paging, and how can it facilitate virtual memory?
Answer:
Memory paging is a memory management technique that controls how memory resources are used and shared by the operating system.
The virtual memory is an alternate set of memory addresses that operating systems in conjunction with the hardware reserve to expand the total amount of addresses(real memory + virtual memory). When the program is actually executed, the virtual addresses are converted into real memory addresses.
The operating system divides virtual memory into pages to facilitate copying virtual memory into real memory, each of which contains a fixed number of addresses. When the page is needed, the operating system copies it from disk(virtual memory) to the main memory(real memory), translating the virtual addresses into real addresses.
What are design classes? (Points : 6) Design classes are classes whose specifications have been completed to such a degree that they can be implemented.
Design classes are classes whose specifications have been completed to such a degree that they can be programmed.
Design classes are classes whose specifications have been completed to such a degree that they can be approved.
None of these
Answer: implemented
Explanation:I used a bit of deductive logic. Design would be something with parameters and or boundaries like designing a home. Programmed just didn’t seem to fit in because there is no room for creative thinking. Approved? By whom?, you design something to reach a goal and follow to a degree what you designed, maybe within the walls you can add a closet or with design classes they are designed for a purpose but there must be ideas within a design that come up. So implemented makes sense so you have a design that seems to fit and certainly can be implemented meaning it can be used for a purpose to teach or help.
. How does Word indicate a possible instances of inconsistent formatting?: *
a. With a wavy red underline
b. With a wavy blue underline
c. With a wavy green underline
d. This functionality is not available in Word
Answer:b)With a wavy blue underline
Explanation:Wavy blue lines in the Word document is for representing that the Format consistency checker is in working/on mode .It can identify the inconsistent format instances for the correction while the user is writing the text.
Other options are incorrect because wavy red line is for incorrect spelling of any word and wavy green line signifies the grammatical mistake .The function is available for the format inconsistency as wavy blue line in Word .Thus, the correct option is option(b).
Name and describe the two (2) broad categories of files
-Write a function is_perfect, which accepts a single integer as input. If the input is not positive, the function should return a string "Invalid input." If the input is positive, the function should return True if the input is a perfect number and False otherwise.
Answer:
// here is code in C++.
#include <bits/stdc++.h>
using namespace std;
// function
string is_perfect(int n)
{
// string variables
string str;
// if number is negative
if (n < 0)
{
str="invalid input.";
}
// if number is positive
else
{
int a=sqrt(n);
// if number is perfect square
if((a*a)==n)
{
str="True";
}
// if number is not perfect square
else
{
str="False";
}
}
// return the string
return str;
}
// main function
int main()
{
// variables
int n;
cout<<"enter the number:";
// read the value of n
cin>>n;
// call the function
string value=is_perfect(n);
// print the result
cout<<value<<endl;
return 0;
}
Explanation:
Read a number from user and assign it to variable "n".Then call the function is_perfect() with parameter n.First check whether number is negative or not. If number is negative then return a string "invalid input".If number is positive and perfect square then return a string "True" else return a string "False".
Output:
enter the number:-3
invalid input.
enter the number:5
False
enter the number:16
True
What is the difference between the subu instruction and the sub instruction? State how will the processor behave differently for these instructions.
Answer:
The subu instruction are the type of the immediate arithmetic operation which basically give the binary result in the 32 bits that are stored in the destination register.
The subu instruction typically represent as subtract unsigned. It basically check the overflow of the unsigned number.
The sub instruction basically subtracts the second source operand from the principal source operand, and stores the outcome in the goal operand. This instruction basically used in the pseudocode to perform various tasks.
Write a program that inputs a series of 10 non-negative numbers and determines and prints the largest of those numbers. Your program should use three variables: Counter - a counter to count to 10 (i.e. to keep track of how many numbers have been input and to determine when all 10 number have been processed) Number - the current number input to the program Largest - the largest number found so far
Answer:
// here is code in C++.
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variables
int Counter,largest=-1,Number;
cout<<"enter 10 non-negative numbers:";
// read 10 non-negative Numbers
for(Counter=1;Counter<=10;Counter++)
{
cin>>Number;
if entered number is largest so far
if(Number>largest)
{
// update the largest
largest=Number;
// print the largest
cout<<"largest found so far is: "<<largest<<endl;
}
}
return 0;
}
Explanation:
Declare variables Counter,Number and largest=-1.Here Counter is use to keep count of input number.largest to store the largest input so far.And Number to read inout from user.Find and print largest after each input.
Output:
enter 10 non-negative numbers:24
largest found so far is: 24
12
56
largest found so far is: 56
9
8
67
largest found so far is: 67
33
56
98
largest found so far is: 98
100
largest found so far is: 100
________ is when the sequence of instruction is guaranteed to execute as a group, or not execute at all, having no visible effect on system state.
Answer: Atomic operations
Explanation: Atomic operations are the process in which are related with the programs which execute in the independent manner and having no relation with other processes or functions.
It is helpful operation in the parallel processing system.The operation assures about being carried out at rapid rate and do not face any deadlock during execution.This does not alter the rate of the system.
Which of the following commands contains an error?
Question 2 options:
CREATE vehicletype (carid INTEGER PRIMARY KEY, typeofvehicle TEXT, manufacturer TEXT, year INTEGER);
INSERT INTO vehicletype VALUES (1,"truck","Ford",2000);
SELECT * FROM vehicletype;
Answer:
The very first command contains an error.
Explanation:
The create query is used to create the table in the database. The syntax of the create query is :
create table tablename(column1 datatype,column2 datatype ........columnn datatype);
So there is a keyword table is missing in the given query. so it is incorrect query.
INSERT INTO vehicletype VALUES (1,"truck","Ford",2000); This query is correct.
SELECT * FROM vehicletype; This query is also correct.
The expression that is tested by a switch statement must have a(n) __________ value.
Final answer:
The expression evaluated by a switch statement must have a discrete value, which allows it to be compared with a set of predefined case values. Typically, the switch statement works with integral or enumerated types, and sometimes strings, in various programming languages.
Explanation:
The expression that is tested by a switch statement must have a discrete value. This means that the expression must evaluate to a single value that can be checked against a series of case values. In programming languages like Java or C++, the switch statement typically works with discrete, integral values like integers or enumerated types, and in some languages, it also works with strings. The switch statement then executes the code block associated with the first case that matches the value of the expression, providing a cleaner and more efficient alternative to a lengthy series of if-else statements.
For example, consider a switch statement that evaluates a variable representing a day of the week:
int day = 3;switch (day) { case 1: ... // Code for Monday case 2: ... // Code for Tuesday case 3: ... // Code for Wednesday}Here, the switch statement will execute the code block associated with case 3, since the value of day is 3. The key here is that the value of the expression (the variable 'day' in this example) must be discrete so that it can be compared against the case labels.
Final answer:
A switch statement requires a "discrete value" for its expression, and is used to control the flow of execution in a program. A break statement is often used to exit the switch after a match is found, following the evaluation of a boolean condition.
Explanation:
The expression that is tested by a switch statement must have a discrete value. A switch statement allows for multiple tests to be conducted to determine the proper course of action. It is typically used when you have several if statements that apply to the same variable or when there are multiple nested logic statements that control the flow of the code.
In a switch statement, each case is tested in sequence until a match is found or the end of the switch is reached. To prevent the execution from continuing through subsequent cases, a break statement is often used. The condition in the switch statement that selects the branch is called a condition.
It is important to note that the alternatives in the switch statement are referred to as branches. These branches represent different paths the program's execution can take. Each branch is contingent upon a condition, which is the boolean expression that determines which path is executed. If the condition for a case is true, that branch is executed.