Category Archives: Techbeamers

Core Java Quiz Online Test with 40 String Questions

Today, we’ve added another cracker in our core Java quiz online test series. With top 30 40 Java String questions, it’ll prove to be a great help for those interested in learning the concept of Java String. The Java development kit provides various strings classes to make programmers job easy. There are several Java classes like String, StringBuffer and StringBuilder that implements string handling functionality. For your note, Java String is one of the commonly asked topic in all the Java interviews so this quiz is here to test your preparation level. This subject is so common and interesting that we couldn’t hold to deliver this core Java quiz online test to help both software developers and test engineers.

One of the key factor to introduce the core Java quiz online test was to teach our readers about the core functionality of Java String. So that they get to know all the important facts about the Java String and classes like StringBuffer, StringBuilder etc. Hence we’ve included top 30 40 Java String interview questions in this quiz to make it as conclusive as it could be. Also, we’ve stretched the quiz from 25 to 30 40 questions to meet our commitment to push volume with quality. :)

Core Java Quiz Online Test – String Handling.

Time limit: 0

Quiz-summary

0 of 40 questions completed

Questions:

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40

Information

For your information, please note that this Java String Interview Questions Quiz has only single choice questions. We suggest to please carefully attempt all the questions. Press the below Start quiz button to go ahead.
Core Java quiz online test.

Core Java Quiz Online Test.


Please continue.

You have already completed the quiz before. Hence you can not start it again.

Quiz is loading…

You must sign in or sign up to start the quiz.

You have to finish following quiz, to start this quiz:

Results

0 of 40 questions answered correctly

Your time:

Time has elapsed

You have reached 0 of 0 points, (0)

Average score

Your score

Categories

  1. Java
    0%
  • Hopefully you have enjoyed the Java String Interview Questions Quiz, please do share this post on facebook, twitter and other social media platforms of your choice.

    For your information.

    If you want to view the correct answers for this Java String Interview Questions Quiz then please press the View questions button shown below.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40

  1. Answered

  2. Review
Question 1 of 40
1. Question

10 points

Which of the following is not valid in case of Java String?






Correct

Incorrect

Note: String class represents the character Strings not the array of Strings.

Question 2 of 40
2. Question

10 points

Which of the following correctly describes the reason for String to be final or immutable?






Correct

Incorrect
Question 3 of 40
3. Question

10 points

Which of the following is the correct difference between String and StringBuffer in Java?






Correct

Incorrect
Question 4 of 40
4. Question

10 points

Which of the following is the correct difference in String on C and Java?






Correct

Incorrect
Question 5 of 40
5. Question

10 points

What does the following instruction suppose to do?
str.replaceAll(Character.toString(c), “”);






Correct

Incorrect
Question 6 of 40
6. Question

10 points

Which of the following is used to compare two Strings in java program? And if string matches, it returns non zero value?






Correct

Incorrect
Question 7 of 40
7. Question

10 points

Which of the following statement would correctly convert String to byte array and vice versa?






Correct

Incorrect
Question 8 of 40
8. Question

10 points

Which of the following correctly defines String pool in Java?






Correct

Incorrect
Question 9 of 40
9. Question

10 points

What does the intern() method do in Java?






Correct

Incorrect
Question 10 of 40
10. Question

10 points

Why Char array is preferred over String for storing password?






Correct

Incorrect
Question 11 of 40
11. Question

10 points

What would be the results of the last two statements?

String x = "techbeamers";
String y = new String(new char[] { 't', 'e', 'c', 'h', 'b', 'e', 'a', 'm', 'e', 'r', 's' });

System.out.println(x == y);
System.out.println(x.equals(y));






Correct

Incorrect
Question 12 of 40
12. Question

10 points

Which of the following correctly describes the difference in the way the two “==” and equals() work in Java?






Correct

Incorrect
Question 13 of 40
13. Question

10 points

Which statement is valid for the fact mentioned below?
Immutable objects are naturally thread-safe.





Correct

Note: Because immutable objects can not be changed, they can be shared among multiple threads freely. This eliminate the requirements of doing synchronization.


