Structure in C | Chapter 9 | Class 10 Computer Science 571(NCERT) Question and Answer | Class 10 Computer Science 571(NCERT) Question and Answer Solutions English Medium |


Structure in C

Chapter 9


1. Define structure in the context of a programming language. How is it different from an array?

(āĻĒ্ā§°āĻ—্ā§°েāĻŽিং āĻ­াāώাā§° āĻĒ্ā§°āϏংāĻ—āϤ āĻ—āĻ āύ āϏংāϜ্āĻžাāϝ়িāϤ āϕ⧰া। āĻā§°েā§° āĻĒā§°া āχ āĻ•েāύেāĻ•ৈ āĻĒৃāĻĨāĻ•?)

Ans: Structures (also called structures) are a way of grouping multiple related variables into one space. Each variable in the structure is known as a member of the structure. Unlike an array, a structure can have different data types Int, Float, Mister, etc.

There are three different kinds of arrays: indexed arrays, multidimensional arrays, and associative arrays.

āĻ—াঁāĻĨāύিāĻŦোā§° (āϝাāĻ• āĻ—াঁāĻĨāύি āĻŦুāϞিāĻ“ āĻ•োā§ąা āĻšāϝ়) āĻšৈāĻ›ে āĻāĻ•াāϧিāĻ• āϏāĻŽ্āĻĒā§°্āĻ•িāϤ āϚāϞāĻ•āĻ• āĻāϟা āϏ্āĻĨাāύāϤ āĻ—োāϟ āϕ⧰াā§° āĻāĻ• āωāĻĒাāϝ়। āĻ—াঁāĻĨāύিāϟোā§° āĻĒ্ā§°āϤিāϟো āϚāϞāĻ•āĻ• āĻ—াঁāĻĨāύিāϟোā§° āϏāĻĻāϏ্āϝ āĻšিāϚাāĻĒে āϜāύা āϝাāϝ়। āĻā§°েāĻāϟাā§° āĻŦিāĻĒā§°ীāϤে, āĻ—াঁāĻĨāύি āĻāϟাāϤ āĻŦিāĻ­িāύ্āύ āĻĄাāϟা āĻĒ্ā§°āĻ•াā§°ā§° āχāĻŖ্āϟ, āĻĢ্āϞোāϟ, āĻŽিāώ্āϟাā§° āφāĻĻি āĻĨাāĻ•িāĻŦ āĻĒাā§°ে।

āχāϝ়াāϤ āϤিāύিāϟা āĻĒৃāĻĨāĻ• āĻĒ্ā§°āĻ•াā§°ā§° āĻā§°ে āφāĻ›ে: āϏূāϚীāĻŦāĻĻ্āϧ āĻā§°ে, āĻŦāĻšুāĻŽাāϤ্ā§°িāĻ• āĻā§°ে, āφ⧰ু āϏāĻšāϝোāĻ—ী āĻā§°ে।)

2. Is structure a built-in data type? Can we apply basic arithmetic operations such as addition, subtraction to structure variables? Show with a simple C program.

(āĻ—āĻ āύ āĻāϟা āĻŦিāϞ্āϟ-āχāύ āĻĄাāϟা āϟাāχāĻĒ āύেāĻ•ি? āφāĻŽি āĻ—āĻ āύ āϚāϞāĻ•āϏāĻŽূāĻšāϤ āϝোāĻ—, āĻŦিāϝ়োāĻ— āφāĻĻি āĻŽৌāϞিāĻ• āĻ—াāĻŖিāϤিāĻ• āĻ•াā§°্āϝ্āϝāϏāĻŽূāĻš āĻĒ্ā§°āϝ়োāĻ— āϕ⧰িāĻŦ āĻĒাā§°োāύে? āĻāϟা āϏাāϧাā§°āĻŖ C āĻĒ্ā§°āĻ—্ā§°েāĻŽā§° āϏৈāϤে āĻĻেāĻ–ুā§ąাāĻ“āĻ•।)

Ans: Structure is a built-in - not a data type. We can group different types of constructed information into a structure. Yes, we can apply deductions to basic mathematical tasks such as mixing, structure variables, etc.

(āĻ—াঁāĻĨāύি āĻāϟা āĻŦিāϞ্āϟ-āχāύ - āĻĄাāϟা āĻĒ্ā§°āĻ•াā§° āύāĻšāϝ়। āφāĻŽি āĻŦিāĻ­িāύ্āύ āĻĒ্ā§°āĻ•াā§°ā§° āύিā§°্āĻŽিāϤ āϤāĻĨ্āϝāĻāϟা āĻ—াঁāĻĨāύিāϤ āĻ—োāϟ āϕ⧰িāĻŦ āĻĒাā§°োঁ। āĻšāϝ়, āφāĻŽি āĻĒ্ā§°াāĻĨāĻŽিāĻ• āĻ—াāĻŖিāϤিāĻ• āĻ•াā§°্āϝāϝেāύে āĻŽিāĻļ্ā§°āĻŖ, āĻ—াঁāĻĨāύি āϚāϞāĻ•āφāĻĻিāϤ āϕ⧰্āϤāύ āĻĒ্ā§°āϝ়োāĻ— āϕ⧰িāĻŦ āĻĒাā§°োঁ।)

