Answer:
An input size of N = 128 makes the algorithm run for 14 milliseconds
Explanation:
O(log2N)
This means that the running time for an algorithm of length N is given by:
[tex]F(N) = c\log_{2}{N}[/tex]
In which C is a constant.
Runs for 10 milliseconds when the input size (N) is 32.
This means that [tex]F(32) = 10[/tex]
So
[tex]F(N) = c\log_{2}{N}[/tex]
[tex]10 = c\log_{2}{32}[/tex]
Since [tex]2^5 = 32, \log_{2}{32} = 5[/tex]
Then
[tex]5c = 10[/tex]
[tex]c = \frac{10}{5}[/tex]
[tex]c = 2[/tex]
Thus:
[tex]F(N) = 2\log_{2}{N}[/tex]
What input size makes the algorithm run for 14 milliseconds
N for which [tex]F(N) = 14[/tex]. So
[tex]F(N) = 2\log_{2}{N}[/tex]
[tex]14 = 2\log_{2}{N}[/tex]
[tex]\log_{2}{N} = 7[/tex]
[tex]2^{\log_{2}{N}} = 2^7[/tex]
[tex]N = 128[/tex]
An input size of N = 128 makes the algorithm run for 14 milliseconds
what is the process by which we can control what parts of a program can acccess the members of class
Answer:
Encapsulation.
Explanation:
Information hiding involves using private fields within classes and it's a feature found in all object-oriented languages such as Java, Python, C#, Ruby etc.
In object-oriented programming language, a process known as encapsulation is used for the restrictions of the internal data of a software program from the outside code, therefore preventing an unauthorized direct access to the codes. This is achieved through the use of classes.
In Computer programming, class members can be defined as the members of a class that typically represents or indicates the behavior and data contained in a class.
Basically, the members of a class are declared in a class, as well as all classes in its inheritance hierarchy except for destructors and constructors.
In a class, member variables are mainly known as its attributes while its member function are seldomly referred to as its methods or behaviors.
One of the main benefits and importance of using classes is that classes helps to protect and safely guard their member variables and methods by controlling access from other objects.
Therefore, the class members which should be declared as public are methods and occasionally final attributes because a public access modifier can be accessed from anywhere such as within the current or external assembly, as there are no restrictions on its access.
Long Answer Questions: a. Briefly explain the types of Control Structures in QBASIC.
Answer:
The three basic types of control structures are sequential, selection and iteration. They can be combined in any way to solve a specified problem. Sequential is the default control structure, statements are executed line by line in the order in which they appear.
what is a mirror site?
Assign courseStudent's name with Smith, age with 20, and ID with 9999. Use the print member function and a separate cout statement to output courseStudents's data. End with a newline. Sample output from the given program:
#include
#include
using namespace std;
class PersonData {
public:
void SetName(string userName) {
lastName = userName;
};
void SetAge(int numYears) {
ageYears = numYears;
};
// Other parts omitted
void PrintAll() {
cout << "Name: " << lastName;
cout << ", Age: " << ageYears;
};
private:
int ageYears;
string lastName;
};
class StudentData: public PersonData {
public:
void SetID(int studentId) {
idNum = studentId;
};
int GetID() {
return idNum;
};
private:
int idNum;
};
int main() {
StudentData courseStudent;
/* Your solution goes here */
return 0;
}
Answer:
Replace /* Your solution goes here */
with the following:
courseStudent.SetName("Smith");
courseStudent.SetAge(20);
courseStudent.SetID(9999);
courseStudent.PrintAll();
cout <<courseStudent.GetID();
Explanation:
From the given code segment, we have the following methods defined under the StudentData class;
SetName -> It receives name from the main
SetAge -> It receives age from the main
SetID --> It receives ID from the main and passes it to GetID method
printID --> Prints all the required output.
So, we have:
Pass name to setName
courseStudent.SetName("Smith");
Pass age to setAge
courseStudent.SetAge(20);
Pass ID to setID
courseStudent.SetID(9999);
Print all necessary outputs
courseStudent.PrintAll();
Manually print the student ID
cout <<courseStudent.GetID();
how an operating system allocates system resources in a computer
Answer:
The Operating System allocates resources when a program need them. When the program terminates, the resources are de-allocated, and allocated to other programs that need them
write short note on the following: Digital computer, Analog Computer and hybrid computer
Answer:
Hybrid Computer has features of both analogue and digital computer. It is fast like analogue computer and has memory and accuracy like digital computers. It can process both continuous and discrete data. So it is widely used in specialized applications where both analogue and digital data is processed.
Analyze the following code:
// Enter an integer Scanner input = new Scanner(System.in);
int number = input.nextInt(); if (number <= 0) System.out.println(number);
1) The if statement is wrong, because it does not have the else clause;
2) System.out.println(number); must be placed inside braces;
3) If number is zero, number is displayed;
4) If number is positive, number is displayed.
5) number entered from the input cannot be negative.
Answer:
3) If number is zero, number is displayed;
Explanation:
The code snippet created is supposed to take any input number from the user (positive or negative) and print it to the console if it is less than 0. In this code the IF statement does not need an else clause and will work regardless. The System.out.println() statement does not need to be inside braces since it is a simple one line statement. Therefore, the only statement in the question that is actually true would be ...
3) If number is zero, number is displayed;
Answer:
If number is zero, number is displayed
Explanation:
Given
The above code segment
Required
What is true about the code segment
Analyzing the options, we have:
(1) Wrong statement because there is no else clause
The above statement is not a requirement for an if statement to be valid; i.e. an if statement can stand alone in a program
Hence, (1) is false
(2) The print statement must be in { }
There is only one statement (i.e. the print statement) after the if clause. Since the statement is just one, then the print statement does not have to be in {} to be valid.
Hence, (2) is false
(3) number is displayed, if input is 0
In the analysis of the program, we have: number <=0
i.e. the if statement is true for only inputs less than 0 or 0.
Hence, number will be printed and (3) is false
(4) number is displayed for positive inputs
The valid inputs have been explained in (3) above;
Hence, (4) is false.
(5) is also false
Jessica sees a search ad on her mobile phone for a restaurant. A button on the ad allows Jessica to click on the button and call the restaurant. This is a(n) Group of answer choices product listing ad (PLA) dynamic keyword insertion ad (DKI) click-to-call ad call-to-action ad (CTA)
It’s a click-to-call ad
A security administrator currently spends a large amount of time on common security tasks, such aa report generation, phishing investigations, and user provisioning and deprovisioning This prevents the administrator from spending time on other security projects. The business does not have the budget to add more staff members.
Which of the following should the administrator implement?
A. DAC
B. ABAC
C. SCAP
D. SOAR
Answer: SOAR
Explanation:
SOAR (security orchestration, automation and response) refers to compatible software programs wfuvg allows an organization to collect data that has to do with security threats and also enables them respond to security events without the needs of a human assistance.
Since the administrator doesn't have time on other security projects, the SOAR will be vital in this regard.
Complete the implementation of the following methods:__init__hasNext()next()getFirstToken()getNextToken()nextChar()skipWhiteSpace()getInteger()
From method names, I am compelled to believe you are creating some sort of a Lexer object. Generally you implement Lexer with stratified design. First consumption of characters, then tokens (made out of characters), then optionally constructs made out of tokens.
Hope this helps.
Suppose that a queue is implemented using a circular array of size 12. What is the value of last after the following operations?
10 enqueue operations
5 dequeue operations
6 enqueue operations
10 dequeue operations
8 enqueue operations
2 dequeue operations
3 enqueue operations
Last = 10
Answer:
10
Explanation:
An enqueue operation is a function that adds an element(value) to a queue array. A dequeue operations removes an element from a queue array. Queue arrays follow a first-in-first-out approach, so elements that are first stored in the queue are removed/accessed first(enqueue operations add elements at the rear of the queue array).
The following operations leave 10 elements in the queue of array size 12 after its done:
10 enqueue operations= adds 10 elements
5 dequeue operations= removes 5 elements( 5 elements left in queue)
6 enqueue operations= adds 6 elements(11 elements in queue)
10 dequeue operations= removes 10 elements(1 element left in queue)
8 enqueue operations= adds 8 elements(9 elements in queue)
2 dequeue operations= removes 2 elements(7 elements left in queue)
3 enqueue operations= adds 3 elements(10 elements in queue)
Therefore there are 10 elements in the queue after enqueue and dequeue operations.
When she manages a software development project, Candace uses a program called __________, because it supports a number of programming languages including C, C , C
Answer:
PLS programming language supporting.
Explanation:
When she manages a software development project, Candace uses a program called PLS programming language supporting.
What is a software development project?Software development project is the project that is undertaken by the team of experts that developed through different format of coding language. The software development has specific time, budget, and resources.
Thus, it is PLS programming language
For more details about Software development project, click here:
https://brainly.com/question/14228553
#SPJ2
Register the countChars event handler to handle the keydown event for the textarea tag. Note: The function counts the number of characters in the textarea.
Do not enter anything in the HTML file, put your code in the JavaScript section where it says "Your solution goes here"
1 klabel for-"userName">user name: 2
3
Answer:
Explanation:
The following Javascript code is added in the Javascript section where it says "Your solution goes here" and counts the current number of characters in the text within the textArea tag. A preview can be seen in the attached image below. The code grabs the pre-created variable textareaElement and attached the onkeypress event to it. Once a key is pressed it saves the number of characters in a variable and then returns it to the user.
var textareaElement = document.getElementById("userName");
function textChanged(event) {
document.getElementById("stringLength").innerHTML = event.target.value.length;
}
// Your solution goes here
textareaElement.onkeypress = function() {
let numOfCharacters = textareaElement.value.length;
return numOfCharacters;
};
Define a class named Point with two data fields x and y to represent a point's x- and y-coordinates. Implement the Comparable interface for the comparing the points on x-coordinates. If two points have the same x-coordinates, compare their y-coordinates. Define a class named CompareY that implements Comparator. Implement the compare method to compare two points on their y-coordinates. If two points have the same y-coordinates, compare their x-coordinates. Randomly create 100 points and apply the Arrays.sort method to display the points in increasing order of their x-coordinates, and increasing order of their y-coordinates, respectively.
Answer:
Here the code is given in java as follows,
what operation can be performed using the total feature
They can do different surgery on people. One is called cataract total and hip replacement surgery which is what can be expected
Cardinality ratios often dictate the detailed design of a database. The cardinality ratio depends on the real-world meaning of the entity types involved and is defined by the specific application. For the binary relationships below, suggest cardinality ratios based on the common-sense meaning of the entity types. Clearly state any assumptions you make.
Entity 1 Cardinality Ratio Entity 2
1. Student SocialSecurityCard
2. Student Teacher
3. ClassRoom Wall
4. Country CurrentPresident
5. Course TextBook
6. Item (that can
be found in an
order) Order
7. Student Class
8. Class Instructor
9. Instructor Office
10. E-bay Auction item E-bay bid
Solution :
ENTITY 1 CARDINALITY RATIO ENTITY 2
1. Student 1 to many Social security card
A student may have more than one
social security card (legally with the
same unique social security number),
and every social security number belongs
to a unique.
2. Student Many to Many Teacher
Generally students are taught by many
teachers and a teacher teaches many students.
3.ClassRoom Many to Many Wall
Do not forget that the wall is usually
shared by adjacent rooms.
4. Country 1 to 1 Current President
Assuming a normal country under normal
circumstances having one president at a
time.
5. Course Many to Many TextBook
A course may have many textbooks and
text book may be prescribed for different
courses.
6. Item Many to Many Order
Assuming the same item can appear
in different orders.
7. Student Many to Many Class
One student may take several classes.
Every class usually has several students.
8. Class Many to 1 Instructor
Assuming that every class has a unique
instructor. In case instructors were allowed
to team teach, this will be many-many.
9. Instructor 1 to 1 Office
Assuming every instructor has only one
office and it is not shared. In case of offices
shared by 2 instructors, the relationship
will be 2-1. Conversely, if any instructor has a joint
appointment and offices in both departments,
then the relationship will be 1-2. In a very general
case, it may be many-many.
10. E-bay Auction item 1-Many E-bay bid
1 item has many bids and a bid is unique
to an item.
Fill in multiple blanks for [x], [y], [z]. Consider a given TCP connection between host A and host B. Host B has received all from A all bytes up to and including byte number 2000. Suppose host A then sends three segments to host B back-to-back. The first, second and third segments contain 50, 600 and 100 bytes of user data respectively. In the first segment, the sequence number is 2001, the source port number is 80, and the destination port number is 12000. If the first segment, then third segment, then second segment arrive at host B in that order, consider the acknowledgment sent by B in response to receiving the third segment. What is the acknowledgement number [x], source port number [y] and destination port number [z] of that acknowledgement
____________________ are designed according to a set of constraints that shape the service architecture to emulate the properties of the World Wide Web, resulting in service implementations that rely on the use of core Web technologies (described in the Web Technology section).
Answer: Web services
Explanation:
Web service refers to a piece of software which uses a XML messaging system that's standardized and makes itself available over the internet.
Web services provides standardized web protocols which are vital for communication and exchange of data messaging throughout the internet.
They are are designed according to a set of constraints which help in shaping the service architecture in order to emulate the properties of the World Wide Web.
Answer:
The correct approach is "REST Services".
Explanation:
It merely offers accessibility to commodities as well as authorization to REST customers but also alters capabilities or sources.
With this technique, all communications are generally assumed to be stateless. It, therefore, indicates that the REST resource actually may keep nothing between runs, which makes it useful for cloud computing.discuss the first three phases of program development cycle
Answer:
Known as software development life cycle, these steps include planning, analysis, design, development & implementation, testing and maintenance.
Write a program in c++ that will:1. Call a function to input temperatures for consecutive days in 1D array. NOTE: The temperatures will be integer numbers. There will be no more than 10 temperatures.The user will input the number of temperatures to be read. There will be no more than 10 temperatures.2. Call a function to sort the array by ascending order. You can use any sorting algorithm you wish as long as you can explain it.3. Call a function that will return the average of the temperatures. The average should be displayed to two decimal places.Sample Run:Please input the number of temperatures to be read5Input temperature 1:68Input temperature 2:75Input temperature 3:36Input temperature 4:91Input temperature 5:84Sorted temperature array in ascending order is 36 68 75 84 91The average temperature is 70.80The highest temperature is 91.00The lowest temperature is 36.00
Answer:
The program in C++ is as follows:
#include <iostream>
#include <iomanip>
using namespace std;
int* sortArray(int temp [], int n){
int tmp;
for(int i = 0;i < n-1;i++){
for (int j = i + 1;j < n;j++){
if (temp[i] > temp[j]){
tmp = temp[i];
temp[i] = temp[j];
temp[j] = tmp; } } }
return temp;
}
float average(int temp [], int n){
float sum = 0;
for(int i = 0; i<n;i++){
sum+=temp[i]; }
return sum/n;
}
int main(){
int n;
cout<<"Number of temperatures: "; cin>>n;
while(n>10){
cout<<"Number of temperatures: "; cin>>n; }
int temp[n];
for(int i = 0; i<n;i++){
cout<<"Input temperature "<<i+1<<": ";
cin>>temp[i]; }
int *sorted = sortArray(temp, n);
cout<<"The sorted temperature in ascending order: ";
for( int i = 0; i < n; i++ ) { cout << *(sorted + i) << " "; }
cout<<endl;
float ave = average(temp,n);
cout<<"Average Temperature: "<<setprecision(2)<<ave<<endl;
cout<<"Highest Temperature: "<<*(sorted + n - 1)<<endl;
cout<<"Lowest Temperature: "<<*(sorted + 0)<<endl;
return 0;
}
Explanation:
See attachment for complete source file with explanation
A _____ is a systematic and methodical evaluation of the exposure of assets to attackers, forces of nature, or any other entity that is a potential harm.
Answer:
Vulnerability assessment
Explanation:
Cyber security can be defined as preventive practice of protecting computers, software programs, electronic devices, networks, servers and data from potential theft, attack, damage, or unauthorized access by using a body of technology, frameworks, processes and network engineers.
Some examples of cyber attacks are phishing, zero-day exploits, denial of service, man in the middle, cryptojacking, malware, SQL injection, spoofing etc.
A vulnerability assessment is a systematic and methodical evaluation used by network security experts to determine the exposure of network assets such as routers, switches, computer systems, etc., to attackers, forces of nature, or any other entity that is capable of causing harm i.e potential harms. Thus, vulnerability assessment simply analyzes and evaluate the network assets of an individual or business entity in order to gather information on how exposed these assets are to hackers, potential attackers, or other entities that poses a threat.
Being the Sales Manager of a company you have to hire more salesperson for the company to expand the sales territory. Kindly suggest an effective Recruitment and Selection Process to HR by explaining the all the stages in detail.
Answer:
1. Identification of a vacancy and development of the job description.
2. Recruitment planning
3. Advertising
4. Assessment and Interview of applicants
5. Selection and Appointment of candidates
6. Onboarding
Explanation:
The Recruitment process refers to all the stages in the planning, assessment, and absorption of candidates in an organization. The stages involved include;
1. Identification of a vacancy and development of the job description: This is the stage where an obvious need in the organization is identified and the duties of the job requirement are stipulated.
2. Recruitment planning: This is the stage where the HR team comes together to discuss the specific ways they can attract qualified candidates for the job.
3. Advertising: The HR team at this point seeks out job sites, newspapers, and other platforms that will make the opportunities accessible to applicants.
4. Assessment and Interview of applicants: Assessments are conducted to gauge the candidates' knowledge and thinking abilities. This will provide insight into their suitability for the job.
5. Selection and Appointment of candidates: Successful candidates are appointed to their respective positions. A letter of appointment is given.
6. Onboarding: Candidates are trained and guided as to the best ways of discharging their duties.
A cashier distributes change using the maximum number of five-dollar bills, followed by one-dollar bills. Write a single statement that assigns num_ones with the number of distributed one-dollar bills given amount_to_change. Hint: Use %.
Sample output with input: 19
Change for $ 19
3 five dollar bill(s) and 4 one dollar bill(s)
1 amount_to_change = int(input())
2
3 num_fives amount_to_change // 5
4
5 Your solution goes here
6 I
7 print('Change for $, amount_to_change)
8 print(num_fives, 'five dollar bill(s) and', num_ones, 'one dollar bill (s)')
Answer:
Explanation:
The code that was provided in the question contained a couple of bugs. These bugs were fixed and the new code can be seen below as well as with the solution for the number of one-dollar bills included. The program was tested and the output can be seen in the attached image below highlighted in red.
amount_to_change = int(input())
num_fives = amount_to_change // 5
#Your solution goes here
num_ones = amount_to_change % 5
print('Change for $' + str(amount_to_change))
print(num_fives, 'five dollar bill(s) and', num_ones, 'one dollar bill (s)')
Una persona decide comprar un número determinado de quintales de azúcar, ayúdele a presentar el precio de venta al público por libra, considerando un 25% de utilidad por cada quintal.
In C language
In a main function declare an array of 1000 ints. Fill up the array with random numbers that represent the rolls of a die.
That means values from 1 to 6. Write a loop that will count how many times each of the values appears in the array of 1000 die rolls.
Use an array of 6 elements to keep track of the counts, as opposed to 6 individual variables.
Print out how many times each value appears in the array. 1 occurs XXX times 2 occurs XXX times
Hint: If you find yourself repeating the same line of code you need to use a loop. If you declare several variables that are almost the same, maybe you need to use an array. count1, count2, count3, count4, … is wrong. Make an array and use the elements of the array as counters. Output the results using a loop with one printf statement. This gets more important when we are rolling 2 dice.
Answer:
The program in C is as follows:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(){
int dice [1000];
int count [6]={0};
srand(time(0));
for (int i = 0; i < 1000; i++) {
dice[i] = (rand() %(6)) + 1;
count[dice[i]-1]++;
}
for (int i = 0; i < 6; i++) {
printf("%d %s %d %s",(i+1)," occurs ",count[i]," times");
printf("\n");
}
return 0;
}
Explanation:
This declares an array that hold each outcome
int dice [1000];
This declares an array that holds the count of each outcome
int count [6]={0};
This lets the program generate different random numbers
srand(time(0));
This loop is repeated 1000 times
for (int i = 0; i < 1000; i++) {
This generates an outcome between 1 and 6 (inclusive)
dice[i] = (rand() %(6)) + 1;
This counts the occurrence of each outcome
count[dice[i]-1]++; }
The following prints the occurrence of each outcome
for (int i = 0; i < 6; i++) {
printf("%d %s %d %s",(i+1)," occurs ",count[i]," times");
printf("\n"); }
Which of the following financial functions can you use to calculate the payments to repay your loan
Answer:
PMT function. PMT, one of the financial functions, calculates the payment for a loan based on constant payments and a constant interest rate. Use the Excel Formula Coach to figure out a monthly loan payment.
Explanation:
feature of word processing
Answer:
the word processing
Explanation:
the word is a good word
Write a recursive function that returns 1 if an array of size n is in sorted order and 0 otherwise. Note: If array a stores 3, 6, 7, 7, 12, then isSorted(a, 5) should return 1 . If array b stores 3, 4, 9, 8, then isSorted(b, 4) should return 0.
Answer:
The function in C++ is as follows:
int isSorted(int ar[], int n){
if ([tex]n == 1[/tex] || [tex]n == 0[/tex]){
return 1;}
if ([tex]ar[n - 1][/tex] < [tex]ar[n - 2][/tex]){
return 0;}
return isSorted(ar, n - 1);}
Explanation:
This defines the function
int isSorted(int ar[], int n){
This represents the base case; n = 1 or 0 will return 1 (i.e. the array is sorted)
if ([tex]n == 1[/tex] || [tex]n == 0[/tex]){
return 1;}
This checks if the current element is less than the previous array element; If yes, the array is not sorted
if ([tex]ar[n - 1][/tex] < [tex]ar[n - 2][/tex]){
return 0;}
This calls the function, recursively
return isSorted(ar, n - 1);
}
How can I pass the variable argument list passed to one function to another function.
Answer:
Explanation:
#include <stdarg.h>
main()
{
display("Hello", 4, 12, 13, 14, 44);
}
display(char *s,...)
{
va_list ptr;
va_start(ptr, s);
show(s,ptr);
}
show(char *t, va_list ptr1)
{
int a, n, i;
a=va_arg(ptr1, int);
for(i=0; i<a; i++)
{
n=va_arg(ptr1, int);
printf("\n%d", n);
}
}
Assume myString and yourString are variables of type String already declared and initialized. Write ONE line of code that sets yourString to the first character and the last character of myString added to myString variable.
Answer:
line of code :
newString=myString+myString.charAt(0)+myString.charAt(myString.length()-1);
Explanation:
In Java, the + is used for concatenation
method
charAt() will return the character from the given index from string
myString.charAt(0) will return E
myString.charAt(myString.length()-1)