Articles

2.1: Exercise Answers- Main Page


Each link below will take you to the answers to the practice exercises.

Module 1

Module 2

Module 3

Module 4

Module 5

Module 6

Module 7

Module 8

Module 9

Module 10

Module 11

Module 12

Module 13

Module 14

Module 15

Module 16

Module 17

Module 18

Module 19

Module 20

Module 21

Module 22

Module 23

Module 24

Module 25

Module 26

Module 27

Module 28

Module 29

Module 30


1, 2, 3, code ! - Cycle 3 activities - Step 2.1. Introduction to the Scratch programming environment

It is essential for the teacher to complete the exercise before proposing it to the students! All they have to do is follow the steps in the sequence. Teachers with no Scratch experience will need about 3 hours to do the whole project, including black activities.

Teaching notes:

  • You learn to program by programming, not by watching someone else program. It is interesting to consider the same problem in pairs (probably more so than to program alone), but it is important to be active. We therefore recommend placing the students in small groups in front of computers (ideally two students per machine) and asking them to &ldquoswitch over&rdquo (pass the keyboard and mouse to their neighbor) every 10-15 minutes.
  • If possible, we recommend organizing the class in half-groups, so as to avoid having too many pairs to manage at once. While half the class works on Scratch, the other should do something else independently.
  • If possible, two Scratch sessions should be organized weekly, at least at the beginning.
  • This step of getting to know Scratch is deliberately very directive (activities 0 and 1 are actually a demonstration by the teacher!). It is the only step presented in this form. All pairs will have to carry out a series of basic tasks. At the end of each activity, a group discussion ensures that everyone has understood and knows what to do. The other steps will be less directive, as students become more independent and progress at their own pace.
  • To save time, switch on the computers before the session begins.

2.1: Exercise Answers- Main Page

In the introduction to “They Say/ I Say”: The Moves That Matter in Academic Writing, Gerald Graff and Cathy Birkenstein provide templates designed to educate persuasive writing. Specifically, Graff and Birkenstein argue that the types of writing templates they offer practice abstract principles of writing. As the authors themselves put it, “they say____ I say ___ formula”. Although some people believe critical writing goes deeper than any set of formulas, Graff and Birkenstein insist that deeper habits of thought cannot be put into practice unless you have a way of expressing them in an efficient, organized matter. In sum, then, their view is that templates are a great way of practicing persuasive writing. I agree. In my view, the types of templates that the authors recommend are helpful in organizing thought in a coherent matter. For instance, the templates give ideas on how to give a good start to a sentence. In addition, they also put the sentences in an order that makes sense and transitions smoothly. Some might object, of course, on the grounds that the templates do not allow writers to figure out on their own how paragraphs should be structured. Overall, then, I believe templates are a good way for beginner writers to learn how to put together an organized paragraph – an important point to make given that writing is all about putting thoughts in an organized matter.

The term “Sorority” tends to be synonymous with “partier” in many people’s minds. They see sororities as a cult that brainwashes its followers into eliminating as essential part of their daily life for an abstract goal of “partying.” However, few sorority girls choose to have their life all about partying. On the contrary, many of these supposed partiers do not go out and party at all. For the truth is that girls do not join a sorority just so they can have a reason to party. They join sororities to be apart of a sisterhood, being able to get involved in community service, making friends. In this essay, then, closely examining sororities and what they are really all about and not just partying.

If ever there was an idea custom-made for Jay Leno monologue, this was it: Global Warming. Isn’t that like summer? Whatever happened to the sun and heat in Syracuse? I happen to sympathize with global warming, though, perhaps because I do not like the cold and winter season.

1) Animal testing aids researchers in finding drugs and treatments to improve health and medicine. Many medical treatments have been made possible by animal testing like cancer, HIV drugs, insulin, and antibiotics. Also animal testing helps to ensure the safety of drugs and other substances humans are exposed to everyday.

2) In animal testing countless animals are experimented on then killed after their use. Many of these animals received tests that will never see approval and public consumption. This shows that the animal died in vain because of no direct benefit to humans. Also animal’s reactions to substances is different that human’s so animal testing is not even all that accurate.

In “My Freshman Year” chapter two called “Life in the Dorms" by Rebekah Nathan, Nathan quotes an RA’s actual words to make a point in her story. The quote was about was saying that underage drinking is illegal but if the door is closed and the RA has no reason to go in then the students can get away with it. Nathan then uses the quote to tie in how student authority was tied into college culture. She said that “bad” RAs enforce the rules and “good” RAs do not according to the students.

Nathan, Rebekah. My Freshman Year: What a Professor Learned by Becoming a Student. Ithaca: Cornell UP, 2005. Print.

In the essay “Don’t Blame the Eater” author David Zinczenko is talking about the connection between cheap, affordable fast food restaurants and their affects on obesity. Zinczenko starts off by talking about how kids are suing McDonald’s for making them fat. He does not seem like he quite agrees with this at first “Isn’t that like middle-aged men suing Porsche for making them get speeding tickets? Whatever happened to personal responsibility?” But then he changes his tone and becomes more sympathetic due to personal experiences. “By age 15, I had packed 212 pounds of torpid teenage tallow on my once lanky 5-foot-10 frame.” He got lucky though because when he went to college he joined the Navy Reserves and joined a health magazine. But he knows that not everyone is that fortunate and they still have health problems today. He goes on to explain how fast foods do not have warning labels on them like tobacco does even though they are both bad for your health. He even says that nowadays 30 percent of diabetes patients have Type 2 diabetes. He seems to pretty much agree with the kids wanting to sue McDonald’s.

Marx and Engles wrote: "Society as a whole is more and more splitting up into two great hostile camps, into two great classes directly facing each other--the bourgeoisie and the proletariat" (10). (The views of others) If only that were true, things might be more simple. But in late twentieth-century America, it seems that society is splitting more and more into a plethora of class factions -- the working class, the working poor, lower-middle, upper-middle, lower uppers, and upper uppers. I find myself not knowing what class I'm from. (Her views)

