Questions
1. regular expressions as a mechanism to specify tokens, 2. defining context-free grammars for language constructs,...

1. regular expressions as a mechanism to specify tokens,

2. defining context-free grammars for language constructs, and

3. derivation of language terms and expressions based on a context-free grammar.

1 Regex

1. Define the regex for the following description of tokens:

(a) Any string that starts with character

t

(b) Any string of at least length 3 that starts with

t

and ends with

u

(c) Any string that specifies the range of numbers between 11 and 23.

(d) Any string that specifies a date in MM:DD:YYYY format.

2. In C, an identifier is defined as a string of characters (both upper-case and lower-case), digits, and

underscore “_”, starting with either a character or underscore. Define the regex for identifiers in C.

3. Give five strings that conform with the regex:

[0-9]+((E|e)(\+|\-)?[0-9]+)?

In: Computer Science

question 1 (explain each code) If more information if needed please let me know a)t=linspace(0,1,1000); %...

question 1 (explain each code)

If more information if needed please let me know

a)t=linspace(0,1,1000); % Time t

Meaning:

b) for i=1:1000

xt(i)=v*cos(theta*pi/180)*t(i);

yt(i)=h+(v*sin(theta*pi/180)*t(i))-0.5*g*t(i)^2;

end

Meaning:

c) k = find(yt<0,1) % find index at which distance becomes

fprintf('Ball hits the ground at distance of %d meters',xt(k))

Meaning:

d) x=0:0.1:max(xt);

y=0;

plot(x,y*ones(size(x)),'--k')

Meaning:

In: Computer Science

____________ add value to a family business and as advisors, make the whole family-ownership-management system their...

____________ add value to a family business and as advisors, make the whole family-ownership-management system their client, not just the CEO or a branch of the family.

1- Realtors.
2- Insurance agents.
3- Psychologists.
4- Family business consultants.

In: Operations Management

Cost of Production Report: Average Cost Method Use the average cost method with the following data:...

Cost of Production Report: Average Cost Method Use the average cost method with the following data: Work in process, December 1, 5,500 units, 20% completed $40,040 Materials added during December from Weaving Department, 103,900 units 734,573 Direct labor for December 187,974 Factory overhead for December 143,141 Goods finished during December (includes goods in process, December 1), 101,700 units — Work in process, December 31, 7,700 units, 60% completed — Prepare a cost of production report for the Cutting Department of Tanner Carpet Company for December 2016 using the average cost method. If required, round your cost per equivalent unit answer to two decimal places. Tanner Carpet Company Cost of Production Report-Cutting Department For the Month Ended December 31, 2016

In: Accounting

example_thread.c #include <stdio.h> #include <stdlib.h> #include <pthread.h> int shared= 0; void race(void); int main(){     pthread_t...

example_thread.c

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

int shared= 0;
void race(void);

int main(){
    pthread_t player1, player2, player3;

    pthread_create(&player1, NULL, (void *)race, NULL);
    pthread_create(&player2, NULL, (void *)race, NULL);
    pthread_create(&player3, NULL, (void *)race, NULL);

    pthread_join(player1, NULL);
    pthread_join(player2, NULL);
    pthread_join(player3, NULL);
    printf("Total Number = %d\n", shared);
    return 0;

}

void race(void) {
    long i,tmp;
    for(i=1; i<=200000; i++) {
        tmp = shared;
        tmp = tmp + 1;
        shared = tmp;
    }
}

1. Use both Mutex lock and Semaphore to address the racing problem in the following program (example_thread.c). Please make sure that your output is always equal to 600000.

2.  Use your Semaphore program to generate an example with deadlock problem.

In: Computer Science

Computer Networking Proxy Server Related Question: Please explain the caching algorithms of a web proxy server...

Computer Networking Proxy Server Related Question:

Please explain the caching algorithms of a web proxy server and include following concepts: Greedy Dual Size, least recently used, and least frequently used.

In: Computer Science

Applying the phase rule. Consider the phase diagram for a one-component system. (a) What is the...

Applying the phase rule. Consider the phase diagram for a one-component system.

