MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In the array ‘colours("Purple", “Blue", “Red", “Green", “Yellow")’, what is the value of the element colours(3)?
A
Green
B
Red
C
Purple
D
None of the above
Explanation: 

Detailed explanation-1: -The correct answer is populating the array values.

Detailed explanation-2: -Here’s how you can take input from the user and store it in an array element. // take input and store it in the 3rd element scanf("%d", &mark[2]); // take input and store it in the ith element scanf("%d", &mark[i-1]);

Detailed explanation-3: -To create an array, define the data type (like int ) and specify the name of the array followed by square brackets []. To insert values to it, use a comma-separated list, inside curly braces: int myNumbers[] = 25, 50, 75, 100; We have now created a variable that holds an array of four integers.

Detailed explanation-4: -An array is essentially a collection of elements. The data type of all elements must be the same and store at the contiguous memory location. So each array can store only one type of data. At the time of the array declaration, you must specify the type of data with the array name.

There is 1 question to complete.