In my days as a newspaper reporter, I once asked a sociology professor what he thought about the reported shrinking of the middle class. Oh, its not the middle class that's disappearing, he said, but the working class. His definition: if you earn thirty thousand dollars a year working in an assembly plant, come home from work, open a beer and watch the game, you are working class if you earn twenty thousand dollars a year, come home from work to a glass of white wine and PBS, you are middle class. (The views of others)

How do we define class? Is it an issue of values, lifestyle, taste? Is it the kind of work you do, your relationship to the means of production? Is it a matter of how much money you earn? Are we allowed to choose? In this land of supposed classlessness, where we don't have the tradition of English society to keep us in our place, how do we know where we really belong? The average American will tell you he or she is "middle class." I'm sure that's what my father would tell you. (The views of others) But I always felt that we were in some no man's land, suspended between classes, sharing similarities with some and recognizing sharp, exclusionary differences from others. (Her views) What class do I come from? What class am I in now? As an historian, I seek the answers to these questions in the specificity of my past. (Her views)

JULIE CHARLIP, "A Real Class Act: Searching for Identity in the Classless Society"

The United States must declare an end to the war on drugs. This war has filled the nation's prisons with poor drug addicts and small-time drug dealers. It has created a multi-billion dollar black market, enriched organized crime groups and promoted the corruption of government officials throughout the world. And it has not stemmed the widespread use of illegal drugs. By any rational measure, this war has been a total failure.

We must develop pubic policies on substance abuse that are guided not by moral righteousness or political expediency but by common sense. The United States should immediately decriminalize the cultivation and possession of small amounts of marijuana for personal use. Marijuana should no longer be classified as a Schedule I narcotic, and those who seek to use marijuana as medicine should no longer face criminal sanctions. We must shift our entire approach to drug abuse from the criminal justice system to the public health system. Congress should appoint an independent commission to study the harm-reduction policies that have been adopted in Switzerland, Spain, Portugal, and the Netherlands. The commission should recommend policies for the United States based on one important criterion: what works.

Say we were to make it easy for people to get marijuana for medical use. What if all drug dealers start saying that they were just using marijuana as medicine? Then how would we be able to tell who really needed it and who was lying? If this was the case then we would need to make sure the patient went through a variety of tests to prove that they are in need of medical marijuana then they can get a prescription for it from a doctor. The patient should also have a background check to make sure they do not have a history of drug abuse.

In a nation where pharmaceutical companies advertise powerful antidepressants on billboards and where alcohol companies run amusing beer ads during the Super Bowl, the idea of a "drug-free society" is absurd. Like the rest of American society, our drug policy would greatly benefit from more punishment and more compassion.

ERIC SCHLOSSER, "A People's Democratic Platform"

The article “Music and Cognitive Analysis” by E. Glenn Schellenberg, Professor of Psychology at University of Toronto, explains how music can actually make people more intellectual. Schellenberg explains the “so what” and “who cares”. He says that music exposure during infancy, when the brain is still in plasticity is the greatest, can cause neural connections and have long-term impacts. Schellenberg did not come right out and say it but we can assume that parents of infants or expecting parents would like to know this effect of music on the infant brain. If there were no indications of in the article of who would care to know this information then the article becomes pointless. It loses the sense of trying to prove a point and keep the reader’s attention.

Schellenberg, E. Glenn. "Music and Cognitive Analysis." Current Directions in Psychological Science 14.6 (2005): 317-20. JSTOR . Web. 2 Mar. 2011.

Annotation key: red = key terms, underline = transitions, blue = pointing terms

Our civilisation. is founded on coa l, more completely than one realises until one stops to think about it. The machines that keep us alive, and the machines that make the machines , are all directly or indirectly dependent upon coal. In the metabolism of the western world the coal-miner is second in importance only to the man who ploughs the soil. He is a sort of grimy caryatid upon whose shoulders nearly everything that is not grimy is supported. For this reason , the actual process by which coal is extracted is well worth watching, if you get the chance and are willing to take the trouble.

When you go down a coal-min e it is important to try and get to the coal face when the (fillers) are at work. This is not easy, because when the mine is working, visitors are a nuisance, and are not encouraged, but if you go at any other time, it is possible to come away with a totally wrong impression. On a Sunday, for instance, a mine seems almost peaceful. The time to go there is when the machines are roaring and the air is black with coal dust, and when you can actually see what the miners have to do. At those times , the place is like hell , or at any rate like my own mental picture of hell . Most of the things one imagines in hell are there--heat, noise, confusion, darkness, foul air, and, above all, unbearably cramped space. Everything except the fire, for there is no fire down there except the feeble beams of Davy lamps and electric torches which scarcely penetrate the clouds of coal dust.

When you have finally got there - and getting there is a job in itself: I will explain that in a moment - you crawl through the last line of pit props and see opposite you a shiny black wall three or four feet high. This is the coal face. Overhead is the smooth ceiling made by the rock from which the coal has been cut underneath is the rock again, so that the gallery you are in is only as high as the ledge of coal itself, probably not much more than a yard. The first impression of all, overmastering everything else for awhile, is the frightful, deafening din from the conveyer belt which carries the coal away. You can not see very far, because the fog of coal dust throws back the beam of your lamp, but you can see on either side of you the line of half naked kneeling men, one to every four or five yards, driving their shovels under the fallen coal and flinging it swiftly over their left shoulders.

GEORGE ORWELL, The Road to Wigan Pier

1) Original: To adequately frame a quotation, you need to insert it into what we like to call a “quotation sandwich,” with the statement introducing it serving as the top slice of bread and the explanation following it serving as the bottom slice. The introductory or lead-in claims should explain who is speaking and set up what the quotation says the follow-up statements should explain why you consider the quotation to be important and what you take it to say.

2) Informal: To frame a quotation, you need to insert it into a “quotation sandwich,” with the statement starting it serving as the top slice of bread and the explanation following it serving as the bottom slice. The beginning or lead-in claims should explain who is speaking and set up what the quotation says the follow-up statements should explain why you consider the quotation to be important and what you take it to say.

3) Formal: To adequately frame a quotation, insert it into “quotation sandwich,” with the statement introducing it serving as the top slice of bread and the explanation following it serving as the bottom slice. The introductory or lead-in claims should explain who is speaking and set up what the quotation says the follow-up statements should explain why the quotation is important and it says.

