Java String Basic Board Questions


  1. The output of the statement "CONCENTRATION".indexOf('T') is: [ 1 MARK - 2024 ]

    (a) 9			
    (b) 7			
    (c) 6		
    (d) -1
    
  2. (c) 6

  3. The output of the function "COMPOSITION".substring(3,6) : [ 1 MARK - 2023 ]

    (a) POSI		
    (b) POS		
    (c) MPO	
    (d) MPOS
    
  4. (b) POS

  5. What will be the output of the following code ? [ 1 MARK - 2022 ]
    System.out.println(“Lucknow”.substring(0,4));

    (a) Lucknow	
    (b) Luckn		
    (c) Luck	
    (d) luck
    
  6. (c) Luck

  7. Write the output for the following : [ 2 MARKS - 2020 ]

    System.out.println("A picture is worth \t \" A thousand words. \"");
    
  8. A picture is worth 	 " A thousand words. "
    

  9. Write the output for the following : [ 2 MARKS - 2020 ]

    String s1 = "Life is Beautiful";
    System.out.println("Earth" + s1.substring(4));
    System.out.println(s1.endsWith("L"));
    
  10. Earth is Beautiful
    false