(a) What is the variance and number of phases at (T1, p1)?

(b) What is the variance and number of phases at (T2, p2)?

(c) What is the variance and number of phases at (T3, p3)?

(d) Which is the triple point?

In: Chemistry

Describe a career goal for a respiratory therapist / personal trainer and explain how a Master...

Describe a career goal for a respiratory therapist / personal trainer and explain how a Master of Business Administration degree from MUW will help accomplish these goals.

In: Operations Management

Describe in 500 words the shared security responsibility model that a dba must be aware of...

Describe in 500 words the shared security responsibility model that a dba must be aware of when moving to the cloud.

Note-Check in chegg writing before you submit it should be 100% unique and don't submit the existing chegg answers,and submit in text format Provide References

In: Computer Science

What volume of each of the following acids will react completely with 50.32 mL of 0.120...

What volume of each of the following acids will react completely with 50.32 mL of 0.120 M NaOH?

(a)    0.130 M HCl
mL

(b)    0.180 M H2SO3 (two acidic hydrogens)
mL

(c)    0.210 M H3PO4 (three acidic hydrogens)
mL

(d)    0.135 M HNO3
mL

(e)    0.255 M HC2H3O2 (one acidic hydrogen)
mL

(f)    0.320 M H2SO4 (two acidic hydrogens)
mL

In: Chemistry

Array & Function - Can I pass a single parameter to a function that takes two...

Array & Function - Can I pass a single parameter to a function that takes two arguments:

data passed from:

arrayOne(4);

to function:

string function (array[], int)

In: Computer Science

A "seconds" pendulum is one that goes through its equilibrium position once each second. (The period...

A "seconds" pendulum is one that goes through its equilibrium position once each second. (The period of the pendulum is 2.000 s.) The length of a seconds pendulum is 0.9927 m at Tokyo and 0.9942 m at Cambridge, England. What is the ratio of the free-fall accelerations at these two locations? (Give your answer to at least 4 decimal places.) Cambridge /Tokyo =

In: Physics

In a time-use study, 20 randomly selected college students were found to spend a mean of...

In a time-use study, 20 randomly selected college students were found to spend a mean of 1.4 hours on the internet each day. The standard deviation of the 20 scores was 1.3 hours.
Construct a 90% confidence interval for the mean time spent on the internet by college students. Assume t* = 1.729
If you increased the sample size for the problem above, what would happen to your confidence interval, assuming the sample mean and standard deviation remain unchanged?

In: Math

A study is conducted regarding shatterproof glass used in automobiles. Twenty-six glass panes are coated with...

A study is conducted regarding shatterproof glass used in automobiles. Twenty-six glass panes are coated with an anti-shattering film. Then a 5-pound metal ball is fired at 70mph at each pane. Five of the panes shatter. We wish to determine whether, in the population of all such panes, the probability the glass shatters under these conditions is different from π= 0.2

(a) State the appropriate null and alternative hypotheses.

(b) Check the conditions for trusting the conclusion of the test, and calculate the observed value of an appropriate test statistic.

(c) Calculate the rejection region and draw a conclusion, given the significance level α= 0.05.

(d) Calculate the p-value.

(e) Compute the power of the test if the trueπwas in fact 0.3.

In: Math

In C++ Design a program to calculate the stock purchasing and selling transactions. 1. ask the...

In C++

Design a program to calculate the stock purchasing and selling transactions.

1. ask the user to enter the name of the stock purchased, the number of share purchased, and the price per share purchased

2. assume the buyer pays 2% of the amount he paid for the stock purchase as broker commission

3. assume that the buyer sold all stocks. Ask the user to enter the price per share sold.

4. assume the buyer will pay another 2% of the amount he received for selling the stock as broker commission


the program will calculate and display:

1. the amount of money he paid for the stock purchase

2. the amount of commission he paid to the broker for purchase transaction

3. the amount he sold the stock for

4. the amount of commission he paid to the broker for purchase selling

5. the possible profit he made after selling his stock and paying the two commissions to the broker

Requirements:

1. program well documented

In: Computer Science