4) Formal and Informal: To adequately frame a quotation, insert it into what we like to call a “quotation sandwich,” with the statement introducing it serving as the top slice of bread and the explanation following it serving as the bottom slice. The introductory or lead-in claims should explain who is speaking and set up what the quotation says the follow-up statements should explain why the quotation is important and what you take it to say.

· In making a case for the medical use of marijuana, I am not saying that marijuana is a safe form of medication.

· But my argument will do more than prove that one particular industrial chemical has certain toxic properties. In this article, I will also show that industrial chemicals have unknown properties about them.

· My point about the national obsessions with sports reinforces the belief held by many people have an unrealistic view that athletes are gods.

· I believe, therefore, that the war is completely unjustified. But let me back up and explain how I arrived at this conclusion: My grandfather died in the war and if I there was no war he would still be alive today. In this way, I came to believe the war is a big mistake.


Correct answers are in bold.

1. I want an apple from that basket.

2. The church on the corner is progressive.

3. Miss Lin speaks Chinese. (no article needed)

4. I borrowed a pencil from your pile of pencils and pens.

5. One of the students said, "The professor is late today."

6. Eli likes to play volleyball. (no article needed)

7. I bought an umbrella to go out in the rain.

8. My daughter is learning to play the violin at her school.

9. Please give me the cake that is on the counter.

10. I lived on Main Street when I first came to town. (no article needed)

11. Albany is the capital of New York State. (no article needed)

12. My husband's family speaks Polish. (no article needed)

13. An apple a day keeps the doctor away.

14. The ink in my pen is red.

15. Our neighbors have a cat and a dog.


Welcome to the OWL Exercise Pages

To navigate the OWL exercises, please use the navigation bar on the left. You may also print the exercises and the exercise answers by using the "Print this Resource" bottom at the bottom of this page.

If you cannot find an exercise you have used in the past, or if you have a suggestion for adding an exercise, please let us know. As always, please contact either of the Assistant Directors of Content Development if you have any questions. We value your feedback. Thank you.

Note: Users may notice that the OWL exercises no longer offer the dropdown option. The reason we had to eliminate this is because the OWL staff is dedicated to the W3C and Section 508 compliance guidelines, which were a major consideration for the original OWL redesign in 2006. Unfortunately, the dropdown options in the original OWL exercises did not comply with W3C and section 508 standards because the dropdowns cannot be used with some adaptive technologies. The new exercises can be used with adaptive technologies.


NCERT Solutions for Class 11 Maths Chapter 2 – Relations & Functions

This FREE Class 11 Maths NCERT Solutions Chapter 2 – Relations & Functions provides you Exercise-wise solution covering all problem sums as prescribed latest CBSE Textbook. Step by Step solutions for all exercise sums is easily understood by the Class 11 Students. In this Class 11 Maths NCERT Solutions Chapter 2, you can learn about the definition of relation, concepts of ordered pairs, number of elements in the cartesian product of two finite sets, Cartesian product of sets, pictorial diagrams, domain, co-domain and range of a relation. And also you learn here about polynomial, rational, modulus, logarithmic signum, exponential, and greatest integer functions with graphical representation etc. All NCERT Solutions for class 11 maths chapter 2 Relations & Functions are based on the 12th Class Maths Book Solution. You can also download free NCERT Solutions for Class 11 Maths PDF without any registration. Find the Chapter Sets Class 12 Maths Solutions in Hindi medium and English medium here and learn which medium as per your need.

Class 11 Maths NCERT Solutions Chapter 2 – Relations & Functions has three exercises, and you can download FREE PDFs here to learn offline.

Free NCERT Solutions for Class 11 Maths Chapter 2 in PDF


C++ Basic: Exercises, Practice, Solution

2. Write a program in C++ to print the sum of two numbers. Go to the editor
Sample Output:
Print the sum of two numbers :
-----------------------------------
The sum of 29 and 30 is : 59
Click me to see the sample solution

3. Write a program in C++ to find Size of fundamental data types. Go to the editor
Sample Output:
Find Size of fundamental data types :
------------------------------------------
The sizeof(char) is : 1 bytes
The sizeof(short) is : 2 bytes
The sizeof(int) is : 4 bytes
The sizeof(long) is : 8 bytes
The sizeof(long long) is : 8 bytes
The sizeof(float) is : 4 bytes
The sizeof(double) is : 8 bytes
The sizeof(long double) is : 16 bytes
The sizeof(bool) is : 1 bytes
Click me to see the sample solution

4. Write a program in C++ to print the sum of two numbers using variables. Go to the editor
Print the sum of two numbers :
-----------------------------------
The sum of 29 and 30 is : 59
Click me to see the sample solution

5. Write a program in C++ to check the upper and lower limits of integer. Go to the editor
Expected Output:
Check the upper and lower limits of integer :
--------------------------------------------------
The maximum limit of int data type : 2147483647
The minimum limit of int data type : -2147483648
The maximum limit of unsigned int data type : 4294967295
The maximum limit of long long data type : 9223372036854775807
The minimum limit of long long data type : -9223372036854775808
The maximum limit of unsigned long long data type : 18446744073709551615
The Bits contain in char data type : 8
The maximum limit of char data type : 127
The minimum limit of char data type : -128
The maximum limit of signed char data type : 127
The minimum limit of signed char data type : -128
The maximum limit of unsigned char data type : 255
The minimum limit of short data type : -32768
The maximum limit of short data type : 32767
The maximum limit of unsigned short data type : 65535
Click me to see the sample solution

6. Write a program in C++ to check whether the primitive values crossing the limits or not. Go to the editor
Check whether the primitive values crossing the limits or not :
--------------------------------------------------------------------
The Gender is : F
Is she married? : 1
Number of sons she has : 2
Year of her appointment : 2009
Salary for a year : 1500000
Height is : 79.48
GPA is 4.69
Salary drawn upto : 12047235
Balance till : 995324987
Click me to see the sample solution

