public class Techyield { private static int p = test(); static int test() { return 99; } public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Value of p is "+p); } }
JAVA CODE SNIPPET-2
JAVA CODE SNIPPET-1
package techyield; public class GrandParent { public void method1(int a){ System.out.println("In GrandParent class and in method1 and with one int argument and value is "+a); } }
package techyield; public class Parent extends GrandParent{ public void method1(int a){ System.out.println("In Parent class and in method1 and with one int argument and value is "+a); } }
package techyield; public class Child extends Parent{ public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Main method"); Child child=new Child(); child.method1(2); } public void method1(int a){ System.out.println("In child class and in method1 and with one int argument and value is "+a); } }
What is the Output On the Console ?
Select an answer
Please comment below if you have any doubts.
Educational Documents for F1 Visa
Educational Documents for F1 Visa
- Original degree certificates along with mark sheets.
In case if you didn't received your original degree certificate or if you just completed final year take your mark sheets and provisional certificate if available.
Sometimes immigrant officer may even say , to attend interview after getting documents with out rejecting.
- Original bachelor degree transcripts or high school diploma along with mark sheets all the previous institutions you attended.
- Test scores GRE , TOEFL or IELTS or SAT , GMAT , LSAT . Take all those exam related documents on what basis you got admitted into the University or School or College.
- Some Universities may not require scores , in that case you have to show the proof that University doesn't require such scores .
Note : Having good scores in exams always have good impact or impression during F1 Visa.
Financial Documents for F1 Visa
Financial Documents for F1 Visa
An F1 visa applicant need to show evidence of financial resources, proof of liquid assets sufficient to pay for the entire first year of education and living expenses and also proof of readily available funds to cover the remaining year(s) of studies.
An F1 visa applicant need to show evidence of financial resources, proof of liquid assets sufficient to pay for the entire first year of education and living expenses and also proof of readily available funds to cover the remaining year(s) of studies.
Proof of your Financial resources or documents should be of following category :
- Applicant's personal resources . By showing bank statements either liquid amount , assests , house , land , agricultural lands or Fixed Deposits.
- Pay slips , PF , Employment letters.
- Chartered account statement if available not mandatory.
- Tax returns of the past 3 years (Form 16) .
- In case if someone is sponsoring you , then you have to carry his tax returns of past 3 years , his bank statement showing sufficient funds .
- In case if your sponsor is in US . Then you have to carry a notarized FORM I-134 along with his past 3 years tax returns and bank statement.(It is not better to show assets of persons in the United States).
- Financial aid from the university in the form of a scholarship, fellowship, assistant-ship (TA/GA/RA). which will be mentioned in your I-20 .
- Financial aid from the student's home government if your government is sponsoring for your studies or any private organizations sponsoring you.
Note : Always answer to immigrant officer with confidence , if any transactions done in your bank account recently answer correctly, why those transactions happened . Be ready with answers don't panic .
Useful Links :
Documents Checklist for F1 Visa (Student Visa)
Documents Checklist for F1 Visa (Student Visa)
Mandatory Documents
- Current passport . If you have old passports please carry them too
- Carry copies of first page , last page and remarks page of your current passport.
- One photograph
- Confirmation page of online submitted DS-160 Form with CEAC bar code.
- Visa Fees paid receipt. You have to pay the Visa Fees before attending for the interview .
- Original interview appointment letter and one copy of it.
- (I-901) SEVIS Fee paid receipt and one copy of it.
- Both pages of bar-coded original SEVIS generated Form I-20 which you received from the US School ,College or University that you are going . Take a copy of it .(Xerox copy of I-20)
Note : The original Form I-20 must be signed by you and by the school official.
You may get many I-20's from many universities that you applied but make
sure that you are showing the right one to the authority.
Even if you carry all I-20's .
sure that you are showing the right one to the authority.
Even if you carry all I-20's .
During F1 Visa interview they will never stamp on your I-20 . Once when you
enter US the immigrant officer at the entry will stamp on it.
enter US the immigrant officer at the entry will stamp on it.
- Evidence of financial resouces. so carry your Financial Documents.
- Educational Documents. so carry your Educational Documents .
Petrol Pump solution Mettl.
Question :
A petrol tank has infinite capacity it can store infinite litres of petrol .
There are Four petrolpumps say 1 , 2 , 3 , 4. which are in circular manner.
PetrolTank should start from one petrol pump and should reach other petrolpump and should complete the circle with out any break.
Given input is a two dimensional array first column is petrol capacity of petrolpump and second column is distance to next petrol pump.
If petroltank can start from two petrol pumps means then you should start from least petrol pump number.
Given input array is int [][] array1 ={{3,3},
{7,4},
{7,8},
{9,8}}
For this input petrol tank can start from petrolpump 2 and petrolpump 4 but as we have to start from least number of petrolpump it will start from petrolpump 2 and will finish the circle.
Hints : You have to check whether input is two dimensional array or not .
Solution :
PetrolProblem.java
/**
*
*/
package com.techyield.blogspot.in;
/**
* @author SATYA
*
*/
public class PetrolProblem {
public int startPointofPetrolTank(int [][] input){
int petrolPumpnumber=0;
try{
int row= input.length;
int totaldistance=0;
int totalpetrol=0;
for(int i=0;i<row;i++){
int col=input[i].length;
if(col!=2){
throw new UnsupportedException("Input is not a two dimentional array.");
}
}
for(int i =0; i<row;i++){
totaldistance+=input[i][1];
totalpetrol+=input[i][0];
}
if(totalpetrol<totaldistance){
return 0;
}
for(int i =0; i<row;i++){
if(input[i][0]>input[i][1]){
petrolPumpnumber=i+1;
break;
}
}
}
catch(UnsupportedException e){
System.out.println(e.getMessage());
}
catch(Exception e){
System.out.println(e.getMessage());
}
return petrolPumpnumber;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int [][] array1 ={{3,3},
{7,4},
{7,8},
{9,8}
};
PetrolProblem object = new PetrolProblem();
int petrolPumpindex =object.startPointofPetrolTank(array1);
if(petrolPumpindex >=1)
System.out.println("Petrol Tank will start from PetrolPump "+petrolPumpindex+"");
else
System.out.println("PetrolTank can't start from any petrol pump");
}
}
UnsupportedException.java
package com.techyield.blogspot.in;
public class UnsupportedException extends Exception {
public UnsupportedException(String s){
super(s);
}
}
Output :
Petrol Tank will start from PetrolPump 2
A petrol tank has infinite capacity it can store infinite litres of petrol .
There are Four petrolpumps say 1 , 2 , 3 , 4. which are in circular manner.
PetrolTank should start from one petrol pump and should reach other petrolpump and should complete the circle with out any break.
Given input is a two dimensional array first column is petrol capacity of petrolpump and second column is distance to next petrol pump.
If petroltank can start from two petrol pumps means then you should start from least petrol pump number.
Given input array is int [][] array1 ={{3,3},
{7,4},
{7,8},
{9,8}}
For this input petrol tank can start from petrolpump 2 and petrolpump 4 but as we have to start from least number of petrolpump it will start from petrolpump 2 and will finish the circle.
Hints : You have to check whether input is two dimensional array or not .
Solution :
PetrolProblem.java
/**
*
*/
package com.techyield.blogspot.in;
/**
* @author SATYA
*
*/
public class PetrolProblem {
public int startPointofPetrolTank(int [][] input){
int petrolPumpnumber=0;
try{
int row= input.length;
int totaldistance=0;
int totalpetrol=0;
for(int i=0;i<row;i++){
int col=input[i].length;
if(col!=2){
throw new UnsupportedException("Input is not a two dimentional array.");
}
}
for(int i =0; i<row;i++){
totaldistance+=input[i][1];
totalpetrol+=input[i][0];
}
if(totalpetrol<totaldistance){
return 0;
}
for(int i =0; i<row;i++){
if(input[i][0]>input[i][1]){
petrolPumpnumber=i+1;
break;
}
}
}
catch(UnsupportedException e){
System.out.println(e.getMessage());
}
catch(Exception e){
System.out.println(e.getMessage());
}
return petrolPumpnumber;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int [][] array1 ={{3,3},
{7,4},
{7,8},
{9,8}
};
PetrolProblem object = new PetrolProblem();
int petrolPumpindex =object.startPointofPetrolTank(array1);
if(petrolPumpindex >=1)
System.out.println("Petrol Tank will start from PetrolPump "+petrolPumpindex+"");
else
System.out.println("PetrolTank can't start from any petrol pump");
}
}
UnsupportedException.java
package com.techyield.blogspot.in;
public class UnsupportedException extends Exception {
public UnsupportedException(String s){
super(s);
}
}
Petrol Tank will start from PetrolPump 2
Java quiz 1
Ques 1 : Which declaration of the main method below would allow a class to be started as a standalone program.
(A) public static int main(char args[])
(B) public static void main(String args[])
(C) public static void MAIN(String args[])
(D) public static void main(String args)
Answer : public static void main(String args[])
Ques 2 : What is the meaning of the return data type void?
(A) An empty memory space is returned so that the developers can utilize it.
(B) void is not supported in Java
(C) void returns no data type.
(D) null
Answer : void returns no data type.
Ques 3 : Which of these are legal identifiers.
(A) number_1
(B) number_a
(C) $1234
(D) All of the above.
Answer : All of the above.
Ques 4 : Which of the following are Java keywords?
(A) throw
(B) void
(C) private
(D) All of the above.
Answer : All of the above.
Ques 5 : A lower precision can be assigned to a higher precision value in Java. For example a byte type data can be assigned to int type.
(A) True
(B) False
Answer : True
Ques 6 : Which of these are not legal identifiers.
(A) 1alpha
(B) xy+abc
(C) both A and B
(D) None of the above
Answer : both A and B
Ques 7 : Which of the following are legal definitions of the main method that can be used to execute a class.
(A) public static int main(String args[])
(B) public void main(String args)
(C) public static void main(String args[])
(D) public static void main(string args[])
Answer : public static void main(String args[])
Ques 8 : Which of the following statements about the Java language is true?
(A) Both procedural and OOP are supported in Java.
(B) Java supports only procedural approach towards programming.
(C) Java supports only OOP approach.
(D) None of the above.
Answer : Both procedural and OOP are supported in Java.
Ques 9 : Which of the following are keywords in Java.
(A) implement
(B) friend
(C) NULL
(D) synchronized
Answer : synchronized
Ques 10 : Which of these are legal array declarations or definitions?
(A) int[] []x[];
(B) int x[5];
(C) int *x;
(D) None of above
Answer : int[] []x[];
Ques 11 : What gets printed when the following code is compiled and run with the following command - java test 2 Select the one correct answer.
public class test {
public static void main(String args[]) {
Integer intObj=Integer.valueOf(args[args.length-1]);
int i = intObj.intValue();
if(args.length > 1)
System.out.println(i);
if(args.length > 0)
System.out.println(i - 1);
else
System.out.println(i - 2);
}
}
(A) test
(B) test -1
(C) 0
(D) 1
Answer : 1
Description :Note that the program gets one command line argument - 2. args.length will get set to 1. So the condition if(args.length > 1) will fail, and the second check if(args.length > 0) will return true.
Ques 12 : Which of the following statements is false about objects?
(A) An instance of a class is an object
(B) Objects can access both static and instance data
(C) Objects do not permit encapsulation
(D) Object is the super class of all other classes
Answer : Objects do not permit encapsulation
Ques 13 : Which of these are legal identifiers. Select the three correct answers.
a. number_1
b. number_a
c. $1234
d. -volatile
(A) a, b, c
(B) a, b
(C) a
(D) b
Answer : a, b, c
Ques 14 : The class Hashtable is used to implement which collection interface. Select the one correct answer.
(A) List
(B) Set
(C) Map
(D) SortedSet
Answer : Map
Description :
The collection interface Map has two implementation HashMap and Hashtable.
Ques 15 : TreeMap class is used to implement which collection interface. Select the one correct answer.
(A) Set
(B) SortedSet
(C) Tree
(D) SortedMap
Answer : SortedMap
Ques 16 : Given a one dimensional array arr, what is the correct way of getting the number of elements in arr. Select the one correct answer.
(A) arr.length
(B) arr.length - 1
(C) arr.size
(D) arr.length()
Answer : arr.length
Ques 17 : What happens when the following code is compiled and run. Select the one correct answer.
for(int i = 1; i < 3; i++)
for(int j = 3; j > i; j--)
assert i!=j {System.out.println(i); }
(A) The class compiles and runs, but does not print anything.
(B) The number 1 gets printed with AssertionError
(C) The program generates a compilation error.
(D) The number 2 gets printed with AssertionError
Answer : The program generates a compilation error.
Description :The condition in assert statement must be followed by a semi-colon.
Ques 18 : What gets displayed on the screen when the following program is compiled and run. Select the one correct answer.
protected class example {
public static void main(String args[]) {
String test = "abc";
test = test + test;
System.out.println(test);
}
}
(A) The class does not compile because the top level class cannot be protected.
(B) The program prints "abc"
(C) The program prints "abcabc"
(D) The program does not compile because statement "test = test + test" is illegal.
Answer : The class does not compile because the top level class cannot be protected.
Ques 19 : In the following class definition, which is the first line (if any) that causes a compilation error. Select the one correct answer.
public class test {
public static void main(String args[]) {
char c;
int i;
c = 'A'; // 1
i = c; //2
c = i + 1; //3
c++; //4
}
}
(A) The line labeled 1.
(B) The line labeled 2.
(C) The line labeled 3.
(D) All the lines are correct and the program compiles.
Answer : The line labeled 3.
Description :It is not possible to assign an integer to a character in this case without a cast.
Ques 20 : Which of the following is a Java keyword. Select the four correct answers.
a. extern
b. synchronized
c. volatile
d. friend
e. friendly
f. transient
g. this
h. then
(A) b, c
(B) b, c, f, g
(C) e, g, h
(D) all of above.
Answer : b, c, f, g
Subscribe to:
Posts (Atom)
Featured Post
H1B Visa Stamping at US Consulate
H1B Visa Stamping at US Consulate If you are outside of the US, you need to apply for US Visa at a US Consulate or a US Embassy and get H1...
-
Ques 1 : Which declaration of the main method below would allow a class to be started as a standalone program. (A) public static int main(c...
-
1. Two Sum Two Sum Solution 2. LRU Cache LRU Cache Solution 3. Number Of Islands 4. Longest Palindromic Substring 5. Lowest...
-
basics Linux fundamentals like system calls , strace , linux mange memory, shared memory, kernel using, boot process, DNS resolving ( how t...