Answer: it is the code it is wrong
Explanation:
/* missing precondition */
public String getChar(String str, int n) {
return str.substring(n, n 1); }
Write down the most appropriate precondition for the method so that it does not throw an exception.
Answer:
An appropriate precondition is:
0 <= n && n <= str.length() - 1
Explanation:
Required:
Write down an appropriate pre-condition for the program
From the question, we understand that the method accepts two parameters:
str -> A string value
n -> An integer value which represents the index of character to return from the string str
It should be noted that:
n must be within the range of 0 and str.length()-1
Take for instance:
str = "ABCDE";
n must be within the range 0 to 4 (inclusive) in order not to raise an exception. This is so because the string index starts at 0 and stops at 1 less than the length of the string.
Hence, the precondition can be written as:
0 <= n && n <= str.length() - 1
Which means: n = 0 to length - 1
If you wanted to help your phone , a nonliving thing , perform the process of life which is to gain energy which would be the best description of what to do ?
Help
Answer:
d. plug it into the charger.
Explanation:
If you are working in a word-processing program and need to learn about its features, the best place to get assistants is from the ________.
A. application's help menu
B. desktop
C. toolbar
D. start menu
Answer:
A
Explanation:
plz mark me brainlies
Answer:
A. Application's help menu
Explanation:
Identify the correct characteristics of Python lists. Check all that apply. Python lists are enclosed in curly braces { }. Python lists contain items separated by commas. Python lists are versatile Python data types. Python lists may use single quotes, double quotes, or no quotes.
Answer:
Python lists contain items separated by commas.
Python lists are versatile Python data types.
Python lists may uses single quotes, double quotes, or no quotes.
Explanation:
Python Lists are enclosed in regular brackets [ ], not curly brackets { }, so this is not a correct characteristic.
Answer:
a c d
Explanation:
A technician who is managing a secure B2B connection noticed the connection broke last night. All networking equipment and media are functioning as expected, which leads the technician to question certain PKI components. Which of the following should the technician use to validate this assumption? (Choose two)
a. PEM
b. CER
c. SCEP
d. CRL
e. OCSP
f. PFX
Answer:
d. CRL
e. OCSP
Explanation:
Note, the term PKI stands for Public Key Infrastructure.
Among all the PKI components, the CRL (CERTIFICATE REVOCATION LISTS), which contains a list of issued certificates that were later revoked by a given Certification Authority, and the PFX format used for storing server certificates should be examined by the technician use to validate his assumption.
The measure of software complexity that measure how complex a software is in machine's viewpoint in terms of how the size of the input data affects an algorithm's usage of computational resources is known as Computational Complexity.
a. True
b. False
Answer:
a. True
Explanation:
In Computer science, an algorithm can be defined as a standard formula or procedure which comprises of set of finite steps or instructions for solving a problem on a computer.
Basically, the time complexity of an algorithm is defined by f(n) if; for all "n" and all inputs with length "n" the execution of the algorithm takes a maximum of f(n) steps. Therefore, this is a measure of the efficiency of an algorithm.
Hence, the time complexity is a measure of the amount of time required by an algorithm to run till its completion of the task with respect to the length of the inpu
Computational complexity can be defined as a measure of software complexity that measure how complex a software is in machine's viewpoint in terms of how the size of the input data affects an algorithm's usage of computational resources such as memory or running time.
Write a program to insert an array of letters (word), then arrange the letters in ascending order and print this array after the arrangement.
Answer:
def split(word):
return [char for char in word]
word = input("Enter a word: ")
chars = split(word)
chars.sort()
sorted = ''.join(chars)
print(sorted)
Explanation:
Here is a python solution.
what is the significance of the following terms A A L U control unit in the CPU
Answer:
Explanation:
The function of ALU is to perform arithmetic operations(add,subtract, multiply,division) as well as logical operations(compare values).
The function of CU is to control and coordinate the activities of the computer.
can you answer this question?
Answer:
The SIZE constant is not definedThe variable i should be defined at the start of the function, not within the condition of the while loopThe main function returns no value. Generally they should return a zero on success.The printf text "%d" should actually be "%f". %d treats the variable as though it's an integer.
1.16 LAB: Input and formatted output: House real estate summary Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two inputs, current price and last month's price (both integers). Then, output a summary listing the price, the change since last month, and the estimated monthly mortgage computed as (currentPrice * 0.051) / 12 (Note: Output directly. Do not store in a variable.).
Ex: If the input is:
200000 210000
the output is:
This house is $200000. The change is $-10000 since last month.
The estimated monthly mortgage is $850.0.
Note: Getting the precise spacing, punctuation, and newlines exactly right is a key point of this assignment. Such precision is an important part of programming.
import java.util.Scanner;
public class LabProgram {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int currentPrice;
int lastMonthsPrice;
currentPrice = scnr.nextInt();
lastMonthsPrice = scnr.nextInt();
/* Type your code here. */
}
Answer:
Please find the complete code and the output in the attachement.
Explanation:
In the code, a class "LabProgram" is defined, and inside the main method two integer variable "currentPrice and lastMonthsPrice" is defined that uses the scanner class object is used for a user input value, and in the next step, two print method is declared that print the calculate of the integer variable.
The program is an illustration of output formats in Java
The statements that complete the program are:
System.out.printf("This house is $%d. The change is $%d since last month.\n",currentPrice,(currentPrice - lastMonthsPrice));System.out.printf("The estimated monthly mortgage is $%.1f.\n",(currentPrice * 0.051)/12);To format outputs in Java programming language, we make use of the printf statement, followed by the string literal that formats the required output
Take for instance:
To output a float value to 2 decimal place, we make use of the literal "%.2f"
Read more about Java programs at:
https://brainly.com/question/25458754
ve phenotypk percentages of the offspring
Write a constructor for BaseballPlayer. The constructor takes three int parameters: numHits, numRuns, and numRBIs storing the values within the class' ArrayList field named playerStats.
Answer:
Following are the code to the given question:
public class BaseballPlayer//defining a class BaseballPlayer
{
BaseballPlayer(int numHits, int numRuns, int numRBIs)//defining a parameterized cons
{
}
}
Explanation:
Some of the data is missing, which is why the solution can be represented as follows:
In this code, a class BaseballPlayer is defined, and inside the class a parameterized constructor is defined that holds three integer variable "numHits, numRuns, and numRBIs".
Describe an example of a very poorly implemented database that you've encountered (or read about) that illustrates the potential for really messing things up. Include, in your description, an analysis of what might have caused the problems and potential solutions to them. Be sure to provide citations from the literature.
Design a flowchart for an algorithm which adds prim numbers starting from 1 up to 50. Change
the flow chart to a pseudocode.
Answer:
Explanation:. ALGORITHM AND FLOW CHART. 1.1 Introduction. 1.2 Problem Solving ... money. After knowing the balance in his account, he/she decides to with draw the ... change it to a sports channel, you need to do something i.e. move to that channel by ... Problem4: Design an algorithm with a natural number, n, as its input which.
Consider the following method, inCommon, which takes two Integer ArrayList parameters. The method returns true if the same integer value appears in both lists at least one time, and false otherwise.
public static boolean inCommon(ArrayList a, ArrayList b)
{
for (int i = 0; i < a.size(); i++)
{
for (int j = 0; j < b.size(); j++) // Line 5
{
if (a.get(i).equals(b.get(j)))
{
return true;
}
}
}
return false;
}
Which of the following best explains the impact to the inCommon method when line 5 is replaced by for (int j = b.size() - 1; j > 0; j--) ?
A. The change has no impact on the behavior of the method.
B. After the change, the method will never check the first element in list b.
C. After the change, the method will never check the last element in list b.
D. After the change, the method will never check the first and the last elements in list b.
E. The change will cause the method to throw an IndexOutOfBounds exception.
Answer:
The answer is "Option b".
Explanation:
In the given code, a static method "inCommon" is declared, that accepts two array lists in its parameter, and inside the method two for loop is used, in which a conditional statement used, that checks element of array list a is equal to the element of array list b. If the condition is true it will return the value true, and if the condition is not true, it will return a false value. In this, the second loop is not used because j>0 so will never check the element of the first element.
can you answer this question?
Answer:
To do this you'll need to use malloc to assign memory to the pointers used. You'll also need to use free to unassign that memory at the end of the program using the free. Both of these are in stdlib.h.
#include <stdlib.h>
#include <stdio.h>
#define SIZE_X 3
#define SIZE_Y 4
int main(void){
int **matrix, i, j;
// allocate the memory
matrix = (int**)malloc(SIZE_X * sizeof(int*));
for(i = 0; i < SIZE_X; i++){
matrix[i] = (int *)malloc(SIZE_Y * sizeof(int));
}
// assign the values
for(i = 0; i < SIZE_X; i++){
for(j = 0; j < SIZE_Y; j++){
matrix[i][j] = SIZE_Y * i + j + 1;
}
}
// print it out
for(i = 0; i < SIZE_X; i++){
for(j = 0; j < SIZE_X; j++){
printf("%d, %d: %d\n", i, j, matrix[i][j]);
}
}
// free the memory
for(i = 0; i < SIZE_X; i++){
free(matrix[i]);
}
free(matrix);
return 0;
}
Which function in Excel tells how many numeric entries are ther
Answer:The answer is given below:
Explanation:
Count function is used to get the number of entries in Excel.
There is a specific formula for it to count the entries.
The formula is A1:A20: =COUNT(A1:A20.
It is also used to find the data in the following cells.
The values et return to the cell argument.
There can be individual items or in a cluster.
First, we select the blank cell and then use the formula.
Write a method named numUnique that accepts a sorted array of integers as a parameter and that returns the number of unique values in the array. The array is guaranteed to be in sorted order, which means that duplicates will be grouped together. For example, if a variable called list stores the following values: int[] list
Answer:
The method in Java is as follows:
public static int numUnique(int list[]) {
int unique = 1;
for (int i = 1; i < list.length; i++) {
int j = 0;
for (j = 0; j < i; j++) {
if (list[i] == list[j])
break;
}
if (i == j)
unique++;
}
return unique;
}
Explanation:
This line defines the numUnique method
public static int numUnique(int list[]) {
This initializes the number of unique elements to 1
int unique = 1;
This iterates through the list
for (int i = 1; i < list.length; i++) {
The following iteration checks for unique items
int j = 0;
for (j = 0; j < i; j++) {
if (list[i] == list[j]) If current element is unique, break the iteration
break;
}
if (i == j)
unique++;
}
This returns the number of unique items in the list
return unique;
}
Any1??
Write the names of atleast 22 high-level programming languages
Answer:
1 Array languages
2 Assembly languages
3 Authoring languages
4 Constraint programming languages
5 Command line interface languages
6 Compiled languages
7 Concurrent languages
8 Curly-bracket languages
9 Dataflow languages
10 Data-oriented languages
11 Decision table languages
12 Declarative languages
13 Embeddable languages
13.1 In source code
13.1.1 Server side
13.1.2 Client side
13.2 In object code
14 Educational languages
15 Esoteric languages
16 Extension languages
17 Fourth-generation languages
18 Functional languages
18.1 Pure
18.2 Impure
19 Hardware description languages
19.1 HDLs for analog circuit design
19.2 HDLs for digital circuit design
20 Imperative languages
21 Interactive mode languages
22 Interpreted languages
23 Iterative languages
Explanation:
Conside following prototype of a function
int minArray(int [], int );
Which of the option is correct way of function CALL assuming following arraydeclaration
int x[5] = {7,4,6,2,3};*
a) minArray(x,5);
b) minArray(x[],10);
c) minArray(x[5],5);
d) minArray(5,x);
Answer:
The answer is "Option a"
Explanation:
Following are the code to this question:
#include <stdio.h>//header file
int minArray(int x[], int n)//defining method minArray that accepts two parameters
{
for(int i=0;i<n;i++)//defining loop for print value
{
printf("%d\n",x[i]);//printf array value
}
}
int main()//defining main method
{
int x[] ={7,4,6,2,3};//defining array that hold values
int n=5;//defining integer variable
minArray(x,5);//calling method minArray
return 0;
}
In this code, a method "minArray" is defined, that accepts two parameters array and an integer variable in its parameter, and in the next step, the for loop is declared, that uses the print method to prints its value.
In the next step, the main method is declared, which declared an array and holds its values and defines an integer variables, and calls the method "minArray".
Are chairs and tables considered technology?
A) true
B) false
Answer:true
Explanation:
By definition technology is the skills methods and processes used to achieve goals
Chairs and tables are considered technology. The given statement is True.
A comfortable ergonomic office chair lessens the chronic back, hip, and leg pain brought on by prolonged sitting. Employees are able to operate more effectively and productively as a result. Another advantage is a decrease in medical costs associated with poor posture brought on by uncomfortable workplace chairs.
How does technology make your life comfortable?
They can perform their tasks more easily and independently thanks to technology. They feel more empowered, certain, and positive as a result. Many people can benefit greatly from technology. It goes beyond simply being "cool." The most recent technologies can also simplify life.
Among other major technologies, 3D modeling, virtual reality, augmented reality, and touch commerce has an impact on the design and production of furniture. Before actual furniture is built on the ground, it is possible to virtually create it using 3D or three-dimensional modeling.
Thus, Technology includes things like chairs and tables. The assertion is accurate.
Learn more about technology here:
https://brainly.com/question/9171028
#SPJ2
Difference between analog and digital computer ??
Answer:
The analogue computer works on a continuous signal. The digital computer works on a discrete signal. The output is a voltage signal, they are not exact values and are in graphical form.
Adding a paper clip to the vertical stabilizer of your glider will have what effect on its Center of Gravity (CG)?
The CG would move toward the rear.
The CG would stay the same.
The CG would move toward the nose.
O The CG would move lower
Answer:
the CG would move toward the rear.
Explanation:
Adding a paper clip to the vertical stabilizer of your glider will, the CG would move toward the rear. The correct option is A.
What is center of gravity?The place on an item where the force of gravity is thought to act is known as the center of gravity (CG).
The gravitational pull is thought to be focused at the point where an object weighs on average. Depending on the object's size, shape, and mass distribution, the center of gravity will be in one place or another.
The impact of adding a paper clip to your glider's vertical stabilizer is to shift the center of gravity (CG) to the back of the glider.
This is due to the fact that the paper clip adds weight to the glider's rear, moving the center of mass there and, as a result, the center of gravity.
Thus, the correct option is A.
For more details regarding center of gravity, visit:
https://brainly.com/question/20662119
#SPJ6
Which of the following is NOT one of the Internet sources that hackers use to gather information about a company's employees?
1. Blogs
2. Company website
3. Social networking sites
4. Regional Internet registries
Answer:
4. Regional Internet registries
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.
With cybersecurity theory, security standards, frameworks and best practices we can guard against cyber attacks and easy-to-guess passwords such as using alphanumeric password with certain composition and strength.
Some examples of the Internet sources that hackers use to gather information about a company's employees includes;
I. Blogs.
II. Company website.
III. Social networking sites.
However, Regional Internet registries cannot be used by hackers to gather information about a company's employees because it is an internet protocol resource organization saddled with the responsibility of allocating and registering internet protocol (IP) addresses.
At Moore High, 456 students attended the prom. This is 65 more students than
the previous year.
To the nearest percent, what is the percent of increase from last year to this
year?
12%
15%
17%
19%
Answer:
B-15%
Explanation:
1. If you have the following device like a laptop, PC and mobile phone. Choose one device
and write down the specification according to?
*Operating System
*Storage capacity
*Memory Capacity
*Wi-Fi connectivity
*Installed application
Answer:
For this i will use my own PC.
OS - Windows 10
Storage Capacity - 512 GBs
Memory - 16 GB
Wi-Fi - Ethernet
Installed Application - FireFox
Explanation:
An OS is the interface your computer uses.
Storage capacity is the space of your hard drive.
Memory is how much RAM (Random Access Memory) you have
Wi-Fi connectivity is for how your computer connects the the internet.
An installed application is any installed application on your computer.
write a python program to accept a number and check whether it is divisible by 4 or not
Answer:
number = int(input("Enter number: "))
if (number % 4):
print("{} is not divisible by 4".format(number))
else:
print("{} is divisible by 4".format(number))
Explanation:
If the %4 operation returns a non-zero number, there is a remainder and thus the number is not divisable by 4.
Write a program that has a user guess a secret number between 1 and 10. Store the secret number in a variable called secretNumber and allow the user to continually input numbers until they correctly guess what secretNumber is. Complete the method guessMyNumber that uses a while loop to ask the user for their guess and compares it againist secretNumber. For example, if secretNumber was 6, an example run of the program may look like this:_______.
Answer:
Explanation:
The following code is written in Python. It is a function called guessMyNumber and like requested creates a random number and saves it to secretNumber. Then it continuously asks the user for their guess and compares it to the secret number. If the guess is correct it exits the loop otherwise it will continue to ask for a new guess.
import random
def guessMyNumber():
secretNumber = random.randint(1, 10)
print(secretNumber)
while True:
guess = input("Enter your guess: ")
guess = int(guess)
if (guess == secretNumber):
print("Congratulations you guessed correctly")
DRAG DROP -A manager calls upon a tester to assist with diagnosing an issue within the following Python script:#!/usr/bin/pythons = "Administrator"The tester suspects it is an issue with string slicing and manipulation. Analyze the following code segment and drag and drop the correct output for each string manipulation to its corresponding code segment. Options may be used once or not at all.Select and Place:
Answer:
The output is to the given question is:
nist
nsrt
imdA
strat
Explanation:
The missing code can be defined as follows:
code:
s = "Administrator" #defining a variable that hold string value
print(s[4:8])#using slicing with the print method
print(s[4: 12:2])#using slicing with the print method
print(s[3::-1])#using slicing with the print method
print(s[-7:-2])#using slicing with the print method
In the above code, a string variable s is declared, that holds a string value, and use the multiple print method to print its slicing calculated value.
6. Pattern Displays
Use for loops to construct a program that displays a triangle of Xs on the screen. The
triangle should look like this
X XXXXX
XX XXXX
XXX XXX
XXXX XX
XXXXX X
Answer:
public static void displayPattern()
{
for (int x = 1; x <= 5; x++)
{
for (int i = 0; i <= 6; i++)
{
if (x == i)
{
System.out.print(" ");
} else {
System.out.print("X");
}
}
System.out.println("");
}
}
Don't delete my answer Brainly moderators, you know as well as I do that you'll never be stack overflow so take what you can get.