7. Write a program in C++ to display various type or arithmetic operation using mixed data type. Go to the editor
Sample output:
Display arithmetic operations with mixed data type :
---------------------------------------------------------
5 + 7 = 12
3.7 + 8.0 = 11.7
5 + 8.0 = 13.0
5 - 7 = -2
3.7 - 8.0 = -4.3
5 - 8.0 = -3.0
5 * 7 = 35
3.7 * 8.0 = 29.6
5 * 8.0 = 40.0
5 / 7 = 0
3.7 / 8.0 = 0.5
5 / 8.0 = 0.6
Click me to see the sample solution

8. Write a program in C++ to check overflow/underflow during various arithmetical operation. Go to the editor
Sample Output:
Check overflow/underflow during various arithmetical operation :
Range of int is [-2147483648, 2147483647]
---------------------------------------------------------------------
Overflow the integer range and set in minimum range : -2147483648
Increasing from its minimum range : -2147483647
Product is :1
Underflow the range and set in maximum range : 2147483647
Decreasing from its maximum range : 2147483646
Product is : 0
Click me to see the sample solution

9. Write a program in C++ to display the operation of pre and post increment and decrement. Go to the editor
Sample Output:
Display the operation of pre and post increment and decrement :
--------------------------------------------------------------------
The number is : 57
After post increment by 1 the number is : 58
After pre increment by 1 the number is : 59
After increasing by 1 the number is : 60
After post decrement by 1 the number is : 59
After pre decrement by 1 the number is : 58
After decreasing by 1 the number is : 57
Click me to see the sample solution

10. Write a program in C++ to formatting the output. Go to the editor
Sample Output:
Formatting the output :
----------------------------
The value of pi : 3.1416
The value of pi 4 decimal place of total width 8 : | 3.1416|
The value of pi 4 decimal place of total width 10 : | 3.1416|
The value of pi 4 decimal place of total width 8 : |--3.1416|
The value of pi 4 decimal place of total width 10 : |----3.1416|
The value of pi in scientific format is : 3.1416e+00
Status in number : 0
Status in alphabet : false
Click me to see the sample solution

11. Write a program in C++ to print the result of the specified operations. Go to the editor
Sample Output:
Print the result of some specific operation :
--------------------------------------------------
Result of 1st expression is : 23
Result of 2nd expression is : 5
Result of 3rd expression is : 12
Result of 4th expression is : 3
Click me to see the sample solution

12. Write a program in C++ to add two numbers accept through keyboard. Go to the editor
Sample Output:
Sum of two numbers :
-------------------------
Input 1st number : 25
Input 2nd number : 39
The sum of the numbers is : 64
Click me to see the sample solution

13. Write a program in C++ to swap two numbers. Go to the editor
Sample Output:
Swap two numbers :
-----------------------
Input 1st number : 25
Input 2nd number : 39
After swapping the 1st number is : 39
After swapping the 2nd number is : 25
Click me to see the sample solution

14. Write a program in C++ to calculate the volume of a sphere. Go to the editor
Sample Output:
Calculate the volume of a sphere :
---------------------------------------
Input the radius of a sphere : 6
The volume of a sphere is : 904.32
Click me to see the sample solution

15. Write a program in C++ to calculate the volume of a cube. Go to the editor
Sample Output:
Calculate the volume of a cube :
---------------------------------------
Input the side of a cube : 5
The volume of a cube is : 125
Click me to see the sample solution

16. Write a program in C++ to calculate the volume of a cylinder. Go to the editor
Sample Output:
Calculate the volume of a cylinder :
-----------------------------------------
Input the radius of the cylinder : 6
Input the height of the cylinder : 8
The volume of a cylinder is : 904.32
Click me to see the sample solution

17. Write a program in C++ to find the Area and Perimeter of a Rectangle. Go to the editor
Sample Output:
Find the Area and Perimeter of a Rectangle :
-------------------------------------------------
Input the length of the rectangle : 10
Input the width of the rectangle : 15
The area of the rectangle is : 150
The perimeter of the rectangle is : 50
Click me to see the sample solution

18. Write a program in C++ to find the area of any triangle using Heron's Formula. Go to the editor
Sample Output:
Find the area of any triangle using Heron's Formula :
----------------------------------------------------------
Input the length of 1st side of the triangle : 5
Input the length of 2nd side of the triangle : 5
Input the length of 3rd side of the triangle : 5
The area of the triangle is : 10.8253
Click me to see the sample solution

19. Write a program in C++ to find the area and circumference of a circle. Go to the editor
Sample Output:
Find the area and circumference of any circle :
----------------------------------------------------
Input the radius(1/2 of diameter) of a circle : 5
The area of the circle is : 78.5397
The circumference of the circle is : 31.4159
Click me to see the sample solution

20. Write a program in C++ to convert temperature in Celsius to Fahrenheit. Go to the editor
Sample Output:
Convert temperature in Celsius to Fahrenheit :
---------------------------------------------------
Input the temperature in Celsius : 35
The temperature in Celsius : 35
The temperature in Fahrenheit : 95
Click me to see the sample solution

21. Write a program in C++ to convert temperature in Fahrenheit to Celsius. Go to the editor
Sample Output:
Convert temperature in Fahrenheit to Celsius :
---------------------------------------------------
Input the temperature in Fahrenheit : 95
The temperature in Fahrenheit : 95
The temperature in Celsius : 35
Click me to see the sample solution

22. Write a program in C++ to find the third angle of a triangle. Go to the editor
Sample Output:
Find the third angle of a triangle :
-----------------------------------------
Input the 1st angle of the triangle : 30
Input the 2nd angle of the triangle : 60
The 3rd of the triangle is : 90
Click me to see the sample solution

23. Write a program in C++ that converts kilometers per hour to miles per hour. Go to the editor
Sample Output:
Convert kilometers per hour to miles per hour :
----------------------------------------------------
Input the distance in kilometer : 25
The 25 Km./hr. means 15.5343 Miles/hr.
Click me to see the sample solution

24. Write a program in C++ to convert temperature in Kelvin to Fahrenheit. Go to the editor
Sample Output:
Convert temperature in Kelvin to Fahrenheit :
---------------------------------------------------
Input the temperature in Kelvin : 300
The temperature in Kelvin : 300
The temperature in Fahrenheit : 80.33
Click me to see the sample solution

