Answer:
A
Explanation:
Every Java statement ends with: *
Period
Colon
Double quote
Semicolon
Answer:
semicolon is the answer
What type of editor is used to edit HTML code?What type of editor is used to edit HTML code?
For learning HTML we recommend a simple text editor like Notepad (PC) or TextEdit (Mac).
mark me brainliestt :))
Answer:
If you want to use HTML editor in windows, you can use notepad. And if you want to use HTML editor on your phone than you need to install any editor on your phone.
Explanation:
If you want to use another app than notepad in pc, laptop, mac, OS or Linux, you can download a editor known as Visual Studio Code. If you want to do another language you can also do it in it. You can do all programming languages in it.
After reading all L02 content pages in Lesson 02: Inheritance and Interfaces, you will complete this assignment according to the information below.Do not use the scanner class or any other user input request. You application should be self-contained and run without user input.Assignment ObjectivesPractice on implementing interfaces in JavaFootballPlayer will implement the interface TableMemberOverriding methodswhen FootballPlayer implements TableMember, FootballPlayer will have to write the real Java code for all the interface abstract methodsDeliverablesA zipped Java project according to the How to submit Labs and Assignments guide.O.O. Requirements (these items will be part of your grade)One class, one file. Don't create multiple classes in the same .java fileDon't use static variables and methodsEncapsulation: make sure you protect your class variables and provide access to them through get and set methodsAll the classes are required to have a constructor that receives all the attributes as parameters and update the attributes accordinglyAll the classes are required to have an "empty" constructor that receives no parameters but updates all the attributes as neededFollow Horstmann's Java Language Coding GuidelinesOrganized in packages (MVC - Model - View Controller)Contents
Solution :
App.java:
import Controller.Controller;
import Model.Model;
import View.View;
public class App
{
public static void main(String[] args) // Main method
{
Model model = new Model(); // Creates model object.
View view = new View(); // Creates view object.
Controller controller = new Controller(view, model); // Creates controller object that accepts view and model objects.
}
}
[tex]\text{Controller.java:}[/tex]
package Controller;
[tex]\text{impor}t \text{ Model.Model;}[/tex]
import View.View;
[tex]\text{public class Controller}[/tex]
{
Model model; // Model object
View view; // View object
public Controller(View v, Model m) // Method that imports both model and view classes as objects.
{
model = m;
view = v;
//view.basicDisplay(model.getData()); // basicDisplay method from View class prints FootballPlayer objects as Strings from Model class.
view.basicDisplay(model.getMembers().get(1).getAttributeName(3));
view.basicDisplay(model.getMembers().get(1).getAttribute(3));
view.basicDisplay(model.getMembers().get(1).getAttributeNames());
view.basicDisplay(model.getMembers().get(1).getAttributes());
view.basicDisplay("size of names=" + model.getMembers().get(1).getAttributeNames().size());
view.basicDisplay("size of attributes=" + model.getMembers().get(1).getAttributes().size());
}
}
FootballPlayer.java:
package Model;
import java.util.ArrayList;
public class FootballPlayer extends Person implements TableMember { // Used "extends" keyword to inherit attributes from superclass Person, while using "implements" to implement methods from TableMember interface.
private int number; // Creating private attribute for int number.
private String position; // Creating private attribute for String position.
public FootballPlayer(String name, int feet, int inches, int weight, String hometown, String highSchool, int number, String position) // Full parameter constructor for FootballPlayer object (using "super" keyword to incorporate attributes from superclass).
{
super(name, feet, inches, weight, hometown, highSchool); // Used super keyword to include attributes from superclass.
this.number = number; // Value assigned from getNumber method to private number instance variable for FootballPlayer object.
this.position = position; // Value assigned from getPosition method to private position instance variable for FootballPlayer object.
}
public FootballPlayer() // No parameter constructor for FootballPlayer object.
{
this.number = 0; // Default value assigned to private number instance variable under no parameter constructor for FootballPlayer object.
this.position = "N/A"; // Default value assigned to private position instance variable under no parameter constructor for FootballPlayer object.
}
Override
public String getAttribute(int n) // getAttribute method that is implemented from interface.
{
switch (n) { // Switch statement for each attribute from each FootballPlayer object. Including two local attributes, denoted by this. While the others are denoted by "super".
case 0:
return String.valueOf(this.number); // Use of the dot operator allowed me to discover String.valueOf method to output int attributes as a string.
case 1:
return this.position;
case 2:
return super.getName();
case 3:
return super.getHeight().toString();
case 4:
return String.valueOf(super.getWeight());
case 5:
return super.getHometown();
case 6:
return super.getHighSchool();
default:
return ("invalid input parameter");
}
}
Override
public ArrayList<String> getAttributes() // getAttributes ArrayList method that is implemented from interface.
{
ArrayList<String> getAttributes = new ArrayList<>();
for(int i = 0; i <= 6; i++){ // For loop to add each attribute to the getAttributes ArrayList from getAttributes method.
getAttributes.add(getAttribute(i));
}
return getAttributes;
}
Override
public String getAttributeName(int n) // getAttributeName method implemented from interface.
{
switch (n) { // Switch statement for the name of each attribute from each FootballPlayer object.
case 0:
return "number";
case 1:
return "position";
case 2:
return "name";
case 3:
return "height";
case 4:
return "weight";
case 5:
return "hometown";
case 6:
return "highSchool";
default:
return ("invalid input parameter");
}
}
Viết chương trình kiểm tra số nguyên dương N có phải là số nguyên tố không?
With what software tool can you see the applications that are currently runni
your computer?
Application Manager
Task Scheduler
Task Manager
Device Manager
None of the above
Answer:
Task Manager
Explanation:
On windows, you can press Ctrl + Esc and it will open Task Manager.
You will see all the currently running programs and the amount of resources they are currently using.
Write a program that lets the user enter the total rainfall for each of 12 months into an array of doubles. The program should calculate and display the total rainfall for the year and the average monthly rainfall. Use bubble sort and sort the months with the lowest to highest rain amounts. Use the binary search and search for a specific rain amount. If the rain amount is found, display a message showing which month had that rain amount. Input Validation: Do not accept negative numbers for monthly rainfall figures.
Answer:
Program approach:-
Using the header file.Using the standard namespace I/O.Define the main function.Check whether entered the value is negative.Find the middle position of the array.Display message if value not found.Returning the value.Explanation:
Program:-
//required headers
#include <stdio.h>
#include<iostream>
using namespace std;
//main function
int main()
{ double rain[12], temp_rain[12], sum=0, avg=0, temp;
int month=0, i, j, n=12, low=0, mid=0, high=12, x, found=0;
char month_name[][12]={"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"};
//store input values to arrays rain and temp_rain
while(month<n)
{ cout<<"Enter the total rainfall for month "<<month+1<<" :";
cin>>temp;
//check whether the entered value is negative
if(temp<0)
{ cout<<"Enter a non negative value"<<endl;
}
else
{ rain[month]=temp;
temp_rain[month]=temp;
//total sum is found out and stored to sum
sum+=temp;
month++;
}
}
//find average rainfall
avg=sum/n;
//display total and average rainfall for the year
cout<<"Total rainfall for the year: "<<sum<<endl;
cout<<"Average rainfall for the year: "<<avg<<endl;
//perform bubble sort on temp_rain array
for(i=0; i<n-1; i++)
{ for (j=0; j<n-i-1; j++)
{ if (temp_rain[j]>temp_rain[j+1])
{
temp=rain[j];
temp_rain[j]=temp_rain[j+1];
temp_rain[j+1]=temp;
}
}
}
//get search value and store it to x
cout<<"Enter the value to search for a specific rain amount: ";
cin>>x;
//perform binary search on temp_rain array
while (low<=high)
{
//find the middle position of the array
int mid=(low+high)/2;
//if a match is found, set found=1
if(x==temp_rain[mid])
{ found=1;
break;
}
//ignore right half if search item is less than the middle value of the array
else if(x<temp_rain[mid])
high=mid-1;
//ignore left half if search item is higher than the middle value of the array
else
low=mid+1;
}
//if a match is found, then display the month for the found value
if(found==1)
{
for(i=0; i<n; i++)
{ if(x==rain[i])
cout<<"Found matching rainfall for this month: "<<month_name[i];
}
}
//display message if value not found
else
cout<<"Value not found.";
return 0;
}
Questions to ask people on how corona has affected the religion sectors
Answer:
bcoz of corona all churches and temples are closed and pilgrimage are cancelled
Write a program that first reads in the name of an input file and then reads the input file using the file.readlines() method. The input file contains an unsorted list of number of seasons followed by the corresponding TV show. Your program should put the contents of the input file into a dictionary where the number of seasons are the keys, and a list of TV shows are the values (since multiple shows could have the same number of seasons).
Sort the dictionary by key (least to greatest) and output the results to a file named output_keys.txt, separating multiple TV shows associated with the same key with a semicolon (;). Next, sort the dictionary by values (alphabetical order), and output the results to a file named output_titles.txt.
Ex: If the input is:
file1.txt
and the contents of file1.txt are:
20
Gunsmoke
30
The Simpsons
10
Will & Grace
14
Dallas
20
Law & Order
12
Murder, She Wrote
the file output_keys.txt should contain:
10: Will & Grace
12: Murder, She Wrote
14: Dallas
20: Gunsmoke; Law & Order
30: The Simpsons
and the file output_titles.txt should contain:
Dallas
Gunsmoke
Law & Order
Murder, She Wrote
The Simpsons
Will & Grace
Note: There is a newline at the end of each output file, and file1.txt is available to download.
currently, my code is:
def readFile(filename):
dict = {}
with open(filename, 'r') as infile:
lines = infile.readlines()
for index in range(0, len(lines) - 1, 2):
if lines[index].strip()=='':continue
count = int(lines[index].strip())
name = lines[index + 1].strip()
if count in dict.keys():
name_list = dict.get(count)
name_list.append(name)
name_list.sort()
else:
dict[count] = [name]
return dict
def output_keys(dict, filename):
with open(filename,'w+') as outfile:
for key in sorted(dict.keys()):
outfile.write('{}: {}\n'.format(key,';'.join(dict.get(key))))
print('{}: {}\n'.format(key,';'.join(dict.get(key))))
def output_titles(dict, filename):
titles = []
for title in dict.values():
titles.extend(title)
with open(filename,'w+') as outfile:
for title in sorted(titles):
outfile.write('{}\n'.format(title))
print(title)
def main():
filename = input()
dict = readFile(filename)
if dict is None:
print('Error: Invalid file name provided: {}'.format(filename))
return
output_filename_1 ='output_keys.txt'
output_filename_2 ='output_titles.txt'
output_keys(dict,output_filename_1)
print()
output_titles(dict,output_filename_2)
main()
The problem is that when I go to submit and the input changes, my output differs.
Output differs. See highlights below. Special character legend Input file2.txt Your output 7: Lux Video Theatre; Medium; Rules of Engagement 8: Barney Miller;Castle; Mama 10: Friends; Modern Family; Smallville;Will & Grace 11: Cheers;The Jeffersons 12: Murder, She Wrote;NYPD Blue 14: Bonanza;Dallas 15: ER 20: Gunsmoke; Law & Order; Law & Order: Special Victims Unit 30: The Simpsons Expected output 7: Rules of Engagement; Medium; Lux Video Theatre 8: Mama; Barney Miller; Castle 10: Will & Grace; Smallville; Modern Family; Friends 11: Cheers; The Jeffersons 12: Murder, She Wrote; NYPD Blue 14: Dallas; Bonanza 15: ER 20: Gunsmoke; Law & Order; Law & Order: Special Victims Unit 30: The Simpsons
Answer:
Explanation:
The following is written in Python. It creates the dictionary as requested and prints it out to the output file as requested using the correct format for various shows with the same number of seasons.The output can be seen in the attached picture below.
mydict = {}
with open("file1.txt", "r") as showFile:
for line in showFile:
cleanString = line.strip()
seasons = 0
try:
seasons = int(cleanString)
print(type(seasons))
except:
pass
if seasons != 0:
showName = showFile.readline()
if seasons in mydict:
mydict[seasons].append(showName.strip())
else:
mydict[seasons] = [showName.strip()]
f = open("output.txt", "a")
finalString = ''
for seasons in mydict:
finalString += str(seasons) + ": "
for show in mydict[seasons]:
finalString += show + '; '
f.write(finalString[:-2] + '\n')
finalString = ''
f.close()
Design traffic lights at an intersection of a city. North and South (up and down) are going to be a main highway, East and West (right and left) will be a smaller cross street. There will be no turn signals and no cross walks. You only need to build/code one set of lights for each street (one set of green, yellow, and red for the highway, and another set for the cross street). You do not need to build actual traffic lights or an intersection.
Answer:
Explanation:
The following code is written in Java. In order to code this efficiently, I created a class for the trafficLights. The class contains the currentLight, and the streetType as variables and contains a constructore, getter and setter methods, and a method to turn to the next light in the sequence. Then I created 4 objects of TrafficLights for the highways and the streets.
class Brainly {
public static void main(String[] args) {
TrafficLights highwaySouth = new TrafficLights("Highway", "green");
TrafficLights highwayNorth = new TrafficLights("Highway", "green");
TrafficLights streetEast = new TrafficLights("Street", "yellow");
TrafficLights streetWest = new TrafficLights("Street", "red");
}
}
class TrafficLights {
String streetType, currentLight;
public TrafficLights(String streetType, String currentLight) {
this.streetType = streetType;
this.currentLight = currentLight;
}
public void nextLight() {
if (this.currentLight == "green") {
this.currentLight = "yellow";
} else if (this.currentLight == "yellow") {
this.currentLight = "red";
} else {
this.currentLight = "green";
}
}
public String getStreetType() {
return streetType;
}
public void setStreetType(String streetType) {
this.streetType = streetType;
}
public String getCurrentLight() {
return currentLight;
}
public void setCurrentLight(String currentLight) {
this.currentLight = currentLight;
}
}
Why might you use a navigation form instead of tab pages? The navigation form allows for several levels and sublevels to be collected. The navigation form allows for duplicate records of information to be collected. The navigation form requires all entries to be complete before adding to a database. The navigation form requires report headers and footers to make publication neater.
Answer:
Access includes a Navigation Control that makes it easy to switch between various forms and reports in your database. A navigation form is simply a form that contains a Navigation Control. Navigation forms are a great addition to any desktop database.
Explanation:
yes
Answer:
answer c
Explanation:
correct answer on edge
Saved In order to be used as a primary key, which of these characteristics must an attribute possess with respect to a single instance of the entity? Select all that apply. There must be a maximum of one attribute instance. There must be many instances of the attribute There must be at most one entity instance that each attribute instance describes. There must be at least one instance of the attribute. There must be zero or more instances of the attribute. Question 2 (2 points) True or false: A singular attribute is also known as a unique attribute. True False Question 3 (3 points) Saved Relationship names and types of relationship maxima or minima that each could have are listed below. Match each relationship in the list below to the type of relationship maxima or minima. Instructions: Choose your responses from the drop-down menus below. Response options cannot be used more than once. Minima is One-Zero 1 Person-Assigned Social SecurityNumber 4 Minima is Zero Zero 2 CubicleNumber-Assigned-to- Employee per shift 2 Maxima is One-Many 3. Birthdate-Recorded-for-a Person 1 Maxima is One One 4. Women-Bearing-Children Question 4 (2 points) Saved A ride-sharing app's discount system for riders is configured such that a ride discount is triggered only if at least two RiderlDs book a ride in the same Card at the same time. Which of the following is true of the relationship Ride Discount-is-Applicable?
The relationship minimum is Many-One.
The relationship minimum is Two-One.
The relationship maximum is One-Two.
The relationship minimum is One-Two.
Answer:
Saved In order to be used as a primary key, which of these characteristics must an attribute possess with respect to a single instance of the entity:
There must be a maximum of one attribute instance.
There must be many instances of the attribute.
There must be at most one entity instance that each attribute instance describes.
There must be at least one instance of the attribute.
A singular attribute is also known as a unique attribute. True
Saved Relationship names and types of relationship maxima or minima that each could have are listed below. True
Explanation:
What does Falstaff do to protect himself in battle?
Given the following tree, use the hill climbing procedure to climb up the tree. Use your suggested solutions to problems if encountered. K is the goal state and numbers written on each node is the estimate of remaining distance to the goal.
In a paragraph, describe in detail a practical real-world example of where you would implement a singly-linked list and why a singly-linked list is best for this use. Do not list the properties of a singly-linked list....
Rather identify a real-world example or application. If you identify this through research, cite your source.
Answer:
travel
Explanation:
One real world example of a singly-linked list would be travel. Imagine that you want to take a trip to your nearest neighbor state. To do so you would need to take a 2 buses and a train, but you can't just take any or in any order you wish. You first need to take the first bus at your current location, get off at the train station, take that train to the final stop, get off and take the bus to the final destination. Meaning there is a sequence of connected events that you must follow in order to get to your destination and the same opposite sequence of events to get back. This is exactly like a singly-linked list.
multimedia is an effective tool used in different fields such as business and education true or false
Answer:
True
Explanation:
Multimedia is used in many fields. It is basically the ability to express something in many different ways. This allows you to more easily demonstrate a product, idea, or even a theory. Since this can be through art, video, presentation, text, live, etc. It allows you to find the best format for the specific product or idea that you are trying to present to a group of viewers. That is why it is an effective tool for various fields since it can just as easily help a company sell a product as well as help a teacher express a mathematical concept.
what is a network computer that processes requests from a client server
Answer:
computer processing unit
computer processing unit is a network computer that processes requests from a client server.
What is a computer processing unit?The main element and "control center" of a computer is the Central Processing Unit (CPU). The CPU, sometimes known as the "central" or "main" processor, is a sophisticated collection of electronic circuitry that manages the device's software and operating system.
A central processing unit, sometimes known as a CPU, is a piece of electronic equipment that executes commands from software, enabling a computer or other device to carry out its functions.
Computers use a brain to process information, much like people do. The brain is the central processing unit for a computer (CPU). The CPU is the component that carries out all of the computer's instructions. It connects with all the other hardware parts of the computer while being on the motherboard.
Thus, computer processing unit.
For more information about computer processing unit, click here:
https://brainly.com/question/29775379
#SPJ6
Read integers from input and store each integer into a vector until -1 is read. Do not store -1 into the vector. Then, output all values in the vector (except the last value) with the last value in the vector subtracted from each value. Output each value on a new line. Ex: If the input is -46 66 76 9 -1, the output is:
-55
57
67
Answer:
The program in C++ is as follows:
#include <iostream>
#include <vector>
using namespace std;
int main(){
vector<int> nums;
int num;
cin>>num;
while(num != -1){
nums.push_back(num);
cin>>num; }
for (auto i = nums.begin(); i != nums.end(); ++i){
cout << *i <<endl; }
return 0;
}
Explanation:
This declares the vector
vector<int> nums;
This declares an integer variable for each input
int num;
This gets the first input
cin>>num;
This loop is repeated until user enters -1
while(num != -1){
Saves user input into the vector
nums.push_back(num);
Get another input from the user
cin>>num; }
The following iteration print the vector elements
for (auto i = nums.begin(); i != nums.end(); ++i){
cout << *i <<endl; }
the grade point average collected from a random sample of 150 students. assume that the population standard deviation is 0.78. find the margin of error if c = 0.98.
Answer:
[tex]E = 14.81\%[/tex]
Explanation:
Given
[tex]n = 150[/tex]
[tex]\sigma = 0.78[/tex]
[tex]c = 0.98[/tex]
Required
The margin of error (E)
This is calculated as:
[tex]E = z * \frac{\sigma}{\sqrt{n}}[/tex]
When confidence level = 0.98 i.e. 98%
The z score is: 2.326
So, we have:
[tex]E = 2.326 * \frac{0.78}{\sqrt{150}}[/tex]
[tex]E = 2.326 * \frac{0.78}{12.247}[/tex]
[tex]E = \frac{2.326 *0.78}{12.247}[/tex]
[tex]E = \frac{1.81428}{12.247}[/tex]
[tex]E = 0.1481[/tex]
Express as percentage
[tex]E = 14.81\%[/tex]
Heinrich Koch is a second-year college student. Last semester his best friend had his laptop stolen. The laptop was an old computer that he planned to replace soon, but the greatest loss was his data: he had not performed a backup and all his data was lost. Heinrich himself does not perform data backups but knows that he needs to do that on a regular basis. He has decided to use an online backup service that will automatically back up his data whenever it changes. Evaluate and compare reviews of online backup services. Consider iDrive, Carbonite, Acronis True Image, BackBlaze, and others you might find in your research. Recommend a service that you consider the best solution for Heinrich. Discuss your reviews and mention speed, security, and features in your recommendation.
Answer:
Acronis True Image is the one I would recommend out of these mentioned online backup services.
Explanation:
The evaluations and reviews of each of the online backup services are as follows:
a. iDrive
For this, we have:
Speed = 60% - fair
Security = 100% - excellent
Privacy = 88% - very good
Features = 95% - excellent
Pricing = 85% - Very good
Because of its various features, pricing, and usability, IDrive reviews suggest that it is a very efficient online backup solution. However, there have been complaints concerning its speed and the fact that there are no monthly plans available.
b. Carbonite
For this, we have:
Speed = 60% - fair
Security = 100% - excellent
Privacy = 87% - very good
Pricing = 85% - very good
File backup and restoration = 75% - good
Carbonite reviews reveal that it is simple to use and provides limitless backup for one device. The main drawback is that it has extremely poor backup speeds.
c. Acronis True Image
This is fast, simple and intuitive
It has complete control over the backup updates, including how and when they occur.
It is not expensive.
Acrnonis True image is a powerful backup storage service. It enables data and file backup and restoration from USB drives.
Many reviewers of Acrnonis True image have stated that they have had no issues with its service, that it is worth purchasing, and that there are no concerns.
d. Backblaze
For this, we have:
Speed = 75% - good
Security = 75% - good
Privacy = 70% - decent
Pricing = 100% - excellent
Support = 95% - excellent
Features = 65% - decent
File back-up and restoration = 70% - decent
Backblaze is one of the most popular internet backup services. This storage service, however, does not allow for ustomization.
Recommendation
Acronis True Image is the one I would recommend out of these mentioned online backup services. This is due to the fact that it delivers a large amount of accurate and high-quality data storage. It is quick, simple and intuitive, which is what most people care about. Furthermore, reviewers have stated that this service is quite effective and that there have been very few issues with it. The other services demonstrate that their services have flaws, such as lack of customization and slowness.
Think about that the C, B and S parameters of a Cache. Think about what happens to compulsory, capacity, conflict misses, if only each of the following parameter changed (the other two are kept the same)?
(i) C is increased (S, B same)
(ii) S is increased (C, B Same)
(iii) B is increased (C, S Same)
Answer:
(i) C is increased (S, B same)
Explanation:
Cache are items which are stored in the computer at a hidden place. These are sometimes unwanted and they may hinder the speed and performance of the device. They exist to bridge speed gap.
Describe computer in your own words on three pages
no entendi me explicas porfavor para ayudarte?
Given two regular expressions r1 and r2, construct a decision procedure to determine whether the language of r1 is contained in the language r2; that is, the language of r1 is a subset of the language of r2.
Answer:
Test if L(M1-2) is empty.
Construct FA M2-1 from M1 and M2 which recognizes the language L(>M2) - L(>M1).
COMMENT: note we use the algorithm that is instrumental in proving that regular languages are closed with respect to the set difference operator.
Test if L(M2-1) is empty.
Answer yes if and only if both answers were yes.
Explanation:
An algorithm must be guaranteed to halt after a finite number of steps.
Each step of the algorithm must be well specified (deterministic rather than non-deterministic).
Three basic problems:
Given an FA M and an input x, does M accept x?
Is x in L(M)
Given an FA M, is there a string that it accepts?
Is L(M) the empty set?
Given an FA M, is L(M) finite?
Algorithm for determining if M accepts x.
Simply execute M on x.
Output yes if we end up at an accepting state.
This algorithm clearly halts after a finite number of steps, and it is well specified.
This algorithm is also clearly correct.
Testing if L(M) is empty.
Incorrect "Algorithm"
Simulate M on all strings x.
Output yes if and only if all strings are rejected.
The "algorithm" is well specified, and it is also clearly correct.
However, this is not an algorithm because there are an infinite number of strings to simulate M on, and thus it is not guaranteed to halt in a finite amount of time.
COMMENT: Note we use the algorithm for the first problem as a subroutine; you must think in this fashion to solve the problems we will ask.
Correct Algorithm
Simulate M on all strings of length between 0 and n-1 where M has n states.
Output no if and only if all strings are rejected.
Otherwise output yes.
This algorithm clearly halts after a finite number of steps, and it is well specified.
The correctness of the algorithm follows from the fact that if M accepts any strings, it must accept one of length at most n-1.
Suppose this is not true; that is, L(M) is not empty but the shortest string accepted by M has a length of at least n.
Let x be the shortest string accepted by M where |x| > n-1.
Using the Pumping Lemma, we know that there must be a "loop" in x which can be pumped 0 times to create a shorter string in L.
This is a contradiction and the result follows.
COMMENT: There are more efficient algorithms, but we won't get into that.
Testing if L(M) is finite
Incorrect "Algorithm"
Simulate M on all strings x.
Output yes if and only if there are a finite number of yes answers.
This "algorithm" is well specified and correct.
However, this is not an algorithm because there are an infinite number of strings to simulate M on, and thus it is not guaranteed to halt in a finite amount of time.
COMMENT: Note we again use the algorithm for the first problem as a subroutine.
Correct Algorithm
Simulate M on all strings of length between n and 2n-1 where M has n states.
Output yes if and only if no string is accepted.
Otherwise output no.
This algorithm clearly halts after a finite number of steps, and it is well specified.
The correctness of the algorithm follows from the fact that if M accepts an infinite number of strings, it must accept one of length between n and 2n-1.
This builds on the idea that if M accepts an infinite number of strings, there must be a "loop" that can be pumped.
This loop must have length at most n.
When we pump it 0 times, we have a string of length less than n.
When we pump it once, we increase the length of the string by at most n so we cannot exceed 2n-1. The problem is we might not exceed n-1 yet.
The key is we can keep pumping it and at some point, its length must exceed n-1, and in the step it does, it cannot jump past 2n-1 since the size of the loop is at most n.
This proof is not totally correct, but it captures the key idea.
COMMENT: There again are more efficient algorithms, but we won't get into that.
Other problems we can solve using these basic algorithms (and other algorithms we've seen earlier this chapter) as subroutines.
COMMENT: many of these algorithms depend on your understanding of basic set operations such as set complement, set difference, set union, etc.
Given a regular expression r, is Lr finite?
Convert r to an equivalent FA M.
COMMENT: note we use the two algorithms for converting a regular expression to an NFA and then an NFA to an FA.
Test if L(M) is finite.
Output the answer to the above test.
Given two FAs M1 and M2, is L(M1) = L(M2)?
Construct FA M1-2 from M1 and M2 which recognizes the language L(>M1) - L(>M2).
COMMENT: note we use the algorithm that is instrumental in proving that regular languages are closed with respect to the set difference operator.
Test if L(M1-2) is empty.
Construct FA M2-1 from M1 and M2 which recognizes the language L(>M2) - L(>M1).
COMMENT: note we use the algorithm that is instrumental in proving that regular languages are closed with respect to the set difference operator.
Test if L(M2-1) is empty.
Answer yes if and only if both answers were yes.
Functions should contain only the code that performs a single task.
O True
O False
Answer:
false
Explanation:
function should contain more codes
what is the meaning of antimonographycationalis
Answer:
Although this word was made up in order to be a contender for the longest word in English, it can be broken down into smaller chunks in order to understand it.
Anti- means that you are against something; monopoly means the exclusive control over something; geographic is related to geography; and the remaining part has to do with nationalism.
So this word means something like 'a nationalistic feeling of being against geographic monopoly,' but you can see that it doesn't have much sense.
(answer copied from Kalahira just to save time)
After performing addition operation such as AX=18, BX=19 which Flags will be
affected
Answer:
Carry Flag (CF) - this flag is set to 1 when there is an unsigned overflow. ...
Zero Flag (ZF) - set to 1 when result is zero. ...
Sign Flag (SF) - set to 1 when result is negative. ...
Overflow Flag (OF) - set to 1 when there is a signed overflow.
In this project you will write a set of instructions (algorithm). The two grids below have colored boxes in different
locations. You will create instructions to move the colored boxes in grid one to their final location in grid two. Use the
example to help you. The algorithm that you will write should be in everyday language
(no pseudocode or programming language). Write your instructions at the bottom of the
page.
Example: 1. Move
the orange box 2
spaces to the right.
2. Move the green
box one space
down. 3. Move the
green box two
spaces to the left.
Write your instructions. Review the rubric to check your final work.
Rules: All 6 colors (red, green, yellow, pink, blue, purple) must be move to their new location on the grid. Block spaces are
barriers. You cannot move through them or on them – you must move around them
Answer:
Explanation:
Pink: Down 5 then left 2.
Yellow: Left 3 and down 2.
Green: Right 7, down 4 and left 1.
Purple: Up 6 and left 9.
Red: Left 7, down 5 and left 1.
You can do the last one, blue :)
Answer:
Explanation:
u=up, d=down, r=right, l=left
yellow: l3d2
pink: d5l2
green: r7d4l1
purple: u6l9
red: l7d5l1
blue: r2u7l5
While saving a document to her hard drive, Connie's computer screen suddenly changed to display an error message on a blue background. The error code indicated that there was a problem with her computer's RAM. Connie's computer is affected by a(n) __________.
Answer:
The right answer is "Hardware crash".
Explanation:
According to the runtime error message, this same RAM on your machine was problematic. This excludes file interoperability or compliance problems as well as program error possibilities.Assuming implementation performance problems exist, the timeframe that would save the information would be typically longer, but there's still a lower possibility that the adequacy and effectiveness color will become blue but instead demonstrate warning would appear.Thus the above is the right solution.
full form of computer
Answer:
COMPUTER: Common Operating Machine Purposely used for Technological and Educational research.
Explanation:
By the way, a computer is not an acronym and is the name of an electronic device.
A computer is a simple machine that we can program for a lot of logical and arithmetic functions, and it executes our work according to our instructions.
in simple words, a computer is an electronic device that makes our work easy, and any computer that has been programmed for some set of works, it performs that task or works quickly and correctly.
Design a function int maxDigit (int num) to find and return the greatest digit from the arguments value num.
Also write a function void result() by passing parameters to print the greatest digit.
please tell in java programming
Answer:
Below is the required JAVA Code:
Explanation:
public static int largestDigit(int n) {
if (n < 0) {
return largestDigit(-1 * n);
} else if (n == 0) {
return 0;
} else {
int digit = n % 10;
int maxDigit = largestDigit(n / 10);
if (digit > maxDigit)
maxDigit = digit;
return maxDigit;
}
}
\color{red}Method\;tested\;in\;a\;complete\;java\;program\;if\;you\;are\;interested.
public class LargestDigitRecursive {
public static int largestDigit(int n) {
if (n < 0) {
return largestDigit(-1 * n);
} else if (n == 0) {
return 0;
} else {
int digit = n % 10;
int maxDigit = largestDigit(n / 10);
if (digit > maxDigit)
maxDigit = digit;
return maxDigit;
}
}
public static void main(String[] args) {
System.out.println(largestDigit(14263203));
System.out.println(largestDigit(845));
System.out.println(largestDigit(52649));
System.out.println(largestDigit(3));
System.out.println(largestDigit(0));
System.out.println(largestDigit(-573026));
System.out.println(largestDigit(-2));
}
}
OUTPUT:
6
8
9
3
0
7
2
Identify the hardware components in your own computer. If you don't have a computer, use a friend's, or one at work or in an NVCC lab. The following list shows the components you should identify and how to find the information on a Windows computer. Describe model computer: type (laptop, desktop, notebook, tablet, etc.) Indicate your manufacturer (HP, Apple: iPad, MacBook Air, etc., Lenovo, Dell, etc.) of the computer. Input devices (include internal and external devices) - they usually have a model name and number somewhere on the device. Output devices (include internal and external devices) - they usually have a model name and number somewhere on the device. Storage devices (include internal and external devices, and how much data each can hold) - Open Windows Explorer and right click on a drive name to open its properties. Amount of RAM - Open System Properties in the Windows Control Panel. Type and speed of CPU - Open System Properties in the Windows Control Panel. Ports (number and type) - Look for jacks into which a connector can be plugged on the front, back and sides of the machine. Compare the jacks to pictures in your textbook.
Solution :
A friend of mine have an old version of computer PC having the following components :
Input devices
Model name of the keyboard -- PUNTA , model number -- P-KB515
Model name of the mouse -- PUNTA, model number -- P-KB515
Output devices
Speaker : COMPAQ
Monitor : ACER, Model Number --- EB192Q
Storage : 500 MB capacity hard disk
RAM : 2 GB
Processor : Intel Pentium dual E1260 at the rate 1.80 GHz
It is provided with audio jacks