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.
The answer is c. Inkjet printer
Answer:
Follows are the code to the given question:
def steps_to_miles(user_steps):#defining a method steps_to_miles that takes a variable user_steps
return user_steps/2000#use return to calculate the steps
user_steps = int(input())#defining a variable user_steps that holds value from the user-end
print('%0.2f' % steps_to_miles(user_steps))#defining print that calls the steps_to_miles method
Output:
5345
2.67
Explanation:
In this code a method "steps_to_miles" that takes "user_steps" in the parameter inside the method a return keyword is used that calculates the user steps and return its values.
Outside the method, a "user_steps" variable is declared that inputs the value from the user-end pass into the method and prints its value.
Explanation:
A computer is a machine that can be programmed to accept data (input), process it into useful information (output), and store it away (in a secondary storage device) for safekeeping or later reuse. The processing of input to output is directed by the software but performed by the hardware.
Answer:
O(n²)
Explanation:
The worse case time complexity of insertion sort using binary search for positioning of data would be O(n²).
This is due to the fact that there are quite a number of series of swapping operations that are needed to handle each insertion.