25. Write a program in C++ to convert temperature in Kelvin to Celsius. Go to the editor Sample Output:
Convert temperature in Kelvin to Celsius :
------------------------------------------------
Input the temperature in Kelvin : 300
The temperature in Kelvin : 300
The temperature in Celsius : 26.85

26. Write a program in C++ to convert temperature in Fahrenheit to Kelvin. Go to the editor
Sample Output:
Convert temperature in Fahrenheit to Kelvin :
---------------------------------------------------
Input the temperature in Fahrenheit : 80.33
The temperature in Fahrenheit : 80.33
The temperature in Kelvin : 300
Click me to see the sample solution

27. Write a program in C++ to convert temperature in Celsius to Kelvin. Go to the editor
Sample Output:
Convert temperature in Celsius to Kelvin :
---------------------------------------------------
Input the temperature in Celsius : 26.85
The temperature in Celsius : 26.85
The temperature in Kelvin : 300
Click me to see the sample solution

28. Write a program in C++ to find the area of Scalene Triangle. Go to the editor
Sample Output:
Find the area of Scalene Triangle :
----------------------------------------
Input the length of a side of the triangle : 5
Input the length of another side of the triangle : 6
Input the angle between these sides of the triangle : 6
The area of the Scalene Triangle is : 1.56793
Click me to see the sample solution

29. Write a program in C++ to compute quotient and remainder. Go to the editor
Sample Output:
Compute quotient and remainder :
-------------------------------------
Input the dividend : 25
Input the divisor : 3
The quotient of the division is : 8
The remainder of the division is : 1
Click me to see the sample solution

30. Write a program in C++ to compute the total and average of four numbers. Go to the editor
Sample Output:
Compute the total and average of four numbers :
----------------------------------------------------
Input 1st two numbers (separated by space) : 25 20
Input last two numbers (separated by space) : 15 25
The total of four numbers is : 85
The average of four numbers is : 21.25
Click me to see the sample solution

31. Write a program in C++ to input a single digit number and print a rectangular form of 4 columns and 6 rows. Go to the editor
Sample Output:
Make a rectangular shape by a single digit number :
--------------------------------------------------------
Input the number : 5
5555
5 5
5 5
5 5
5 5
5555
Click me to see the sample solution

32. Write a program in C++ to check whether a number is positive, negative or zero. Go to the editor
Sample Output:
Check whether a number is positive, negative or zero :
-----------------------------------------------------------
Input a number : 8
The entered number is positive.
Click me to see the sample solution

33. Write a program in C++ to divide two numbers and print on the screen. Go to the editor
Sample Output:
Divide two numbers and print:
----------------------------------
The quotient of 30 and 10 is : 3
Click me to see the sample solution

34. Write a C++ program to display the current date and time. Go to the editor
Sample Output:
Display the Current Date and Time :
----------------------------------------
seconds = 57
minutes = 33
hours = 12
day of month = 6
month of year = 7
year = 2017
weekday = 4
day of year = 186
daylight savings = 0
Current Date: 6/7/2017
Current Time: 12:33:57
Click me to see the sample solution

35. Write a program in C++ to compute the specified expressions and print the output. Go to the editor
Sample Output:
Compute the specified expressions and print the output:
------------------------------------------------------------
Result of the expression (25.5 * 3.5 - 3.5 * 3.5) / (40.5 - 4.5) is : 2.13889
Click me to see the sample solution

36. Write a program in C++ to test the Type Casting. Go to the editor
Sample Output:
Formatting the output using type casting:
----------------------------------------------
Print floating-point number in fixed format with 1 decimal place:
Test explicit type casting :
0
0.5
0.5
0.0
Test implicit type casting :
0
0
int implicitly casts to double:
4.0
double truncates to int!:
6
Click me to see the sample solution

37. Write a program in C++ to print a mystery series from 1 to 50. Go to the editor
Sample Output:
Print a mystery series:
-------------------------
The series are:
5 4 2 7 11 10 8 13 17 16 14 19 23 22 20 25 29 28 26 31 35 34 32 37 41 4 0 38 43 47 46 44 49
Click me to see the sample solution

38. Write a program in C++ that takes a number as input and prints its multiplication table upto 10. Go to the editor
Sample Output:
Print the multiplication table of a number upto 10:
--------------------------------------------------------
Input a number: 5
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50
Click me to see the sample solution

39. Write a program in C++ to print the following pattern. Go to the editor
Sample Output:

40. Write a program in C++ to print the area and perimeter of a rectangle. Go to the editor
Sample Output:
Print the area and perimeter of a rectangle:
----------------------------------------------
Input the width of the rectangle: 8.5
Input the height of the rectangle: 5.6
The area of the rectangle is: 47.6
The perimeter of the rectangle is: 28.2
Click me to see the sample solution

41. Write a program in C++ to print an American flag on the screen. Go to the editor
Sample Output:
Click me to see the sample solution

42. Write a language program in C++ which accepts the user's first and last name and print them in reverse order with a space between them. Go to the editor
Sample Output:
Print the name in reverse where last name comes first:
-----------------------------------------------------------
Input First Name: Alexandra
Input Last Name: Abramov
Name in reverse is: Abramov Alexandra
Click me to see the sample solution

43. Write a language program which accepts the radius of a circle from the user and compute the area and circumference. Go to the editor
Sample Output:
Find the area and circumference of any circle :
----------------------------------------------------
Input the radius(1/2 of diameter) of a circle : 5
The area of the circle is : 78.5397
The circumference of the circle is : 31.4159
Click me to see the sample solution

44. Write a language program to get the volume of a sphere with radius 6. Go to the editor
Sample Output:
Calculate the volume of a sphere :
---------------------------------------
Input the radius of a sphere : 5
The volume of a sphere is : 523.333
Click me to see the sample solution

45. Write a program in C++ to calculate the volume of a cube. Go to the editor
Sample Output:
Calculate the volume of a cube :
---------------------------------------
Input the side of a cube : 5
The volume of a cube is : 125
Click me to see the sample solution

46. Write a program in C++ to calculate the volume of a cylinder. Go to the editor
Sample Output:
Calculate the volume of a cylinder :
-----------------------------------------
Input the radius of the cylinder : 4
Input the height of the cylinder : 8
The volume of a cylinder is : 401.92
Click me to see the sample solution

