Skip to main content

Introduction to Programming MCQs with Answers

Practice important Introduction to Programming MCQs with answers and explanations.

Multiple Choice Questions

Q181: What is the correct syntax to initialize a character array with the string 'imran'?
  • A: char name[100] = 'imran';
  • B: char name[100] = { 'i', 'm', 'r', 'a', 'n' };
  • C: char name[100] = "imran";
  • D: char name = "imran";
View Answer
C

Q182: Which search algorithm is more efficient for sorted arrays?
  • A: Linear search
  • B: Binary search
  • C: Sequential search
  • D: Hash search
View Answer
B

Q183: How does binary search improve over linear search?
  • A: By reducing the array size by half each iteration
  • B: By comparing each element directly
  • C: By searching in a sorted order
  • D: By increasing the search space each iteration
View Answer
A

Q184: What is the default mechanism of calling a function with arrays in C?
  • A: Call by value
  • B: Call by reference
  • C: Call by address
  • D: Call by pointer
View Answer
B

Q185: In C, what is passed to a function when an array is used as a parameter?
  • A: A copy of the array
  • B: A pointer to the array
  • C: A reference to the array
  • D: A value from the array
View Answer
B

Q186: What will be the result if you pass a single element of an array to a function?
  • A: Call by reference
  • B: Call by value
  • C: Call by address
  • D: Call by pointer
View Answer
B

Q187: How do you declare a two-dimensional array in C?
  • A: int array[rows][columns];
  • B: int array[columns][rows];
  • C: int array[rows];
  • D: int array[columns];
View Answer
A

Q188: What is the size of the array 'int num[3][5][7];'?
  • A: 105
  • B: 105 elements
  • C: 357
  • D: 3+5+7
View Answer
B

Q189: How do you declare a function that reverses an array in C?
  • A: void reverse(char [], int);
  • B: void reverse(int [], int);
  • C: char reverse(int [], int);
  • D: int reverse(char [], int);
View Answer
A

Q190: What is the primary use of an array?
  • A: To store elements of different types
  • B: To store elements in a tabular form
  • C: To store elements of similar types
  • D: To store data in a single variable
View Answer
C

Test Your Knowledge

Take a timed quiz on Introduction to Programming

🚀 Start Quiz Now