Incorrect
Question 14 of 40
14. Question

10 points

Which statement is valid for the fact mentioned below?
If we change the value of an existing String object then it creates a new object instead of updating the existing object.





Correct

Incorrect
Question 15 of 40
15. Question

10 points

Which statement is valid for the fact mentioned below?
If you plan to modify a String, then better use StringBuffer. StringBuffer updates the existing objects value, rather creating a new object.





Correct

Incorrect
Question 16 of 40
16. Question

10 points

Is it possible to use String in the switch statement?






Correct

Incorrect
Question 17 of 40
17. Question

10 points

Which of the following correctly describes the result of the below line of code in Java?

String[] strArray = aString.split("\\s+");





Correct

Incorrect
Question 18 of 40
18. Question

10 points

What is the output of the Java statement given below?

System.out.println(Integer.parseInt("10"));





Correct

Incorrect

Note: The statement Integer.parseInt(“10”); would return the output as 10.

Question 19 of 40
19. Question

10 points

What is the initial capacity of the string builder in the example given below?

StringBuilder sb = new StringBuilder("top 30 Java String interview questions.");




Correct

Incorrect

Note: Initial capacity of the string builder is the length of the initial string + 16.

Question 20 of 40
20. Question

10 points

What is the output value and the length of the string returned by the below expression?

"Was it a bee or a bat I saw?".substring(9, 12);





Correct

Incorrect
Question 21 of 40
21. Question

10 points

What is the value displayed by the expression Java.length()?

String Java = "Are you a Java expert? Yes, you are.";




Correct

Incorrect
Question 22 of 40
22. Question

10 points

What is the value returned by the method call Java.charAt(9)?

String Java = "Are you a Java expert? Yes, you are.";





Correct

Incorrect
Question 23 of 40
23. Question

10 points

Which of the following expression would return the letter “?” from the string referred by JavaStr?

String JavaStr = "Are you a Java expert? Yes, you are.";

read more

How to use Google trends to improve SEO of your blog

Heard about Google Trends, or may be not using it that often? In this article, we are going to show you some path-breaking search engine optimization techniques by using Google trends to improve SEO. Google trends is one of the flagship tool freely available for spotting popular trends and keyword search. It is like a master key that can unlock the hidden SEO treasure for your website. You just need to know how to use Google trends and the right approach that can deliver the results you expected.

read more

Selenium WebDriver Quiz With Top 30 Interview Questions

Hey Selenium testing geeks, we’ve now brought a challenging but interesting quiz on Selenium WebDriver framework powered with top 30 Selenium WebDriver interview questions to help you in rehearsing your Selenium knowledge. This quiz is the second submission to our on-going series of Selenium WebDriver quizzes. It’s no secret that the Selenium WebDriver is one of the most frequently asked topic in any testing interview. And that’s where this quiz is gonna help you a lot. And that’s the reason we’ve ramped up this quiz for both software developers and test engineers so that they can easily face the Selenium questions in their job interview.

Another important aspect to come out with such a quiz was to train our readers on the topic of Selenium WebDriver. So that they get to know all the relevant facts about the web UI automation testing. Hence, we’ve tried our best to add all the relevant Selenium questions in this quiz to make it as meaningful as it could be. Also, we’ve stretched the quiz with 30 questions which is a bit more than the usual size of our earlier quizzes.

Selenium WebDriver Quiz – Top 30 Selenium Interview Questions.

Time limit: 0

Quiz-summary

0 of 30 questions completed

Questions:

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30

Information

For your information, please note that this Selenium WebDriver UI framework quiz has only single choice questions. We suggest to please carefully attempt all the questions. Press the below Start quiz button to go ahead.
Selenium webdriver quiz with best 30 selenium questions.

Selenium webdriver quiz with best 30 selenium questions.


Please continue.

You have already completed the quiz before. Hence you can not start it again.

Quiz is loading…

You must sign in or sign up to start the quiz.

You have to finish following quiz, to start this quiz:

Results

0 of 30 questions answered correctly

Your time:

Time has elapsed

You have reached 0 of 0 points, (0)

Average score

Your score