47. Write a program in C++ to find the area of any triangle using Heron's Formula. Go to the editor
Sample Output:
Find the area of any triangle using Heron's Formula :
----------------------------------------------------------
Input the length of 1st side of the triangle : 5
Input the length of 2nd side of the triangle : 6
Input the length of 3rd side of the triangle : 7
The area of the triangle is : 14.6969
Click me to see the sample solution

48. Write a program in C++ which swap the values of two variables not using third variable. Go to the editor
Sample Output:
Swap two numbers without using third variable:
---------------------------------------------------
Input 1st number : 25
Input 2nd number : 20
After swapping the 1st number is : 20
After swapping the 2nd number is : 25
Click me to see the sample solution

49. Write a program in C++ to print the code (ASCII code / Unicode code etc.) of a given character. Go to the editor
Sample Output:
Print code (ASCII code / Unicode code etc.) of a given character:
-----------------------------------------------------------------------
Input a character: a
The ASCII value of a is: 97
The character for the ASCII value 97 is: a
Click me to see the sample solution

50. Write a program in C++ to enter length in centimeter and convert it into meter and kilometer. Go to the editor
Sample Output:
Convert centimeter into meter and kilometer :
--------------------------------------------------
Input the distance in centimeter : 250000
The distance in meter is: 2500
The distance in kilometer is: 2.5
Click me to see the sample solution

51. Write a program in C++ that converts kilometers per hour to miles per hour. Go to the editor
Sample Output:
Convert kilometers per hour to miles per hour :
----------------------------------------------------
Input the distance in kilometer : 5
The 5 Km./hr. means 3.10686 Miles/hr.
Click me to see the sample solution

52. Write a program in C++ to enter two angles of a triangle and find the third angle. Go to the editor
Sample Output:
Find the third angle of a triangle :
-----------------------------------------
Input the 1st angle of the triangle : 35
Input the 2nd angle of the triangle : 35
The 3rd of the triangle is : 110
Click me to see the sample solution

53. Write a program in C++ to calculate area of an equilateral triangle. Go to the editor
Sample Output:
Calculate the area of the Equilateral Triangle :
----------------------------------------------------
Input the value of the side of the equilateral triangle: 5
The area of equilateral triangle is: 10.8253
Click me to see the sample solution

54. Write a program in C++ to enter P, T, R and calculate Simple Interest. Go to the editor
Sample Output:
Calculate the Simple Interest :
-----------------------------------
Input the Principle: 20000
Input the Rate of Interest: 10
Input the Time: 1.5
The Simple interest for the amount 20000 for 1 years @ 10 % is: 2000
Click me to see the sample solution

55. Write a program in C++ to enter P, T, R and calculate Compound Interest. Go to the editor
Sample Output:
Calculate the Compound Interest :
------------------------------------- Input the Principle: 20000
Input the Rate of Interest: 10
Input the Time: 1.5
The Interest after compounded for the amount 20000 for 1.5 years @ 10
% is: 3073.8 The total amount after compounded for the amount 20000 for 1.5 years @
10 % is: 23073.8
Click me to see the sample solution

56. Write a program in C++ to show the manipulation of a string. Go to the editor
Sample Output:
Show the manipulation of a string:
-------------------------------------
The string:: welcome, w3resource
The length of the string:: 19
The char at index 1 of the string:: e
The char at index 1 of the string [using array ]:: e
Is the string empty:: 0
Retrieve the sub-string from 3rd position for 4 characters:: come
The sub-string replace by 'went':: welwent, w3resource
Append a string 'end' at last of the string:: welwent, w3resource end
Append a string 'end' at last of the string using operator:: welwent, w3resource end end
The string 'insert' inserting at 3rd position of the string:: wel inse rt went, w3resource end
The new string is:: wel insert went, w3resource end
Input a sentence:: The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Click me to see the sample solution

57. Write a program in C++ to print the area of a hexagon. Go to the editor
Sample Output:
Print the area of a hexagon:
---------------------------------
Input the side of the hexagon: 6
The area of the hexagon is: 93.5307
Click me to see the sample solution

58. Write a program in C++ to print the area of a polygon. Go to the editor
Sample Output:
Print the area of a polygon:
---------------------------------
Input the number of sides of the polygon: 7
Input the length of each side of the polygon: 6
The area of the polygon is: 130.821
Click me to see the sample solution

59. Write a program in C++ to compute the distance between two points on the surface of earth. Go to the editor
Sample Output:
Print the the distance between two points on the surface of earth:
-----------------------------------------------------------------------
Input the latitude of coordinate 1: 25
Input the longitude of coordinate 1: 35
Input the latitude of coordinate 2: 35.5
Input the longitude of coordinate 2: 25.5
The distance between those points is: 1480.08
Click me to see the sample solution

60. Write a program in C++ to add two binary numbers. Go to the editor
Sample Output:
Addition of two binary numbers:
-----------------------------------
Input the 1st binary number: 1010
Input the 2nd binary number: 0011
The sum of two binary numbers is: 1101
Click me to see the sample solution

61. Write a C++ program to swap first and last digits of any number. Go to the editor
Sample Output:
Input any number: 12345
The number after swapping the first and last digits are: 52341
Click me to see the sample solution

62. Write a C++ program to which reads an given integer n and prints a twin prime which has the maximum size among twin primes less than or equals to n. Go to the editor
According to wikipedia "A twin prime is a prime number that is either 2 less or 2 more than another prime number" for example, either member of the twin prime pair (41, 43). In other words, a twin prime is a prime that has a prime gap of two".
Click me to see the sample solution

63. Write a C++ program which prints three highest numbers from a list of numbers in descending order. Go to the editor
Click me to see the sample solution

64. Write a C++ program to compute the sum of the two given integers and count the number of digits of the sum value. Go to the editor
Click me to see the sample solution

65. Write a C++ program to check whether given length of three side form a right triangle. Go to the editor
Click me to see the sample solution

66. Write a C++ program to add all the numbers from 1 to a given number. Go to the editor
Add 1 to 4: 10
Add 1 to 100: 5050
Click me to see the sample solution

