answersLogoWhite

0


Best Answer

It really depends on the programming language. In C and C++, all built-in types are initialised to zero when declared static, otherwise they are uninitialised. In Java, however, all data types are implemented as objects and are therefore initialised at the point of instantiation according to whichever constructor is invoked.

User Avatar

Wiki User

6y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is a variable that has been declared and automatically initialized to zero.?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is Undefined in javascript?

In JavaScript undefined is a special value used when a variable has not had a value set to it, or has not been declared.


Static method can use only static variable why?

A static method is a method that is a class method and is not attached to the object of that class. So if we use a non static variable of the class, it would most probably not have been initialized because no object could have been created for the class. Hence it would throw a null pointer exception. To avoid such an ambiguity, there is a restriction that static methods can use only static variables. This is to ensure that class methods can access only class variables both of which would get initialized simultaneously.


What happens if you attempt to use a variable before it has been initialized?

In C, uninitialized variables may contain any value, usually whatever happened to be in the same memory location before the memory was allocated to that function. This is a likely source of bugs, since it means that whatever the programmer meant for the variable to contain was not in it.


What are the data types in java?

There are two types of variables in Java:• Primitives - A primitive variable can be one of eight types: char, boolean, byte, short, int, long, double, or float. Once a primitive has been declared, its primitive type can never change, although in most cases its value can change.• Reference variables - A reference variable is used to refer to (or access) an object. A reference variable is declared to be of a specific type and that type can never be changed.


How do you describe garbage value in c?

/* Example of garbage value */ #include main() { float first = 1234567890123456789.123456789 ; double second=1234567890123456789.123456789 ; long double third = 123456789123456789.123456789; clrscr(); printf(" First=%f",first); printf("\n Second=%lf",second); printf("\n Third=%Lf",third); getch(); return; } output First=1234567939550609410.000000Second=1234567890123456770.000000Third=1234567890123456770.000000

Related questions

What variable is one that has been declared but has not been initialized or assigned a value?

Uninitialized Page 59 Programming Logic and Design by Tony Gladdis


What variable is one that has been declared but has not been initialized or assigned value?

Uninitialized Page 59 Programming Logic and Design by Tony Gladdis


When garbage value occur in c?

Garbage data in C, or in any programming language, occurs when a variable is read without having been initialized first.


Write an expression that computes the sum of two variables in java?

int sum = a + b; PS: a and b are int variables that must have been already declared and initialized.


What is undefined status?

Undefined status refers to a situation where the value of a variable or an expression has not been assigned or defined. This can happen when a programming variable is declared but not initialized, leading to unpredictable behavior when the program is executed. It is important to always assign values to variables to avoid undefined status.


What are the differences of a constant and a variable?

A constant has only the exact value it's declared and can never be changed. A variable can have any number of values assigned. In programming, a variable can be given a value later in the code but can only be changed during runtime if its been declared as a pointer.


What is Undefined in javascript?

In JavaScript undefined is a special value used when a variable has not had a value set to it, or has not been declared.


Static method can use only static variable why?

A static method is a method that is a class method and is not attached to the object of that class. So if we use a non static variable of the class, it would most probably not have been initialized because no object could have been created for the class. Hence it would throw a null pointer exception. To avoid such an ambiguity, there is a restriction that static methods can use only static variables. This is to ensure that class methods can access only class variables both of which would get initialized simultaneously.


When a flood is declared a National Disaster does flood insurance automatically pay if you are in a flood zone?

If you have flood insurance it will cover damage resulting from a flood. It does not matter if a national disaster has been declared or not.


What happens if you attempt to use a variable before it has been initialized?

In C, uninitialized variables may contain any value, usually whatever happened to be in the same memory location before the memory was allocated to that function. This is a likely source of bugs, since it means that whatever the programmer meant for the variable to contain was not in it.


What is the kinds of variables?

There are two types of variables in Java:• Primitives - A primitive variable can be one of eight types: char, boolean, byte, short, int, long, double, or float. Once a primitive has been declared, its primitive type can never change, although in most cases its value can change.• Reference variables - A reference variable is used to refer to (or access) an object. A reference variable is declared to be of a specific type and that type can never be changed.


What are final variable?

Declaring a variable with the final keyword makes it impossible to reassign a different value to that variable once it has been initialized with an explicit value (notice we said explicit rather than default). For primitives, this means that once the variable is assigned a value, the value can't be altered. For example, if you assign 10 to the int variable x, then x is going to stay 10, forever. That's pretty straightforward for primitives, but what does it mean to have a final object reference variable? A reference variable marked final can't ever be reassigned to refer to a different object. The data within the object can be modified, but the reference variable cannot be changed. In other words, if you have a final employee object variable, you can modify aspects of the employee but you cannot have the variable refer to say a manager.