Home Python C Language C ++ HTML 5 CSS Javascript Java Kotlin SQL DJango Bootstrap React.js R C# PHP ASP.Net Numpy Dart Pandas Digital Marketing

C Programming Interviews Questions


C Language Arrays Question and Answer...

Q.1 What is an array in C programming?

Answer: An array in C is a collection of elements of the same data type stored in contiguous memory locations.

Q.2 How do you declare an array in C?

Answer: You declare an array by specifying the data type of its elements and the array's name followed by square brackets containing its size, for example: int arr[5];.

Q.3 What is the index of the first element in an array?

Answer: The index of the first element in an array is always 0.

Q.4 How do you access elements of an array in C?

Answer: You access elements of an array using square brackets and the index of the element you want to access, for example: int x = arr[2];

Q.5 What is the purpose of the sizeof operator in relation to arrays?

Answer: The sizeof operator returns the size in bytes of its operand, so sizeof(arr) returns the total size in bytes of the entire array

Q.6 How do you initialize an array in C?

Answer: You can initialize an array at the time of declaration by providing a comma-separated list of values enclosed in curly braces, for example: int arr[5] = {1, 2, 3, 4, 5};

Q.7 What is the maximum number of elements an array can hold in C?

Answer: The maximum number of elements an array can hold in C is determined by the size of the data type and available memory.

Q.8 Can the size of an array be changed after it is declared in C?

Answer: No, the size of an array cannot be changed after it is declared in C.

Q.9 What is the purpose of multidimensional arrays in C?

Answer: Multidimensional arrays in C are used to store data in multiple dimensions, such as matrices or tables.

Q.10 How do you pass an array to a function in C?

Answer: You can pass an array to a function by specifying the array's name without brackets, which acts as a pointer to the first element of the array.




Advertisement





it pathshaala : India


Online Complier

HTML 5

Python

java

C++

C

JavaScript

Website Development

HTML 5

Python

java

C++

C

JavaScript

Campus Learning

C

C#

java