67. Write a C++ program to which prints the central coordinate and the radius of a circumscribed circle of a triangle which is created by three points on the plane surface. Go to the editor
Click me to see the sample solution

68. Write a C++ program to read seven numbers and sorts them in descending order. Go to the editor
Click me to see the sample solution

69. Write a C++ program to read an integer n and prints the factorial of n, assume that n = 10. Go to the editor
Click me to see the sample solution

70. Write a C++ program to replace all the lower-case letters of a given string with the corresponding capital letters.Go to the editor
Click me to see the sample solution

71. Write a C++ program which reads a sequence of integers and prints mode values of the sequence. The number of integers is greater than or equals to 1 and less than or equals to 100. Go to the editor
Note: The mode of a set of data values is the value that appears most often.
Click me to see the sample solution

72. Write a C++ program to which reads n digits chosen from 0 to 9 and counts the number of combinations where the sum of the digits equals to given number. Do not use the same digits in a combination. Go to the editor
For example, the combinations where n = 2 and s = 5 are as follows:
0 + 5 = 5
1 + 4 = 5
3 + 2 = 5
Click me to see the sample solution

73. Write a C++ program that accepts sales unit price and sales quantity of various items and compute total sales amount and the average sales quantity. All input values must greater than or equal to 0 and less than or equal to 1,000, and the number of pairs of sales unit and sales quantity does not exceed 100. If a fraction occurs in the average of the sales quantity, round the first decimal place. Go to the editor
Click me to see the sample solution

74. Write a C++ program that accepts various numbers and compute the difference between the highest number and the lowest number. All input numbers should be real numbers between 0 and 1,000,000. The output (real number) may include an error of 0.01 or less. Go to the editor
Click me to see the sample solution

75. Write a C++ program to compute the sum of the specified number of Prime numbers. Go to the editor
For example when n = 7,
s = 2 + 3 + 5 + 7 + 11 + 13 + 17 = 58.
Click me to see the sample solution

76. An even number of 4 or more can be represented by the sum of two prime numbers. This is called Goldbach expectation, and it is confirmed that it is correct up to a considerably large number by computer calculation. For example, 10 can be expressed as the sum of two prime numbers 7 + 3, 5 + 5. Write a C++ program that accept an integer (n) from the user and outputs the number of combinations that express n as a sum of two prime numbers. Go to the editor
Note: n should be greater than or equal to 4 and less than or equal to 50,000.
Click me to see the sample solution

77. There are four different points on a plane: A(x1, y1), B(x2, y2), C(x3, y3) and D(x4, y4).
Write a C++ program to check whether two straight lines AB and CD are orthogonal or not. Go to the editor
Input:
0 6
5 6
3 8
3 2
Output:
yes
Click me to see the sample solution

78. Write a C++ program to sum of all positive integers in a sentence. Go to the editor
Sample string: There are 12 chairs, 15 desks, 1 blackboard and 2 fans.
Output: 30
Click me to see the sample solution

