All Topics
Topic37 questions
4. Arrays And StringsQuestions & Answers
Practice 37 4. Arrays And Strings questions with detailed answers and explanations. Tap any question below to study the full solution.
4. Arrays And Strings question list
List the correct ways of declaring an Array.What is the output of this program? class Output { public static void main(String args[]) { int a1[] = new int[10]; int a2[] = {1,…StringBuffer is used to create ______________.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[…State True or False. Advanced for loop is better as it is less error prone as we don't need to deal with index.String name="teknoturf"; String cname="teknoturf"; String compname=new String("teknoturf"); 1.if(name==cname) 2.if(name.equals(cna…String Objects are mutable. State true or false.class TestArray { public static void main(String args[]) { int arr_sample[] = new int[2]; System.out.println(arr_sample[0]); } } W…which of the following packages can you find String class?StringBuilder is less efficient and slower than StringBuffer. State true or false.Given: public class ItemTest { private final int id; public ItemTest(int id) { this.id = id; } public void updateId(int newId) { i…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…A JavaBeans component has the following field: private boolean enabled; Which two pairs of method declarations follow the JavaBean…package edu.ABC.model; public class Account { public static final float INTERTEST_RATE = 7.5; } Identify the correct options from …Which members of a class can be accessed by other classes is determined by the ________________Identify which statement is true about construtors.What does this() mean in constructor chaining concept?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…Practice more topics
PrimerPrep has independently reviewed practice questions and coding exercises — all free.