Categories

  1. Selenium
    0%
  • Hopefully you have enjoyed the Selenium WebDriver UI framework quiz, please do share this post on facebook, twitter and other social media platforms of your choice.

    For your information.

    If you want to view the correct answers for this Selenium WebDriver UI framework quiz then please press the View questions button shown below.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30

  1. Answered

  2. Review
Question 1 of 30
1. Question

10 points

Which of the following is a correct statement that describes the keyword driven framework?






Correct

Incorrect
Question 2 of 30
2. Question

10 points

Which of the following is not a valid component of an UI automation framework?







Correct

Incorrect
Question 3 of 30
3. Question

10 points

Which of the following is not an advantage of Page Object Model?







Correct

Incorrect
Question 4 of 30
4. Question

10 points

Which of the following is correct in case of WebDriver?




Correct

Incorrect
Question 5 of 30
5. Question

10 points

Which of the following WebDriver is used for Headless browser testing?






Correct

Incorrect
Question 6 of 30
6. Question

10 points

Why is the contextClick() used for?






Correct

Incorrect
Question 7 of 30
7. Question

10 points

Which of the following is a correct difference b/w getWindowHandles() and getWindowHandle()?






Correct

Incorrect
Question 8 of 30
8. Question

10 points

Why would you like to choose WebDriver over Selenium RC?






Correct

Incorrect
Question 9 of 30
9. Question

10 points

Which of the following is the recommended way to handle dynamic elements?






Correct

Incorrect
Question 10 of 30
10. Question

10 points

Why is the actions class used for in WebDriver?






Correct

Incorrect
Question 11 of 30
11. Question

10 points

Which of the following WebDriver class is used to run Selenium tests in internet explorer?






Correct

Incorrect
Question 12 of 30
12. Question

10 points

Which of the following is the default status of JavaScript in HTMLUnitDriver?





Correct

Incorrect
Question 13 of 30
13. Question

10 points

Is it possible to enable JavaScript in HTMLUnitDriver during driver initialization? If yes, then how?



  • WebDriver driver = new HtmlUnitDriver(true);


  • HtmlUnitDriver driver = new HtmlUnitDriver(true);


  • WebDriver driver = new HtmlUnitDriver();
    driver.setJavascriptEnabled(true);


Correct

Incorrect
Question 14 of 30
14. Question

10 points

What exactly are the below instructions meant for?

FirefoxProfile profile = new FirefoxProfile();
profile.addAdditionalPreference("general.useragent.override", "some logical name");
WebDriver driver = new FirefoxDriver(profile);





Correct

Incorrect
Question 15 of 30
15. Question

10 points

Which of the following WebDriver method that supports moving between named windows?






Correct

Incorrect
Question 16 of 30
16. Question

10 points

What does the below Selenium WebDriver code would subject to do?

Alert alert = driver.switchTo().alert();





Correct

Incorrect
Question 17 of 30
17. Question

10 points

Which of the following statement describes the most appropriate way to delete the cookies?


driver.manage().deleteCookieNamed("CookieName");


driver.manage().deleteCookie(CookieId);


driver.manage().deleteCookieNamed("CookieName");
driver.manage().deleteCookie(CookieId);

read more

Java Collections Framework Quiz for Experienced

Today, we’ve come up with a mind-boggling Java collections framework quiz featured with 25 best questions to help you learning the concept of Java collections. The Java collections framework (JCF) is a system of classes and interfaces that implements reusable collection data structures like list, set and hash maps etc. To your information, we must tell you that Java collections is the most frequently asked topic in any Java interview so the quiz would help you a lot to get prepared. And that’s the reason we’ve ramped up this quiz for both software developers and test engineers so that they can assess their Java programming skills.

read more

Top 20 TestNG Framework Interview Questions & Answers

TestNG is a progressive test automation framework which is designed to serve the needs of both software developers and the test engineers. And in this post, we’ve selected 20 best interview questions on Selenium TestNG framework to boost your Selenium test automation skills.

TestNG framework overview:

