Question

In: Computer Science

1.a. With the aid of vivid real-life scenarios, depict each of the following programming paradigms: i....

1.a. With the aid of vivid real-life scenarios, depict each of the following programming paradigms: i. Structural Paradigm ii. Procedural Programming iii. Object Oriented Programming iv. Imperative Programming v. Literate Programming vi. Declarative Programming vii. Logic Programming viii. Functional Programming ix. Symbolic Programming b. Using any of the following programming languages: Java, C, C++, Visual Basic, and Python; present computer programming codes to illustrate each of the paradigms in 1a above.

Solutions

Expert Solution

1.

a) i) Structural Paradigm -

Like The structural-functional approach tells that all parts in the society works together in order to form a harmonious, sensible and stable society. Same way in programming, structural paradigm aims at improving the clarity, quality, and development time of a computer program by making extensive use of the structured control flow constructs of selection (if/then/else) and repetition (while and for), block structures, and subroutines in contrast to using simple tests and jumps such as the go to statement, which can lead to “spaghetti code” that is potentially difficult to follow and maintain.

ii) Procedural Paradigm :

This paradigm emphasizes on procedure in terms of under lying machine model. It is one of the most popular programming paradigms out there. Here, we split the code into smaller units called functions or procedures so that it is easier to reuse and the flow of execution is from top to bottom. This style is easy to understand and implement.

For example, while making a game we let create a evil boss and need to respawn it at every level. So, we dont have to create the character for every level. Rather we create one character and save it and resue it again and again in every level.

iii) Object Oriented Programming :

The program is written as a collection of classes and object which are meant for communication. The smallest and basic entity is object and all kind of computation is performed on the objects only. More emphasis is on data rather procedure. It can handle almost all kind of real life problems which are today in scenario. The advantage of OOP is reusable codes, flexibility, data security, inheritance etc.

For example, In a game you would have an alien “object”. It would know where it was, what it looked like, which direction it was moving and how to draw itself on the screen. You’d have a whole collection of aliens in another object called the AlienCollection. Each frame, you tell the AlienCollection to draw itself. It doesn't have to do anything except iterate over all its Alien objects and tell them to draw themselves.

iv) Imperative Programming :

It is one of the oldest programming paradigm. It features close relation relation to machine architecture. It is based on Von Neumann architecture. It works by changing the program state through assignment statements. It performs step by step task by changing state. The main focus is on how to achieve the goal. The paradigm consist of several statements and after execution of all the result is stored.

It uses statements that change a program's state. In much the same way that the imperative mood in natural languages expresses commands, an imperative program consists of commands for the computer to perform. Imperative programming focuses on describing how a program operates.

v) Literate Programming :

In Literate programming a computer program is given an explanation of its logic in a natural language, such as English, interspersed with snippets of macros and traditional source code, from which compilable source code can be generated.

The approach is used in scientific computing and in data science routinely for reproducible research and open access purposes. Literate programming tools are used by millions of programmers today.


Related Solutions

Use an AD-AS model to depict the following scenarios in the short-run: The government cuts taxes...
Use an AD-AS model to depict the following scenarios in the short-run: The government cuts taxes There is a reduction in government spending The government increases transfer payments Which of the above three scenarios above would be fiscal policy?
Can you give examples of using functions in real life? By real life I understand not...
Can you give examples of using functions in real life? By real life I understand not only what we do in everyday living, but also science, economy, and similar.
1. For each of the following scenarios, determine if there is an increase or decrease in...
1. For each of the following scenarios, determine if there is an increase or decrease in supply for the good in italics. Explain your reasoning using economic principles. a. Tomato growers have an unusually good season b. New medical evidence reports that consumption of organic products reduces the incidence of cancer. c. Wages of clothing producers increase. d. The price of silver increases. 2. For each of the following scenarios, determine if there is an increase or decrease in demand...
In each of the following scenarios, tell if the researcher has committed a Type I error,...
In each of the following scenarios, tell if the researcher has committed a Type I error, a Type II error, or made a correct decision. a. A researcher is testing to determine if .31 of all families own more than one car. His null hypothesis is that the population proportion is .31. He randomly samples 600 families and obtains a sample proportion of .33 that own more than one car. Based on this sample data, his decision is to fail...
*Outline the characteristic of Social Disorganization theory. How applicable is this theory in real life scenarios....
*Outline the characteristic of Social Disorganization theory. How applicable is this theory in real life scenarios. *What is collective efficacy and how does it help area/neighborhoods become and remain crime free? *How does one develop Strain and how could that lead them to a criminal pathway? *Explain General Strain Theory.
1. For each of the following scenarios, determine if there is an increase/decrease in supply or...
1. For each of the following scenarios, determine if there is an increase/decrease in supply or quantity supply for the goods in Italics. Draw a supply and demand curve to examine the changes in equilibrium, if any. a.) Growers of tomatoes experience an unusually good growing season b.) The price of movie tickets, a substitute for Netflix movie rentals, goes up c.) The cost of producing tires increases d.) Kendrick Lamar, who is crazy about air travel, gets fired from...
Explain what happens to saving, investment, and the real interest rate in each of the following scenarios in a closed economy.
Explain what happens to saving, investment, and the real interest rate in each of the following scenarios in a closed economy. Illustrate your answer using a saving-investment diagram. Label the axes and curves clearly. a) Real money supply increases b) The tax code changes so that business firms face higher tax rates on their revenue (offset by other lump-sum tax changes so there’s no overall change in tax revenue). The rise in taxes reduces desired investment, shifting the Id curve...
I. In each of the following two scenarios, what type of transaction is involved? (spot exchange,...
I. In each of the following two scenarios, what type of transaction is involved? (spot exchange, contract, or vertical integration). Explain your answer. 3. XYZ Corporation a big automobile company purchases Mich Tires, a local tire company. 4. Each year LAREDO bell, a new fast food company, has a legal obligation to purchase 0.5 billion pounds of potatoes from AGRI Expert located in San Antonio.
19. Briefly describe the specific first aid management of the following scenarios adequately referring to the...
19. Briefly describe the specific first aid management of the following scenarios adequately referring to the ARC guidelines. 19.1 An adult casualty suffering thermal burns from a direct heat contact (in 60-80 words): The burns need to be assessed, following the cool up to 20 minutes (PFA: slide 207) 19.2 An adult casualty suffering from crush injury on the chest (due to heavy falling debris) (in 60-80 words each): 19.3 An adult casualty with a medical warning bracelet for diabetes...
(1) Show with the aid of diagrams the action of each of the following symmetry operations...
(1) Show with the aid of diagrams the action of each of the following symmetry operations on a point located at (x, y, z). C4 S4 {2 marks} (2) With reference to a set of character tables, determine the order of each of the following point groups. D2d Oh {2 marks} (3) Determine the total degeneracy of each of the following irreducible representations ().  = 3Ag + B1u + 2B2u  = A1g + 3Eg + 2T1g + T2u...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT