Menu

Objective Type Questions & Answers


PPS MCQs - Unit-2



1. What is an array in C?

A . A data structure that can hold multiple data types.

B . A collection of elements with the same data type.

C . A mathematical function.

D . A loop construct.

Answer



2. How do you declare a one-dimensional array of integers in C?

A . int[] myArray;

B . array<int> myArray;

C . int myArray[];

D . array myArray;

Answer



3. How do you access the third element of a one-dimensional array myArray in C?

A . myArray[2]

B . myArray[3]

C . myArray[1]

D . myArray(3)

Answer



4. In a two-dimensional array, how would you access the element in the second row and third column?

A . array[2][3]

B . array[1][2]

C . array(2,3)

D . array[3][2]

Answer



5. What will be the output of the following code? int arr[3] = {10, 20, 30}; printf("%d", arr[1]);

A . 10

B . 20

C . 30

D . None of the above

Answer



6. What will the following code print? int arr[3][2] = {{1, 2}, {3, 4}, {5, 6}}; printf("%d", arr[1][1]);

A . 2

B . 3

C . 4

D . 5

Answer



7. what is the size of an integer array declared as int arr[5] in bytes?

A . 14

B . 20

C . 4

D . 5

Answer



8. Which of the following correctly calculates the total number of elements in a one-dimensional array arr declared as int arr[5];?

A . sizeof(arr) / sizeof(arr[0])

B . sizeof(arr)

C . arr.size()

D . None of the above

Answer



9. What happens if you try to access an array element with an index greater than its size in C?

A . It returns a default value

B . It causes a segmentation fault

C . It wraps around to the start of the array

D . None of the above

Answer



10. What is a two-dimensional array?

A . An array that can store only two elements.

B . An array of arrays, organized in rows and columns.

C . An array with two data types.

D . A data structure to hold strings.

Answer



11. Comment on an array of the void data type.

A . It can store any data-type

B . It only stores element of similar data type to first element

C . It acquires the data type with the highest precision in it

D . You cannot have an array of void data type

Answer



Fill in the Blanks


12. An array is a collection of items stored at __________ in memory.

Answer


13. In C, the index of the first element in an array is __________.

Answer


14. The syntax to access the fifth element of an array named arr is __________.

Answer


15. To declare a two-dimensional array in C, you use two sets of __________.

Answer


16. The size of a one-dimensional array must be defined during __________.

Answer


17. To find the number of elements in an array arr, the expression is __________.

Answer


18. In C, if you attempt to access an index that is out of bounds, it can lead to __________.

Answer


19. The process of iterating through an array to access or modify each element is called __________.

Answer


20. To access the first element of a two-dimensional array arr, you use the syntax __________.

Answer




Relevant Materials :

PPS MCQs - Unit-1 - [ PPS ]

PPS MCQs - Unit-2 - [ PPS ]

PPS MCQs - Unit-3 - [ PPS ]

PPS MCQs - Unit-4 - [ PPS ]

PPS MCQs - Unit-5 - [ PPS ]


Similar Materials :

R - Programming MCQs - Unit-1 - [ R-Programming ]

R - Programming MCQs - Unit-2 - [ R-Programming ]

R - Programming MCQs - Unit-3 - [ R-Programming ]

R - Programming MCQs - Unit-4 - [ R-Programming ]

R - Programming MCQs - Unit-5 - [ R-Programming ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-1 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-2 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-3 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-4 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-5 - [ FLAT ]

Object Oriented Programming through Java MCQs - Unit-1 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-2 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-3 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-4 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-5 - [ OOP_JAVA ]

Design and Analysis of Algorithms MCQs - Unit-1 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-2 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-3 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-4 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-5 - [ DAA ]

Software Engineering MCQs - Unit-1 - [ SE ]

Software Engineering MCQs - Unit-2 - [ SE ]

Software Engineering MCQs - Unit-3 - [ SE ]

Software Engineering MCQs - Unit-4 - [ SE ]

Software Engineering MCQs - Unit-5 - [ SE ]

Data Mining MCQs - Unit-1 - [ DM ]

Data Mining MCQs - Unit-2 - [ DM ]

Data Mining MCQs - Unit-3 - [ DM ]

Data Mining MCQs - Unit-4 - [ DM ]

Data Mining MCQs - Unit-5 - [ DM ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-1 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-2 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-3 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-4 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-5 - [ COA ]

Data Structures Objective Type Question Bank-Unit-1 - [ DS ]

Data Structures Objective Type Question Bank-Unit-2 - [ DS ]

Data Structures Objective Type Question Bank-Unit-3 - [ DS ]

Data Structures Objective Type Question Bank-Unit-4 - [ DS ]

Data Structures Objective Type Question Bank-Unit-5 - [ DS ]

Database Management System Objective Type Question Bank-Unit-1 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-2 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-3 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-4 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-5 - [ DBMS ]

Cyber Forensics Objective Type Question Bank-Part-2 - [ Cyber Forensics ]

Cyber Forensics Objective Type Question Bank-Part-1 - [ Cyber Forensics ]

Java Programming Objective Type Question Bank - [ Java Programming ]

Java Programming Objective Type Questions-Part-1 - [ Java Programming ]

Java Programming Objective Type Questions-Part-2 - [ Java Programming ]