You will type
400*2*1.5
1.5 is another way to say 1 1/2
Answer:
True: In binary search algorithm, we follow the below steps sequentially:
Input: A sorted array B[1,2,...n] of n items and one item x to be searched.
Output: The index of x in B if exists in B, 0 otherwise.
- low=1
- high=n
- while( low < high )
- { mid=low + (high-low)/2
- if( B[mid]==x)
- {
- return(mid) //returns mid as the index of x
- }
- else
- {
- if( B[mid] < x) //takes only right half of the array
- {
- low=mid+1
- }
- else // takes only the left half of the array
- {
- high=mid-1
- }
- }
- }
- return( 0 )
Explanation:
For each iteration the line number 11 or line number 15 will be executed.
Both lines, cut the array size to half of it and takes as the input for next iteration.
No I don’t think so personally
Yes because it’s the square size of life
Answer:
The main method should simply terminate if the FileNotFoundException occurs.
Explanation:
Considering the full code snippet
snippet:public static void main(String[] args) throws FileNotFoundException
public static void main(String[])
represent the entry point method to a java main method
The addition of
throws FileNotFoundException
widens the scope of the main method to explicitly specifies that an exception named the FileNotFoundException may be thrown.
So, if any part of the code explicitly throws the FileNotFoundException the compiler makes use of this to throw an exception.
By throwing an exception, the main method is not catching any exceptions, instead it handles the FileNotFoundException by throwing it to the source which invoked the main method
This is required by the compiler to terminate the program if the FileNotFoundException occurs.