Pointers in C Common interview questions | MCQ | FAQ
What is a pointer in C? a) A variable that stores the memory address of another variable - Answer b) A variable that stores a value c) A constant that stores the memory address of another variable d) A constant that stores a value
What is the purpose of the * operator in the declaration of a pointer in C? a) To indicate that the variable is a pointer - Answer b) To indicate that the variable is not a pointer c) To indicate the type of data stored in the memory location d) To indicate the size of the memory location
What is the main difference between pointers and arrays in C? a) Pointers store memory addresses, while arrays store values - Answer b) Pointers store values, while arrays store memory addresses c) Pointers are dynamic, while arrays are static d) Pointers are static, while arrays are dynamic
What is the syntax for accessing an array element in C? a) array[index]; - Answer b) *(array + index); c) &array[index]; d) *array + index;
What is the equivalent pointer expression for accessing an array element in C? a) *(array + index); - Answer b) array[index]; c) &array[index]; d) *array + index;
What is the difference between using an array name and a pointer to access an array element in C? a) The array name is a constant pointer to the first element, while a pointer can be incremented to access other elements - Answer b) The array name is a constant value, while a pointer can be incremented to access other elements c) The array name is a pointer that cannot be incremented, while a pointer can be incremented to access other elements d) The array name is a pointer that can be incremented, while a pointer cannot be incremented to access other elements
Can an array be passed as an argument to a function in C? a) Yes, an array can be passed as an argument to a function - Answer b) No, an array cannot be passed as an argument to a function
Can a pointer be passed as an argument to a function in C? a) Yes, a pointer can be passed as an argument to a function - Answer b) No, a pointer cannot be passed as an argument to a function
What is the size of an array in C? a) The size of the array is the number of elements in the array - Answer b) The size of the array is the size of the data type of the elements c) The size of the array is the memory address of the first element d) The size of the array is the sum of the sizes of the elements
What is the size of a pointer in C? a) The size of a pointer is the size of the data type it points to - Answer b) The size of a pointer is the size of the memory address it stores c) The size of a pointer is the number of elements it points to d) The size of a pointer is the sum of the sizes of the elements it points to
Comments
Post a Comment