Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Interview Questions and Answers for 'Computer solutions' - 6 question(s) found - Order By Newest | ||||
Frequently asked to fresh graduates and less experienced. | ||||
| ||||
Ans. 1. public is the access modifier that makes the method accessible from anywhere, static is the keyword that makes it accessible even without creating any object, void means it doesn't return anything , String args[] is the array of argument that the method receives. 2. If we use main without the string args , it will compile correctly as Java will treat it as just another method. It wont be the method "main" which Java looks for when it looks to execute the class and hence will throw Error: Main method not found in class , please define the main method as: public static void main(String[] args) 3. Main is not a keyword but a special string that Java looks for while initiating the main thread. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   main method Asked in 4 Companies basic   frequent | ||||
Try 1 Question(s) Test | ||||
Frequently asked to fresh graduates. | ||||
| ||||
Ans. ACID stands for Atomicity, Consistency, Isolation, Durability is a set of properties of database transactions. Atomicity means all or nothing. i.e parts of a transaction shouldn't commit if any one of them fails. Either the whole transaction should succeed or it should be complete rollback. Consistency means that any transaction should lead database from one stabe state to another. Isolation means that the execution of transaction results in a system state that would be obtained if transactions were executed serially. Durability means that when a transaction is committed it forms the permanent state of database. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  database  acid Asked in 7 Companies Intermediate | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. class A { void test() { System.out.println("test() method"); } } class B { void test() { System.out.println("test() method"); } } Suppose if Java allows multiple inheritance like this, class C extends A, B { } A and B test() methods are inheriting to C class. So which test() method C class will take? As A & B class test() methods are different , So here we would Facing Ambiguity. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  multiple inheritance  object oriented programming (oops)  oops concepts  diamond problem Asked in 20 Companies basic   frequent | ||||
| ||||
Ans. public void checkIfAnagram(String str1,String str2){ boolean anagram = true; for(char c:str1.toCharArray()){ if(!str2.contains(String.valueOf(c))){ System.out.println("Strings are Anagrams"); anagram = false; } if(anagram == true){ System.out.println("Strings are not Anagrams"); } } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   check if 2 strings are Anagrams Asked in 30 Companies basic   frequent | ||||
| ||||
Ans. Jar is Java Archieve i.e compressed Class or Class / Java files. War comprises of compressed Servlet class files,JSP FIles,supporting files, GIF and HTML files. Ear comprise of compressed Java and web module files ( was files ). | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   j2ee   jar   web development   war   ear   build management   release management Asked in 12 Companies basic   frequent | ||||
| ||||
Ans. import java.util.Random; public class OTPGenerator { public static void main(String[] args) { int otpLength = 4; String otp = generateOTP(otpLength); System.out.println("Generated OTP: " otp); } private static String generateOTP(int length) { StringBuilder otp = new StringBuilder(); Random random = new Random(); for (int i = 0; i < length; i ) { int digit = random.nextInt(10); otp.append(digit); } return otp.toString(); } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   Asked in 1 Companies | ||||