js

Sunday, May 12, 2024

English Grammer: Tense

 

Exercise 1: Fill in the blanks with the correct form of the verbs in the present simple tense.

  1. She __________ (go) to school every day.
  2. They __________ (play) basketball in the park.
  3. I __________ (like) to eat pizza on Fridays.
  4. He __________ (study) Spanish in the evenings.
  5. We __________ (live) in this house for ten years.
  6. The sun __________ (rise) in the east.
  7. Cats __________ (sleep) a lot during the day.
  8. My parents __________ (work) in an office downtown.
  9. It __________ (rain) a lot in the winter here.
  10. The Earth __________ (revolve) around the sun.

Exercise 2: Write sentences using the present continuous tense.

  1. (I / read) a book right now.
  2. (She / cook) dinner for her family.
  3. (They / play) football in the park.
  4. (We / watch) a movie at home.
  5. (He / study) for his exams.
  6. (The cat / sleep) on the sofa.
  7. (My mom / talk) on the phone with her friend.
  8. (The children / run) around the playground.
  9. (It / rain) outside.
  10. (The teacher / teach) a lesson in the classroom.

Exercise 3: Choose the correct form of the verb.

  1. She __________ (is / are) a doctor.
  2. They __________ (am / is) from Canada.
  3. We __________ (am / are) going to the beach tomorrow.
  4. He __________ (am / is) not happy today.
  5. It __________ (am / is) raining outside.
  6. You __________ (is / are) my best friend.
  7. The cat __________ (am / is) sleeping on the bed.
  8. I __________ (am / is) reading a book right now.
  9. They __________ (am / are) playing soccer in the park.
  10. We __________ (am / are) not going to the party tonight.

Answers

Exercise 1: Fill in the blanks with the correct form of the verbs in the present simple tense.

  1. goes
  2. play
  3. like
  4. studies
  5. have lived
  6. rises
  7. sleep
  8. work
  9. rains
  10. revolves

Exercise 2: Write sentences using the present continuous tense.

  1. I am reading a book right now.
  2. She is cooking dinner for her family.
  3. They are playing football in the park.
  4. We are watching a movie at home.
  5. He is studying for his exams.
  6. The cat is sleeping on the sofa.
  7. My mom is talking on the phone with her friend.
  8. The children are running around the playground.
  9. It is raining outside.
  10. The teacher is teaching a lesson in the classroom.

Exercise 3: Choose the correct form of the verb.

  1. She is a doctor.
  2. They are from Canada.
  3. We are going to the beach tomorrow.
  4. He is not happy today.
  5. It is raining outside.
  6. You are my best friend.
  7. The cat is sleeping on the bed.
  8. I am reading a book right now.
  9. They are playing soccer in the park.
  10. We are not going to the party tonight.


 

Monday, April 22, 2024

Javascript: Explain JSON.stringify() in Javascript

 Q. Explain JSON.stringify() in Javascript

 

JSON.stringify() is a method in JavaScript that converts a JavaScript object or value into a JSON string. JSON stands for JavaScript Object Notation, and it's a lightweight data-interchange format that's easy for humans to read and write and easy for machines to parse and generate.

Here's how JSON.stringify() works:

  1. If the input value is an object (including arrays, dates, and plain objects), JSON.stringify() will serialize it into a JSON string.
  2. If the input value is not an object (like a string, number, boolean, or null), it will be coerced into its corresponding primitive value, and that value will be returned.
  3. If the input value is undefined, a function, or a symbol, it will be excluded from the resulting JSON string (or replaced with null if it's a property value within an object).

Here's a simple example:

javascript
const obj = {
name
: "John",
age
: 30,
isAdmin
: true,
hobbies: ["reading", "coding", "hiking"],
address: { city: "New York", zip: "10001" }
};
const
jsonString = JSON.stringify(obj);
console.log(jsonString);

This will output:

Result
{"name":"John","age":30,"isAdmin":true,"hobbies":["reading","coding","hiking"],"address":{"city":"New York","zip":"10001"}}

You can also provide a "replacer" function or an array of property names to specify which properties should be included or how they should be transformed during serialization. Additionally, you can specify a "space" parameter to add whitespace for improved readability of the resulting JSON string.

javascript
const obj = {
name
: "John",
age: 30,
isAdmin: true,
hobbies
: ["reading", "coding", "hiking"],
address: { city: "New York", zip: "10001" }
};
const jsonString = JSON.stringify(obj, ['name', 'hobbies'], 2);
console.log(jsonString);

This will output:

Result
{ "name": "John", "hobbies": [ "reading", "coding", "hiking" ] }

This is particularly useful when you want to exclude certain properties or control the structure of the resulting JSON string.

AHSEC| CLASS 11| GEOGRAPHY| SOLVED PAPER - 2015| H.S.1ST YEAR

  AHSEC| CLASS 11| GEOGRAPHY| SOLVED PAPER - 2015| H.S.1ST YEAR 2015 GEOGRAPHY SOLVED PAPER Full Marks: 70 Time: 3 hours The figures in the...