Before we jump up to the interview question’s section, let’s know a bit more about the TestNG framework and its features. TestNG is actually an advancement over the JUnit framework which is frequently used by Java developers for unit testing of their source code. But there were certain limitations in JUnit framework that led to the rise of TestNG framework.

TestNG framework interview questions

TestNG framework interview questions.

TestNG source code is controlled by the Apache software license and it is freely available for the download. The most common use of TestNG framework is with the Selenium WebDriver to produce browser based test automation.

TestNG framework supports intuitive HTML report style to share with stakeholders. The report includes product health indicators such as pass/fail count, the age of defect etc. This TestNG report fills the gap cropped up by the inability of WebDriver to generate the report. On the top, TestNG offers exceptional handling support that allows a program to run without exiting abruptly.

TestNG framework Features:

TestNG framework introduces some new features that make it more powerful and easier to use, such as:
1) Annotations – An annotation is a form of metadata in java which can be applied at various elements of java source code so that any tool, debugger or application program can use these annotations. Classes, methods, variables, parameters and packages may be annotated. For your information, please note that the annotations in java source code are compiled into byte-code with other class members. And programmers can use reflection to query this metadata information to decide the appropriate action to perform in any particular context.

A metadata is data about data. Metadata adds some additional flags on your actual data. So that in runtime JVM can identify these flags and use this metadata information to take appropriate action.

2) Provides arbitrarily big thread pools to run tests in their own thread, one thread per test class, etc.
3) Ensure that your code is thread-safe.
4) Flexible test configuration.
5) Supports data-driven testing (with @DataProvider).
6) Support for parameters.
7) Powerful execution model (Independent of TestSuite).
8) Easy integration with a variety of tools and plug-ins (Eclipse, Maven, Jenkins etc.).
9) Embeds Bean Shell for further flexibility.
10) Uses default JDK functions for runtime and logging (no dependencies).
11) Dependent methods for application server testing.

Till now you would have gained a fair idea about the TestNG framework and its features. There is plenty of nice material available online,  you can refer it to enhance your skill.

If you are a learner then you would also like to read our lately published posts on Selenium WebDriver interview questions and will love to attempt the brain shaking quiz.

Boost Your Selenium Test Automation Skills.

1. Selenium interview questions and answers.

How to Use Page Object Model in WebDriver Project.

2. Page object model and selenium webdriver tutorial.

Attempt this Amazing Selenium WebDriver Quiz.

3. Selenium quiz to boost your testing skills.

But now, it’s time to loop through the set of top Selenium TestNG interview questions that we’ve rolled up after in-depth research.

Question #1) What is the significance of testng.xml file?

Answer: In a Selenium TestNG project, we use testng.xml file to configure the complete test suite into a single file. This file makes it easy to group all the test suites and their parameters in one file. It also gives the ability to pull out subsets of your tests or split several runtime configurations. Few of the tasks which we can group in the testng.xml file are as follows.

  1. Can configure test suite comprising of multiple test cases to run from a single place.
  2. Can include or exclude test methods test execution.
  3. Can mark a group to include or exclude.
  4. Can pass parameters in test cases.
  5. Can add group dependencies.
  6. Can configure parallel test execution.
  7. Can add listeners.

Question #2) How to pass parameter through testng.xml file to a test case?

Answer: You can set the parameter using the below syntax in the testng.xml file.

<parameter name="browser" value="FFX" />

Here, name attribute represents the parameter name and value signifies the value of that parameter. Then we can use that parameter in the selenium WebDriver software automation test case using the bellow syntax.

@Parameters ({"browser"})

Question #3) How to exclude a @Test method from a test case with two @Test methods? Is it possible?

Answer: Yes, you need to add @Test method in the exclude tag of testng.xml file as mentioned below.

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Test Exclusion Suite">
  <test name="Exclusion Test" >
    <classes>
      <class name="Your Test Class Name">
       <methods>
       <exclude name="Your Test Method Name To Exclude"/>
      </methods>
      </class>      
    </classes>
  </test>
</suite>

Question #4) How to skip a @Test method from execution?

Answer: You can use the below syntax inside @Test method to skip a test case from test execution.

throw new SkipException("Test Check_Checkbox Is Skipped");

read more