question 10 in C++ 4. by scalar Question 8 Which of the following statements dec
ID: 3715140 • Letter: Q
Question
question 10 in C++
4. by scalar Question 8 Which of the following statements declares a one-dimensional array tters of the alphabet. char letters[5]'a', 'b', 'C','d''e char letters [5-{"a", "b", "c", "d'' , ''e'' } ; char letters[5]'a 'b' 'c'd ei 4. char letters [5] ("a" "C"; "d" "e" Question 9 What happens when an array declaration statement does not provide an in numeric array? 1. The compiler automatically initialises the elements, so the array elemen 2. The compiler does not automatically initialise the elements, but as it is a numeric value. 3. 4. The compiler does not automatically initialise the elements, so the array e The compiler automatically initialises the elements with 0. Question 10 Given the array declaration below, what is stored in numbers[2] ? int numbers [5] (1, 2, 3, 4, 51 2. 1 3. 2 4)) 3Explanation / Answer
1. answer is option (a) char letters[5]={'a','b','c','d','e'};
here we are declaring a one dimensional array of 5 characters. when initializing array with characters it should enclose within single quote.
in option b, characters enclosed within double quote. it is a wrong way of initialization.
in option c and d, characters within curly brace are seperated by semicolumn(;). it is wrong. characters should be seperated by commas.
2. answer is option (d)
if an array declaration does not provide an initialization at the time of declaration. the compiler automatically initialize it with zeros.
note : question 2 is not visible completely. as of the visible options i have choosed d as the answer. u pls give question no.2 completely in the comment box or edit the question.
3. answer is option (d) 4.
array index starts from 0. so numbers[2] contains 3. the values initialized to numbers are as follows,
numbers[0] = 1
numbers[1] = 2
numbers[2] = 3
numbers[3] = 4
numbers[4] = 5
***********************END*************PLS GIVE ME UPVOTE*****************************
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.