Pointers in C | Chapter 8 | Class 10 Computer Science 571(NCERT) Question and Answer | Class 10 Computer Science 571(NCERT) Question and Answer Solutions English Medium |
Pointers in C
Chapter 8
Exercise
1. How is a pointer variable different from a normal variable?
(āĻāĻা āĻĒāĻāĻŖ্āĻাā§° āĻেā§°িāϝ়েāĻŦāϞ āĻāĻা āϏাāϧাā§°āĻŖ āĻেā§°িāϝ়েāĻŦāϞ⧰ āĻĒā§°া āĻেāύেāĻৈ āĻĒৃāĻĨāĻ?)
Ans: pointer variables (or pointers for short) are essentially the same as other variables, which can store a piece of data. Unlike common variables that store a value (e.g., int, double, mister), the cursor stores a memory address. Cursors must be declared before they are used as normal variables.
(āĻĒāĻāĻŖ্āĻাā§° āĻেā§°িāϝ়েāĻŦāϞ (āĻŦা āĻāĻŽুāĻৈ āĻĒāĻāĻŖ্āĻাā§°) āĻŽূāϞāϤঃ āĻāύ āĻāϞāĻā§° āĻĻā§°ে āĻāĻে, āϝি āĻĄাāĻাā§° āĻুāĻুā§°া āĻāĻা āϏংā§°āĻ্āώāĻŖ āĻā§°িāĻŦ āĻĒাā§°ে। āĻŽূāϞ্āϝ āĻāĻা āϏংā§°āĻ্āώāĻŖ āĻā§°া āϏাāϧাā§°āĻŖ āĻāϞāĻā§° āĻŦিāĻĒā§°ীāϤে (āϝেāύে, āĻāĻŖ্āĻ, āĻĄাāĻŦāϞ, āĻŽিāώ্āĻাā§°), āĻাā§°্āĻাā§°ে āĻŽেāĻŽ'ā§°ী āĻ িāĻāύা āĻāĻা āϏংā§°āĻ্āώāĻŖ āĻā§°ে। āĻাā§°্āĻাā§°āĻŦোā§° āϏাāϧাā§°āĻŖ āĻāϞāĻ āĻšিāĻাāĻĒে āĻŦ্āĻ¯ā§ąāĻšাā§° āĻā§°াā§° āĻāĻāϤে āĻোāώāĻŖা āĻā§°িāĻŦ āϞাāĻিāĻŦ।)
2. Why is dynamic memory allocation an efficient memory management technique?
(āĻĄাāĻāύাāĻŽিāĻ āĻŽেāĻŽā§°ি āĻāĻŦāĻŖ্āĻāύ āĻিāϝ় āĻāĻা āĻĻāĻ্āώ āĻŽেāĻŽā§°ি āĻŦ্āĻ¯ā§ąāϏ্āĻĨাāĻĒāύা āĻৌāĻļāϞ?)
Ans: Dynamic memory allocation is a computer programming technique used to manage memory more efficiently. It allows a program to allocate memory blocks, make them free, and reassign them during program editing
(āĻĄাāĻāύাāĻŽিāĻ āĻŽেāĻŽā§°ি āĻā§ąāĻŖ্āĻāύ āĻšৈāĻে āĻŽেāĻŽā§°ি āĻ āϧিāĻ āĻĻāĻ্āώāϤাā§°ে āĻĒā§°িāĻাāϞāύা āĻā§°িāĻŦāϞৈ āĻŦ্āĻ¯ā§ąāĻšাā§° āĻā§°া āĻāĻ āĻāĻŽ্āĻĒিāĻāĻাā§° āĻĒ্ā§°āĻ্ā§°াāĻŽিং āĻৌāĻļāϞ। āĻ āĻĒ্ā§°'āĻ্ā§°াāĻŽ āĻāĻাāĻ āĻŽেāĻŽ'ā§°ী āĻŦ্āϞāĻ āĻā§ąāĻŖ্āĻāύ āĻā§°িāĻŦāϞৈ, āϏেāĻāĻŦোā§° āĻŦিāύাāĻŽূāϞীāϝ়া āĻā§°িāĻŦāϞৈ āĻā§°ু āĻĒ্ā§°'āĻ্ā§°াāĻŽ āϏāĻŽ্āĻĒাāĻĻāύাā§° āϏāĻŽāϝ়āϤ āϏেāĻāĻŦোā§° āĻĒুāύ⧰ āĻā§ąāĻŖ্āĻāύ āĻā§°িāĻŦāϞৈ āĻ āύুāĻŽāϤি āĻĻিāϝ়ে)
3. How many bytes are needed to store an int pointer variable? Is it the same for a char pointer variable? Write a simple C program to explain your answer.
(āĻāĻা āĻāĻŖ্āĻ āĻĒāĻāĻŖ্āĻাā§° āĻāϞāĻ āϏংā§°āĻ্āώāĻŖ āĻā§°িāĻŦāϞৈ āĻিāĻŽাāύāĻা āĻŦাāĻāĻā§° āĻĒ্ā§°āϝ়োāĻāύ? āĻাā§° āĻĒāĻāĻŖ্āĻাā§° āĻāϞāĻā§° āĻŦাāĻŦে āĻāĻāĻো āĻāĻে āύেāĻি? āĻāĻĒোāύাā§° āĻāϤ্āϤ⧰ āĻŦুāĻাāĻŦāϞৈ āĻāĻা āϏ⧰āϞ āĻি āĻĒ্ā§°'āĻ্ā§°াāĻŽ āϞিāĻāĻ।)
Ans: The size of the cursor variables is the same for each data type. It will be 8 bytes for the 64-bit processor, 4 bytes for the 32-bit processor, 2 bytes for the 16-bit processor.
(āĻĒ্ā§°āϤিāĻো āĻĄাāĻা āĻĒ্ā§°āĻাā§°ā§° āĻŦাāĻŦে āĻাā§°্āĻā§° āĻāϞāĻā§° āĻāĻাā§° āĻāĻে। āĻ 64-āĻŦিāĻ āĻĒ্ā§°āĻেāĻā§°ā§° āĻŦাāĻŦে 8 āĻŦাāĻāĻ, 32-āĻŦিāĻ āĻĒ্ā§°āĻেāĻā§°ā§° āĻŦাāĻŦে 4 āĻŦাāĻāĻ, 16-āĻŦিāĻ āĻĒ্ā§°āĻেāĻā§°ā§° āĻŦাāĻŦে 2 āĻŦাāĻāĻ āĻš'āĻŦ।)
4. Write the output of the following code segment.
(āύিāĻŽ্āύāϞিāĻিāϤ āĻোāĻĄ āĻāĻŖ্āĻĄā§° āĻāĻāĻāĻĒুāĻ āϞিāĻāĻ।)
a.
Ans: Output was 9
b.
Ans: Output was 9 and 10
C.
Ans: Output was 10
d.
Ans: Output was 10
e.
Ans: Output was A
f.
Ans: Output was B
g.
Ans: Output was B
9. Write a C program to store some integer variables in an array. Then write functions to the following.
āĻā§°েāĻāĻাāϤ āĻিāĻুāĻŽাāύ āĻāĻŖ্āĻিāĻাā§° āĻāϞāĻ āϏংā§°āĻ্āώāĻŖ āĻā§°িāĻŦāϞৈ āĻāĻা āĻি āĻĒ্ā§°'āĻ্ā§°াāĻŽ āϞিāĻāĻ। āϤাā§° āĻĒিāĻāϤ āύিāĻŽ্āύāϞিāĻিāϤāĻŦোā§°āϞৈ āĻĢাংāĻāύāĻŦোā§° āϞিāĻāĻ।
1. To calculate the number of non-zero elements that are divisible by 3.
3-ā§° āĻĻ্āĻŦাā§°া āĻŦিāĻাāĻ্āϝ āύোāĻšোā§ąা āĻ -āĻļূāύ্āϝ āĻāĻĒাāĻĻাāύ⧰ āϏংāĻ্āϝা āĻāĻŖāύা āĻā§°িāĻŦāϞৈ।
2. To dynamically allocate memory to a new array to store only those elements.
āĻেā§ąāϞ āϏেāĻ āĻāĻĒাāĻĻাāύāĻŦোā§° āϏংā§°āĻ্āώāĻŖ āĻā§°িāĻŦāϞৈ āύāϤুāύ āĻā§°েāĻāĻাāϤ āĻāϤিāĻļীāϞāĻাā§ąে āĻŽেāĻŽā§°ি āĻā§ąāĻŖ্āĻāύ āĻā§°িāĻŦāϞৈ।
3. To copy the selected elements from the first array to the second one.
āĻŦাāĻāύি āĻā§°া āĻāĻĒাāĻĻাāύāĻŦোā§° āĻĒ্ā§°āĻĨāĻŽ āĻā§°েā§° āĻĒā§°া āĻĻ্āĻŦিāϤীāϝ়āĻোāϞৈ āĻĒ্ā§°āϤিāϞিāĻĒি āĻā§°িāĻŦāϞৈ।
4. To calculate the summation of these elements.
āĻāĻ āĻāĻĒাāĻĻাāύāĻŦোā§°ā§° āϏাā§°াংāĻļ āĻāĻŖāύা āĻā§°িāĻŦāϞৈ।
Sample run:
First array
Second array
Summation: 24
Type & Assamese Translate : Himashree Bora.










