NPTEL Problem Solving Through Programming in C Week 6 Assignment Answers 2024
1. What is the right way to initialise an array in C?
a) int arr{}={1,2,5,6,9}
b) int arr[5]={1,2,5,6,9}
c) int arr{5}={1,2,5,6,9}
d) int arr()={1,2,5,6,9}
Answer :- For Answers Click Here
2. An integer array of dimension 10 is declared in a C program. The memory location of the first byte of the array is 1000. What will be the location of the 8th element of the array? (Assume integer takes 4 bytes of memory and the element stored at 1000 is identified as 1st element)
a) 1028
b) 1032
c) 1024
d) 1036
Answer :- For Answers Click Here
3.
a) 1
b) 2
c) 3
d) 4
Answer :- For Answers Click Here
4. Which of the statements is correct?
a) An array contains more than one element
b) All elements of array have to be of same data type
c) The size of array has to be declared upfront
d) All of the above
Answer :-
5. To compare two arrays, we can use
a) Comparison operator ‘==’ directly on arrays
b) Use ‘switch case’
c) Using ‘for’ loop
d) Using ternary operator on arrays
Answer :-
6.
a) 5,4
b) 5,5
c) 4,4
d) 3,4
Answer :- For Answers Click Here
7.
a) i=5, j=5, k=2
b) i=6, j=5, k=3
c) i=6, j=4, k=2
d) i=5, j=4, k=2
Answer :-
8. Array elements are stored in memory in the following order
a) Contiguous
b) Random
c) Both contagious and random
d) None
Answer :-
9.
Answer :-
10.
Answer :- For Answers Click Here