Chào mừng bạn đến blog thù.vn Trang Chủ

Table of Content

Which one of the following statements is not a valid array declaration ✅ Chất

Kinh Nghiệm Hướng dẫn Which one of the following statements is not a valid array declaration Mới Nhất

Hoàng Nhật Mai đang tìm kiếm từ khóa Which one of the following statements is not a valid array declaration được Cập Nhật vào lúc : 2022-10-10 08:50:26 . Với phương châm chia sẻ Thủ Thuật về trong nội dung bài viết một cách Chi Tiết 2022. Nếu sau khi đọc Post vẫn ko hiểu thì hoàn toàn có thể lại Comment ở cuối bài để Tác giả lý giải và hướng dẫn lại nha.

5. 

Which of the following statements are correct about an array?

Nội dung chính
    Which of the following statements about array declaration is false?Which of the following is valid array declaration in Java?When you create a numeric array in C# What default value is assigned to its elements?Is an object that can hold a group of values that must all be the same data type?
1: The array int num[26]; can store 26 elements. 2: The expression num[1] designates the very first element in the array. 3: It is necessary to initialize the array the time of declaration. 4: The declaration num[SIZE] is allowed if SIZE is a macro. [A]. 1 [B]. 1,4 [C]. 2,3 [D]. 2,4

Answer: Option B

Explanation:

1. The array int num[26]; can store 26 elements. This statement is true.

2. The expression num[1] designates the very first element in the array. This statement is false, because it designates the second element of the array.

3. It is necessary to initialize the array the time of declaration. This statement is false.

4. The declaration num[SIZE] is allowed if SIZE is a macro. This statement is true, because the MACRO just replaces the symbol SIZE with given value.

Hence the statements '1' and '4' are correct statements.

Manoj Joshi said: (Dec 22, 2010)   SIZE is a macro but it is not sure that SIZE will expand to an integer, it could also be like this

#define SIZE 2.55

Amit said: (Jul 2, 2011)   It is necessary to initialize the array the time of declaration.

I think this is the correct statement. Please evaluate this option

Gopinath.Nan said: (Jul 30, 2011)   num[26] store the 27 elements because it start with 0,1,2......26.

LIKE THAT only, then how is it true?

Nick said: (Sep 6, 2011)   int a;
#define SIZE a
int num[SIZE];

Na-ah... This question needs to state that the MACRO evaluates to a non-negative integer...

The_Void said: (Sep 12, 2011)   "The declaration num[SIZE] is allowed if SIZE is a macro."

#1
num[SIZE] is not a valid declaration. Be coherent in your questions.
int num[SIZE] or "type" num[SIZE] should be...

#2
Declaration depend of how SIZE macro was defined.

Jeff Mccracken said: (Jan 23, 2012)   SIZE could also be defined as such : int SIZE and thus size would be a valid array index and thus the index SIZE would also be allowed. The way the #4 answer is worded seems to imply that it's ONLY allowed if SIZE is a macro.

Dilini said: (Sep 8, 2013)   I want to know why the third statement is false?

Sahini said: (Sep 26, 2013)   Why the third statement is false?

Rathi said: (Oct 1, 2013)   @Gopinath.Nan.

num[26] store the 26 elements because it start with 0,1,2......25.

Suman Saurabh said: (Jun 13, 2014)   But in question it is not mentioned (Turbo C, or gcc) but in gcc it not necessary that SIZE must be macro it also may be a simple variable.

E.g.

int SIZE = 26;
int num[SIZE];

Shireen Nagdive said: (Sep 16, 2014)   According to me, third statement is false because it is not necessary to give values to the array elements the time of declaration. We can simply do eg. int array[10];Execute other steps and then through scanf or whatever way can give value to the array elements.

Vijay said: (Dec 7, 2014)   Third statement is false because it is not must initialization of array, the time of declaration.

int num[26];true.
int num[]=0, 1, 2.25;true.

Because sizeof(num) --->52B (2*26).

But int num[];error. Means initialization not must and should the time of declaration but specify the arr size is must.

Nidhi Goud said: (Feb 7, 2022)   Why y is necessary to give the size of an array in an array declaration?

Nitish said: (Apr 13, 2022)   Yes, it can store 26 elements, and also 27 elements. Statement does not say it store only 26 elements.

Kiruba said: (May 30, 2022)   I am totally confused. Someone plese explain.

Niharika said: (Jan 9, 2022)   What does macro mean? Pease anyone say me.

Iggi said: (Mar 28, 2022)   num[SIZE] is not a proper DECLARATION.
DECLARATION would be int num[SIZE];

Pranali said: (Apr 1, 2022)   @Amit.

It is not compulsory to initialize array the time of declaration.
we can initialize array thành viên by thành viên also.as,

arr[0]=1;
arr[1]=2;
.
.
.
.etc

Pranali said: (Apr 1, 2022)   @Nidhi Goud.

Because an array allocates memory compile the time not runtime, so we have to say to the compiler that 'my array will contain 1,2,etc (any one digit) number of elements'. got it?

Pranali said: (Apr 1, 2022)   @Niharika.

Writting macro means we have to replace that particular value/function/whatever with another value(same like find and replace method).

How to write macro?

ans=> # define a 10;
that means the value'10' will replace the position of ' a' throughout the program.
'#' indicates that it is(macro expansion is) work of preprocessor.

Gowtham Raj said: (Jan 4, 2022)   Size is not only a macro it may be a variable also.

Post your comments here:

Name *:

E-Mail   : (optional)

» Your comments will be displayed only after manual approval.


Which of the following statements about array declaration is false?

This statement is false, because it designates the second element of the array. 3. It is necessary to initialize the array the time of declaration. This statement is false. ... 50001..

Which of the following is valid array declaration in Java?

The following Java array declarations are actually all valid: int[] intArray; int intArray[]; String[] stringArray; String stringArray[]; MyClass[] myClassArray; MyClass myClassArray[];

When you create a numeric array in C# What default value is assigned to its elements?

The default values of numeric array elements are set to zero, and reference elements are set to null . A jagged array is an array of arrays, and therefore its elements are reference types and are initialized to null .

Is an object that can hold a group of values that must all be the same data type?

Array. Also known as a list, an array is a data type that stores a number of elements in a specific order, typically all of the same type. Since an array stores multiple elements or values, the structure of data stored by an array is referred to as an array data structure. Tải thêm tài liệu liên quan đến nội dung bài viết Which one of the following statements is not a valid array declaration

Clip Which one of the following statements is not a valid array declaration ?

Bạn vừa đọc Post Với Một số hướng dẫn một cách rõ ràng hơn về Clip Which one of the following statements is not a valid array declaration tiên tiến nhất

Share Link Tải Which one of the following statements is not a valid array declaration miễn phí

Hero đang tìm một số trong những ShareLink Download Which one of the following statements is not a valid array declaration Free.

Thảo Luận thắc mắc về Which one of the following statements is not a valid array declaration

Nếu sau khi đọc nội dung bài viết Which one of the following statements is not a valid array declaration vẫn chưa hiểu thì hoàn toàn có thể lại Comments ở cuối bài để Mình lý giải và hướng dẫn lại nha #statements #valid #array #declaration - 2022-10-10 08:50:26

Post a Comment