79. Write a C++ program to display all the leap years between two given years. If there is no leap year in the given period,display a suitable message. Go to the editor
Note: Range of the two given years: ( 0

More to Come !

Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.


Modals – Meaning & Types – Exercises for Practice for use of modals

Modal means relating to some “mode, or form “. A modal verb is a helper that gives additional information about the verb that follows it, and includes such words as “can,” “will,” “should,” and “may,” among others.

Modals are : Will, Shall, Should, Would, May, Might, Must, Can, Need, Ought to, Used to etc.

Main features of Modals are:

These are used in the sentence to express a request, permission. willingness, possibility, ability or power to act.

These verbs are used along with the main verb. These are not used alone.Along with a modal first form of verb is used.

A Modal remains unchanged irrespective of number or gender of the subject.

The word ‘to’ is used along with ‘ought’ and ‘used’.

In these sentences ‘should’ and ‘may’ are helping verbs.

Here are exercises for practice for use of modals :

Fill in the blanks in the following sentences with modals – Will / Shall , Would/ Should or Can/Could.

  1. She told me that she was unwell so she………..not go to office.
  2. The visitors ………..not carry eatables with them in the hotel.
  3. As he is in dire need of money, we……………help him immediately.
  4. ……………..you please lend me your book for a week?
  5. His son is not so brilliant in his studies but he………….pass the examination.
  6. I ………be thankful to you if you help me at this time of need.
  7. Drive fast lest you……………miss the flight.
  8. ……………you like to accompany us to the market tomorrow?
  9. The lady has grown so old that she ……..not walk without a stick.
  10. Had he worked hard, he ………..have passed the examination.

1.would 2.can 3.should 4.could 5.will

6.shall 7.should 8.would 9.can 10. would

Fill in the blanks in the following sentences with modals – Will / Shall , Would/ Should or Can/Could, May/Might, used to, Must/ought to etc.

  1. She endeavoured her best to surpass the target but she……………..not.
  2. You……………….to have fulfilled your promise under all the circumstances.
  3. I assure you that I shall help you in this matter if I …………..
  4. He ………..have succeeded in his business if he had conducted it sincerely.
  5. The teacher advised him to work hard lest he ………fail in the examination.
  6. They feared that the thieves……….. have fled out of the city.
  7. His mentor helped him in his research work so that he………….complete it in time.
  8. Children……………respect their elders and get their blessings.
  9. The clever king…………..to wander in the city in the garb of a beggar at night.
  10. Had the manager told the whole truth to the boss, he……….. not have punished him.

1.could 2.should 3.can 4.would 5.should 6.might 7.could 8. must 9.used 10. would

Fill in the blanks in the following sentences with a correct one out of given options having appropriate use of a modal in it (Modals– Will / Shall , Would/ Should or Can/Could, May/Might, used to, Must/ought to etc.)

a. he should not be ruined like this.

b. he were not be ruined like this.

c. he would not have ruined like this.

d. he could not have ruined like this.

3. If the patient had not been provided with medical aid in time………………..

a. he would not have survived.

b. he could not have survived.

c. he may not have survived.

d. he will not have survived.

a. I had visited my native village every month.

b. I used to visit my native village every month.

c. I might visit my native village every month.

d. I would visit my native village every month.

5. The parents toiled hard during their whole life so that their…………….

a. children might prosper in their life.

b. children can prosper in their life.

c. children will prosper in their life.

d. children would prosper in their life.

6. You should take care of your health lest…………..

7. Those employees who have finished their work…………

a. will leave the office now.

b. may leave the office now.

c. could leave the office now.

d. might leave the office now.

a. would be joining a new job next month.

b. he will be joining a new job next month.

c. he shall be joining a new job next month.

d. he must be joining a new job next month.

10. You are advised not to eat raw fruit……………..

a. which will spoil your health.

b. which could spoil your health.

c. which can spoil your health.

d. which should spoil your health.

(Answers : 1. c 2.b 3. a 4.b 5.a 6.d 7.b 8.c 9.a 10. c)

Fill in the blanks in the following sentences with a correct one out of given options having appropriate use of a modal in it (Modals– Will / Shall , Would/ Should or Can/Could, May/Might, used to, Must/ought to etc.)

a. “would you please pay your attention to me?”

b. “will you please pay your attention to me?”

c.” shall you please pay your attention to me?”

d.” may you please pay your attention to me?”

a. your voice would be very melodious.

b. your voice will be very melodious.

c. your voice must be very melodious.

d. your voice should be very melodious.

a. We must observe rules of the road while driving

b. We can observe rules of the road while driving

c. We ought observe rules of the road while driving

d. We shall observe rules of the road while driving

a. yet he would not succeed in his examination.

b. yet he could not succeed in his examination.

c. yet he might not succeed in his examination.

d. yet he may not succeed in his examination.

a. we must know how to live on this earth.

b. we may know how to live on this earth.

c. we can know how to live on this earth.

d. we would know how to live on this earth.

Fill in the blanks in the following sentences with appropriate modals.

(Modals– Will / Shall , Would/ Should or Can/Could, May/Might)

Milk is a nutritious food enriched with vitamins and proteins. We 1.……………..take milk regularly so that we 2.………not develop deficiencies of undernourishment in our body. The aged persons, children and patients 3. ………………take milk in sufficient quantity as it provides strength to their body. We 4.……………. supplement it with other elements of food like fruit, vegetables and pulses for proper growth of the body. But we 5.……………consume milk of good quality only otherwise it 6……………cause harm to the body. We 7.…………..be very careful while selecting items of our food because there are chances that these 8.………………. be adulterated.

(Answers: 1.should 2. may 3. must 4. can 5.must 6. might 7.must 8. might )

Fill in the blanks in the following sentences with appropriate modals.

(Modals– Will / Shall , Would/ Should or Can/Could, May/Might)

Man 1…………………live without food and water for some time, but he 2.……………..not live without air. We 3………………..inhale pure, oxygen-rich air. Breathing foul or polluted air 4.……………….cause chest-related problems. Exposure to cold air 5.……………..be avoided. When a person catches cold, he 6………………take simple, light and easily digestible food. He 7 …………………. avoid going out in cold under all circumstances. He 8.…………… to keep his body warm by putting on woollen clothes.


Finding the Main Idea Paragraph 7: Relationships

At one time or another, most adults have been in a romantic relationship. A guy walks up to a girl at a bar, gets her number, and the beginning of a relationship is formed. A guy and a girl meet in Physics class, get paired as study partners, and the rest is history. Two high school sweethearts rekindle an old flame on Facebook after years apart. These types of simple encounters may lead to relationships, and even though that first meeting is easy, the entire relationship is not. A lot of work goes into making a true bonded relationship, and when that work is bypassed, the relationship may not last.


Popularity of Programming Language Worldwide, Jul 2021 compared to a year ago:

`
Rank Change Language Share Trend
1 Python 30.32 % -1.8 %
2 Java 17.79 % +1.0 %
3 Javascript 9.03 % +1.1 %
4 C# 6.55 % -0.2%
5 C/C++ 6.02 % +0.3 %
6 PHP 5.94 % +0.0 %
7 R 3.96 % -0.0 %
8 TypeScript 2.26 % +0.3 %
9 Objective-C 2.24 % -0.3 %
10 Swift 1.78 % -0.4 %
11 Kotlin1.75 % +0.3 %
12 Matlab 1.72 % -0.2 %
13 VBA 1.38 % +0.1 %
14 Go 1.28 % -0.1 %
15 Rust 1.26 % +0.3 %
16 Ruby 1.01 % -0.2 %
17 Visual Basic 0.76 % -0.1 %
18 Ada 0.74 % +0.3 %
19 Scala 0.72 % -0.3 %
20 Dart 0.61 % +0.1 %
21 Lua 0.54 % +0.1 %
22 Abap 0.44 % -0.0 %
23 Perl 0.38 % -0.0 %
24 Julia 0.36 % -0.0 %
25 Groovy 0.34 % -0.1 %
26 Cobol 0.3 % -0.1 %
27 Delphi/Pascal 0.27 % -0.0 %
28 Haskell 0.24 % -0.0 %

TIOBE Index for July 2021

Jul 2021 Jul 2020 Change Programming Language Ratings Change
1 1 C 11.62% -4.83%
2 2 Java 11.17% -3.93%
3 3 Python 10.95% +1.86%
4 4 C++ 8.01% +1.80%
5 5 C# 4.83% -0.42%
6 6 Visual Basic 4.50% -0.73%
7 7 JavaScript 2.71% +0.23%
8 9 PHP 2.58% +0.68%
9 13 Assembly language 2.40% +1.46%
10 11 SQL 1.53% +0.13%
11 20 Classic Visual Basic 1.39% +0.73%
12 8 R 1.32% -1.08%
13 12 Go 1.17% -0.04%
14 50 Fortan 1.12% +0.90%
15 24 Groovy 1.09% +0.51%
16 10 Swift 1.07% -0.37%
17 16 Ruby 0.95% +0.14%
18 14 Perl 0.90% +0.03%
19 15 MATLAB 0.88% +0.05%
20 30 Delphi/Object Pascal 0.85% +0.36%

[ Want to contribute to Python exercises? Send your code (attached with a .zip file) to us at w3resource[at]yahoo[dot]com. Please avoid copyrighted materials.]