3. Identify the members of the structure from the below code segment.

(āϤāϞ⧰ āĻ•'āĻĄ āĻ–āĻŖ্āĻĄā§° āĻĒā§°া āĻ—āĻ āύ⧰ āϏāĻĻāϏ্āϝāϏāĻŽূāĻš āϚিāύাāĻ•্āϤ āϕ⧰āĻ•।)


4. Identify the structure variables from the below code segment.

(āϤāϞ⧰ āĻ•'āĻĄ āĻ–āĻŖ্āĻĄā§° āĻĒā§°া āĻ—āĻ āύ āϚāϞāĻ•āϏāĻŽূāĻš āϚিāύাāĻ•্āϤ āϕ⧰āĻ•।)

5. Consider the structure below and write statements for the following.

(āϤāϞ⧰ āĻ—āĻ āύāϟো āĻŦিāĻŦেāϚāύা āϕ⧰āĻ• āφ⧰ু āϤāϞ⧰āĻŦোā§°ā§° āĻŦাāĻŦে āĻŦিāĻŦৃāϤি āϞিāĻ–āĻ•।)

a. to declare a variable of the structure

(āĻ—āĻ āύ⧰ āĻāϟা āϚāϞāĻ• āϘোāώāĻŖা āϕ⧰িāĻŦāϞৈ)

Ans: The "structure declaration" provides a type of name and determines different types of variable values (called "members" or "fields"). An alternative identifier called "tag" mentions the type of structure and can be used in the next context of the type 0 of the structure

( "āĻ—াঁāĻĨāύি āϘোāώāĻŖা"-āĻ āĻāĻ• āĻĒ্ā§°āĻ•াā§°ā§° āύাāĻŽ āĻĒ্ā§°āĻĻাāύ āϕ⧰ে āφ⧰ু āĻŦিāĻ­িāύ্āύ āĻĒ্ā§°āĻ•াā§°ā§° āĻĒā§°িā§ąā§°্āϤāύāĻļীāϞ āĻŽাāύ (āϝাāĻ• "āϏāĻĻāϏ্āϝ" āĻŦা "āĻ•্āώেāϤ্ā§°" āĻŦুāϞি āĻ•োā§ąা āĻšāϝ়) āύিā§°্āϧাā§°āĻŖ āϕ⧰ে। "āϟেāĻ—" āĻŦুāϞি āĻ•োā§ąা āĻāĻ• āĻŦৈāĻ•āϞ্āĻĒিāĻ• āϚিāύাāĻ•্āϤāϕ⧰্āϤাāχ āĻ—াঁāĻĨāύিā§° āĻĒ্ā§°āĻ•াā§° āωāϞ্āϞেāĻ– āϕ⧰ে āφ⧰ু āĻ—াঁāĻĨāύিā§° āĻĒ্ā§°āĻ•াā§°-ā§° āĻĒā§°ā§ąā§°্āϤী āĻĒ্ā§°āϏংāĻ—āϤ āĻŦ্āĻ¯ā§ąāĻšাā§° āϕ⧰িāĻŦ āĻĒাā§°ি)


b. to display the age of the teacher

(āĻļিāĻ•্āώāϕ⧰ āĻŦāϝ়āϏ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰িāĻŦāϞৈ)

Ans: 

6. Declare a pointer for structure Teacher (from Q No. 5) and dynamically allocate memory for 10 records.

(āĻ—āĻ āύ āĻļিāĻ•্āώāϕ⧰ āĻŦাāĻŦে āĻāϟা āĻĒāχāĻŖ্āϟাā§° āϘোāώāĻŖা āϕ⧰āĻ• (āĻĒ্ā§°āĻļ্āύ āύং 5 ā§° āĻĒā§°া) āφ⧰ু 10 āϟা ā§°েāϕ⧰্āĻĄā§° āĻŦাāĻŦে āĻ—āϤিāĻļীāϞāĻ­াā§ąে āĻŽেāĻŽā§°ি āφāĻŦāĻŖ্āϟāύ āϕ⧰āĻ•।)

Ans: 

7. Consider the structure below and write statements for the following.

(āϤāϞ⧰ āĻ—āĻ āύāϟো āĻŦিāĻŦেāϚāύা āϕ⧰āĻ• āφ⧰ু āϤāϞ⧰āĻŦোā§°ā§° āĻŦাāĻŦে āĻŦিāĻŦৃāϤি āϞিāĻ–āĻ•।)

a. to declare a pointer for the above structure and display the salary.

(āĻ“āĻĒā§°ā§° āĻ—āĻ āύ⧰ āĻŦাāĻŦে āĻāϟা āĻĒāχāĻŖ্āϟাā§° āϘোāώāĻŖা āϕ⧰িāĻŦāϞৈ āφ⧰ু āĻĻā§°āĻŽāĻšা āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰িāĻŦāϞৈ।)

Ans: To declare a structure pointer struct keyword is used followed by the structure name and pointer name with an asterisk * symbol. Members of a structure can be accessed from pointers using two ways that are. Using dot and asterisk operator on a pointer. Using arrow operator (->) on a pointer

b. to declare a single pointer for two different variables of the higher structure and display the details of the employee whose salary is more.

āωāϚ্āϚ āĻ—āĻ āύ⧰ āĻĻুāϟা āĻ­িāύ্āύ āϚāϞāϕ⧰ āĻŦাāĻŦে āĻāϟা āĻĒāχāĻŖ্āϟাā§° āϘোāώāĻŖা āϕ⧰িāĻŦāϞৈ āφ⧰ু āϝিāϜāύ āϕ⧰্āĻŽāϚাā§°ীā§° āĻĻā§°āĻŽāĻšা āĻŦেāĻ›ি āϤেāĻ“ঁā§° āĻŦিā§ąā§°āĻŖ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰িāĻŦāϞৈ।










8. Rewrite the program of Q. No. 7 to facilitate dynamic memory allocation for N number of record where N in a user input.

N āϏংāĻ–্āϝাā§° ā§°েāϕ⧰্āĻĄā§° āĻŦাāĻŦে āĻ—āϤিāĻļীāϞ āĻŽেāĻŽā§°ি āφāĻŦāĻŖ্āϟāύ āϏāĻšāϜ āϕ⧰ি āϤুāϞিāĻŦāϞৈ Q. āύং 7 ā§° āĻĒ্ā§°āĻ—্ā§°েāĻŽāϟো āĻĒুāύ⧰ āϞিāĻ–āĻ• āϝ'āϤ N āĻāϟা āĻŦ্āĻ¯ā§ąāĻšাā§°āĻ•াā§°ী āχāύāĻĒুāϟāϤ āφāĻ›ে।


9. Consider the below structure and design a simple banking system that supports the following operations.
āϤāϞ⧰ āĻ—āĻ āύāϟো āĻŦিāĻŦেāϚāύা āϕ⧰āĻ• āφ⧰ু āϤāϞāϤ āĻĻিāϝ়া āĻ•াā§°্āϝ্āϝāĻ•āϞাāĻĒāϏāĻŽূāĻš āϏāĻŽā§°্āĻĨāύ āϕ⧰া āĻāϟা āϏāĻšāϜ āĻŦেংāĻ•িং āĻŦ্āĻ¯ā§ąāϏ্āĻĨাā§° āĻĄিāϜাāχāύ āϕ⧰āĻ•।


a. opening of accounts (Hint: input to the variables)

āĻāĻ•াāωāĻŖ্āϟāϏāĻŽূāĻš āĻ–োāϞা (āχংāĻ—িāϤ: āϚāϞāĻ•āϏāĻŽূāĻšāϞৈ āχāύāĻĒুāϟ)

b. displaying details based on account number

āĻāĻ•াāωāĻŖ্āϟ āύāĻŽ্āĻŦā§°ā§° āĻ“āĻĒā§°āϤ āĻ­িāϤ্āϤি āϕ⧰ি āĻŦিā§ąā§°āĻŖ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰া

c. displaying all account details

āϏāĻ•āϞো āĻāĻ•াāωāĻŖ্āϟ⧰ āĻŦিā§ąā§°āĻŖ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰া

d. displaying details of all accounts whose balance is more than 1000

āϏāĻ•āϞো āĻāĻ•াāωāĻŖ্āϟ⧰ āĻŦিā§ąā§°āĻŖ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰া āϝাā§° āĻŦেāϞেāĻž্āϚ ā§§ā§Ļā§Ļā§Ļ āϤāĻ•ৈ āĻ…āϧিāĻ•

e. depositing an amount to an account

āĻāĻ•াāωāĻŖ্āϟāϤ āĻāϟা āϧāύ āϜāĻŽা āϕ⧰া

f. withdrawing some amount from an account

āĻāĻ•াāωāĻŖ্āϟ⧰ āĻĒā§°া āĻ•িāĻ›ু āĻĒā§°িāĻŽাāĻŖā§° āϧāύ āωāϞিāĻ“ā§ąা




















Type & Assamese Translate: Himashree Bora.



Post ID: DABP002206