All Topics
Topic125 questions

Accenture Java ProgrammingQuestions & Answers

Practice 125 verified Accenture Java Programming questions with detailed answers and explanations. Tap any question below to study the full solution — perfect for last-minute Accenture primer and dumps prep.

Java Programming question list

Using Java we can develop ___________________.The main method in java should ___________.The break statement cannot be present for _____________ construct.A continue statement makes the execution jump to ______________.Identify the features of java.a for loop, if the number of statements are greater than one, which of the following needs to be inserted at the beginning and the…JRE comprises of ___________ and ___________.What will be the output of the program? public class Sample { final static short a = 2; public static int b = 0; public static voi…The ________________ statement causes the program execution to stop and JVM to shut down.JVM is independent of OSTo compile, debug and execute a program written in java, _______________ is required.State true or false. Java is a structured programming language.Who is the father of Java?What is Polymorphism?How was Java initially named?Java is _____________________________.What is the output of this program? 1. class Crivitch { 2. public static void main(String [] args) { 3. int x = 10; 4. 5. do { } w…What will be the output of the program? Given: 10. int x = 0; 11. int y = 10; 12. do { 13. y--; 14. ++x; 15. } while (x < 5); 16. …What is the output of this program? class selection_statements { public static void main(String args[]) { int var1 = 5; int var2 =…Fill in the appropriate data type for the Java switch statement: switch (____) { case value1: ... case value2: ... default: System…What value is stored in i at the end of this loop? for(int i =1;i<=10;i++)The break statement causes an exit ___________Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?French curly braces { } is a must if the for loop executes more than one statement. State true or false.What will be the output of the program? for(int i = 0; i < 3; i++) { switch(i) { case 0: break; case 1: System.out.print("one "); …What will be the output of the program? int i = 1, j = -1; switch (i) { case 0, 1: j = 1; /* Line 4 */ case 2: j = 2; default: j =…A project developed on one machine can be included in the current workspace by ___________ that project.State True or False. When typing the code in code editor, it fixes the compilation error. It also assists in how to fix that error…We can move an already existing project in eclipse to another location by compressing it. This we call as ________ the project.Eclipse, the plugin that is needed for Java Development is ______________.Predict the output int a=0; if(a) System.out.println( "Hello"); else System.out.println( "Hai");What will be the output of the program? public class Sample { public static void main(String [] args) { int i = 10; do while ( i <…__________ generates the byte code for a given file with .java extension.Which edition of java is used for developing web application?State True or False For compiling a java code we have separate compilers for different OS.Which of the following options remain true for case constants in a switch construct?Who executes the byte code in java?The methods of a class with the ____________ access specifier cannot be accessed in its subclass class of different package.Predict the output. class X { void display(int a) { System.out.println("INT"); } void display(double d) { System.out.println("DOUB…Observe the code public class Sample { public static void main(String [] args) { int x = 6; Sample p = new Sample(); p.display(x);…Integer x1 = new Integer(120); int x2 = 120; System.out.println( x1 == x2 ); What will be the output of the above code fragment?Given: public class Message { String msg; int noOfWords; public Message() { msg += " Thank you"; } public Message(int noOfWords) {…Given classes defined in two different files: 1. package p1; 2. public class Test { 3. public static void display(String [] a) { /…What is the outcome of the code? public class Item { private String description; public String getDescription() { return descripti…Which of the following is not a Java modifier?switch(a) { default: System.out.println("Welcome"); } Of which data types can the variable a be? 1. long 2. byte 3. int 4. char 5.…Predict the output. public class Test { public static void main(String args[]) { int a = 2, b = 0; for ( ; b < 20; ++b) { if (b % …What will be the output of the following code? int i=20; if(i>10) { System.out.println( "The value of i is "+i); i++; if(i%2!=0) b…State True or False When using eclipse whichever classes are needed for the present class can be imported automatically.Eclipse IDE, if we provide a workspace, it should already exist. If not, it will not open.___ and _____ are the access specifiers that can be applied to top level Class.class Sample{ private double num = 100; private int square(int a){ return a*a; } } public class Test{ public static void main(Stri…Choose the appropriate access specifier for the attribute value so that it can be accessed from anywhere. class Test { public int …Consider the below code snippet and determine the output. class Student { private int studentId; private float average; } class Te…The below code snippet shows an error cannot find symbol: System.out.println("BookId:"+bobj.getId()); public class Book { private …Observe the below code. public class Student { private int id; private String name; private char grade; //Constructor 1 public Stu…Observe the code below. public class Student { int studentId; String name; char grade; public Student(int studentId, String name, …Observe the below class. class Product{ int productId; String productName; Product { productId=0; productName= ; } Product(int id,…Given the class Book and Library in two different packages : 1. package model; 2. public class Book { 3. private static void count…Given the class Book in packages p1 and class Main in package p2. In main to create an object of Book, which of the following are …Assume class Calculator in package p1 and CalculatorService class in package p2 as shown below. package p1; public class Calculato…Choose the correct order of the Java code fragments: 1) public class Main, 2) import java.util.Scanner;, 3) {, 4) // Some code her…For the below code, what are the valid ways to invoke display method in the main method. public class Test { public static void di…Given a one-dimensional array arr, what is the correct way of getting the number of elements in arr?class ArrayTest { public static void main(String args[]) { int[] primes = new int[10]; primes[0] = "a"; System.out.println(primes[…Partially List the correct ways of declaring an Array.class TestArray { public static void main(String args[]) { int arr_sample[] = new int[2]; System.out.println(arr_sample[0]); } } W…String name="teknoturf"; String cname="teknoturf"; String compname=new String("teknoturf"); 1.if(name==cname) 2.if(name.equals(cna…What is the output of this program? class Output { public static void main(String args[]) { int a1[] = new int[10]; int a2[] = {1,…StringBuilder is less eficient and slower than StringBuffer. State true or false.State True or False. Advanced for loop is better as it is less error prone as we don't need to deal with index.which of the following packages can you find String class?StringBuffer is used to create ______________.String Objects are mutable. State true or false.What does this() mean in constructor chaining concept?package edu.ABC.model; public class Account { public static final float INTERTEST_RATE = 7.5; } Identify the correct options from …Identify which statement is true about construtors.Which members of a class can be accessed by other classes is determined by the ________________Predict the Output of following Java Program. class Test { int x = 10; public static void main(String[] args) { System.out.println…Identify the true statement(s). Statement 1 : When no constructor is written in a class, the compiler creates a default constructo…Given: public class ItemTest { private final int id; public ItemTest(int id) { this.id = id; } public void updateId(int newId) { i…A JavaBeans component has the following field: private boolean enabled; Which two pairs of method declarations follow the JavaBean…The first name of a person should contain only alphabets and space. Which of the following regular expression will match the requi…Which of the following text when matched with the regular expression [a-zA-Z&&[^aeiou]]+ will return true?What is the regular expression to match a whitespace character in a string?What is the regular expression to match a digit (0-9) in a string?00means X occurs zero or more timesWhat is the regular expression to match any email address in a string?Consider the below statements. Statement 1 : Matcher class interprets the pattern in a String Statement 2 : Matcher class matches …\B means A word boundaryPredict the output of the below code : import java.util.regex.*; public class TestRegEx{ public static void main(String args[]) { …What is the regular expression to match any date in the format "yyyy-mm-dd" in a string?Observe the below code snippet String name="Sudha learns Oracle"; System.out.println(name.substring(7,12)); What is the output of …Predict the output of the below code : String emailId="john#global.com"; System.out.println(emailId.indexOf('@'));What can be the parameters for the indexOf method in String class?Observe the below code : String course="Java Programming"; char c=course.charAt(16); System.out.println(c); What will be the outpu…Assume that the ID of an employee should start with "CBE" or "BLR" or "HYD" followed by hyphen (-) followed by 4 digits. Choose th…Which of the following matches X occurs n or more times?Java is _____________________________.What will happen when the following code is compiled and run in Java 1.8? int i = 1, j = -1; switch(i) switch (i) { case 0, 1: j =…State True or False. When typing the code in code editor, it shows the compilation error. It also assists in how to fix that error…What will be the output of the program? public class Sample { public static void main(String[] args) { int i = 10; do while (i < 1…Observe the code public class Sample { public static void main(String [] args) { int x = 6; Sample p = new Sample(); p.display(x);…List the correct ways of declaring an Array.StringBuilder is less efficient and slower than StringBuffer. State true or false.class Output { public static void main(String args[]) { int a1[] = new int[10]; int a2[] = {1, 2, 3, 4, 5}; System.out.println(a1.…_______________ is used to allocate memory to array variable in JavaPredict the output p class String_demo { public static void main(String args[]) { int ascii[] = { 65, 66, 67, 68}; String s = new …Determine the output: class Evaluate { public static void main(String args[]) { int arr[] = new int[] {0 , 1, 2, 3, 4, 5, 6, 7, 8,…Predict the output class String_demo { public static void main(String args[]) { char chars[] = {'a', 'b', 'c'}; String s = new Str…Determine the output: (MCQ) public class Test { public static void main(String[] args) { int[] x = new int[3]; System.out.println(…Given: 1. public class MyLogger { 2. private StringBuilder logger = new StringBuuilder(); 3. public void log(String message, Strin…________________ is used to find string length.Determine the output: public class Test { public static void main(String[] args) { int[] x = {1, 2, 3, 4}; int[] y = x; x = new in…What is special about string objects as compared to objects of other derived types?__________________ is the string contained in s after following lines of code? StringBuffer s = new StringBuffer(Hello); s.deleteC…What will be the content of array variable table after executing the following code? public class Trial { public static void main(…What will s2 contain after following lines of code? String s1 = one; String s2 = s1.concat(two);Determine the output class array_output { public static void main(String args[]) { char array_variable [] = new char[10]; for (int…+ operator can be used to concatenate two or more String objects in java. State true or false.Column size is mandatory to create an array in java. State true or falseDetermine the output public class Trial { public static void main(String[] args) { int arr[4]={}; System.out.print(arr[0]); } }Determine the output: public class A { public static void main(String argv[]) { int ary[]=new int[]{1,2,3}; System.out.println(ary…a regular expression, the pattern 00 means, 0 occurs exactly two times.Consider the below statements. Statement 1 : Matcher class interprets the pattern in a String Statement2:Matcherclassmatchesthereg…

Practice more Accenture topics

PrimerDumps has 1400+ primer questions, 2026 mocks and coding hands-on — all free.