Answer:
A
Explanation:
Only one condition can be true
Answer:
The two main differences between arrays and structures are as following according to me :-
1. Array is collection of data elements of same data type while a structure is collection of variables of different data types.
2.Array is a primitive data type while structure is a user defined data type.
There are other differences also which are as following:-
1. The size of array is fixed while the size of structure is not fixed as structure can contain different variables of different data types.
2.array is declared as following :-
int array [100];
where 100 is the size of the array means it can store up to 100 integer values.
struct class{
int roll_number;
char *name;
int admission_no;
};
3.Traversing and searching in an array is easy and fast while it is difficult and slow in structures.
Answer:
See Explaination
Explanation:
public class testscope
{
//start of main function
public static void main(String[] args)
{
//varible declration
int i;
int x;
//loop for 10 times
for(i=0; i<10; i++)
{
//initialize value of x to 10
x = 10;
}
//the scope of variable x is visible outside of for loop
System.out.println("The value of x is: "+x);
}
}
See attachment for sample output
nb:
You can clearly see in the output of Java program the value of x is not printed and program return errors. It means the variable x declared inside for loop does not has scope outside the for loop.
D size
Read more
Hope,this helped