NIOS Class 12 Computer Science Chapter 20 Pointer Solutions English Medium As Per New Syllabus. to each chapter is provided in the list so that you can easily browse throughout different chapters NIOS Class 12 Computer Science Chapter 20 Pointer Notes and select need one. NIOS Class 12 Computer Science Question Answers Download PDF. NIOS Study Material of Class 12 Computer Science Notes Paper 330.
NIOS Class 12 Computer Science Chapter 20 Pointer
Also, you can read the NIOS book online in these sections Solutions by Expert Teachers as per National Institute of Open Schooling (NIOS) Book guidelines. These solutions are part of NIOS All Subject Solutions. Here we have given NIOS Class 12 Computer Science Textbook Solutions, NIOS Senior Secondary Course Computer Science Notes for All Chapter, You can practice these here.
Pointer
Chapter: 20
| Module – 3: Programming in C++ |
INTEXT QUESTIONS 20.1
I. Choose the appropriate answer.
1. A pointer is _________________.
(i) The address of a variable.
(ii) An indication of the variable to be accessed next.
(iii) A variable for string addresses.
(iv) The data type of address variable.
Ans: (i) The address of a variable.
2. The expression *ptr can be said to _________________.
(i) Be a pointer to ptr.
(ii) Refer to the contents of ptr.
(iii) Refer to the value of the variable pointed to by ptr.
(iv) Dereference ptr.
Ans: (iv) Dereference ptr.
3. The expression int* can be said to _________________
(i) Be a pointer pointing to variable int.
(ii) Refer to contents of int.
(iii) Be a pointer to an int type value.
Ans: (iii) Be a pointer to an int type value.
II. Fill in the blanks:
(a) A pointer variable stores the _________________ of another variable.
Ans: Address.
(b) The _________________ operator is called address operator.
Ans: &
(c) To declare t_age pointer to integer, we should write _________________.
Ans: int *t_age;.
(d) If A is an integer variable then _________________ gives its address.
Ans: &A.
(e) If ptr is a pointer to an integer variable, the number stored in it is given by _________________.
Ans: *ptr.
III. State whether the following statements are true or false:
(a) A pointer is an address of the variable.
Ans: True.
(b) Dereferencing operator (*) is a unary operator. It is different from the multiplication operator (*) which needs two operands.
Ans: True.
(c) This pointer points to the objects that is currently used to invoke a function.
Ans: True.
TERMINAL EXERCISE
1. If arr is an array of integers, why is the expression arr++ not legal?
Ans: The expression arr++ is not legal because the name of an array (in this case, arr) is a pointer that holds the address of the zero location (the first element). In a program, this array name acts as a constant, meaning its value (the base address) cannot be changed,. Therefore, trying to increment it using ++ is considered a wrong statement.
2. What is the difference between arr [4] and *(arr+4)?
Ans: arr[4] and *(arr+4) both access the 5th element of the array and produce the same result.
arr[4] is the array subscript notation, whereas *(arr+4) is the pointer notation.
3. If a structure defined has pointer variable, how can it access the members of the structure? Explain it by taking an example.
Ans: If a pointer variable points to a structure, then the members of the structure can be accessed in two ways:
(i) By using the arrow operator (->)
(ii) By using the dereference operator (*) with dot operator (.)
Example:
struct student
{
char name[20];
int rn;
};
student st;
student *ptr;
ptr = &st;
To access the members using arrow operator:
ptr -> rn;
ptr -> name;
To access the members using dereference operator and dot operator:
(*ptr).rn;
(*ptr).name;
4. How can a data member and member function present in public mode in class be accessed through pointer object? Explain it by taking an example.
Ans: Public data members and public member functions of a class can be accessed through an object pointer by using:
(i) Arrow operator (->)
(ii) Dereference operator (*) with dot operator (.)
Example:
class student
{
char name[20];
int rn;
public:
int marks;
void getdata();
};
student st;
student *ptr;
ptr = &st;
Accessing members using arrow operator:
ptr -> marks = 90;
ptr -> getdata();
Accessing members using dereference operator and dot operator:
(*ptr).marks = 90;
(*ptr).getdata();
Subject Ka Complete Video Solution Dekhein
Step-by-step easy concept explanation aur full questions Answer ke liye watch karein ya app download karein:

