Strings

Strings

University

12 Qs

quiz-placeholder

Similar activities

CSC1243 - Introduction to Computer Programs (Programming Langua)

CSC1243 - Introduction to Computer Programs (Programming Langua)

University

10 Qs

Microprocessor - Intel 8088 - Part 1

Microprocessor - Intel 8088 - Part 1

University

17 Qs

MULTIMEDIA STORYBOARD

MULTIMEDIA STORYBOARD

University

10 Qs

UNIT-1 PYTHON BASICS

UNIT-1 PYTHON BASICS

University

10 Qs

Herencia y Paquetes

Herencia y Paquetes

University

10 Qs

JTable en Java

JTable en Java

University

10 Qs

Unit6-Revision3-W3C & WAI

Unit6-Revision3-W3C & WAI

University

12 Qs

C++ 1st ONLINE QUIZ

C++ 1st ONLINE QUIZ

University

13 Qs

Strings

Strings

Assessment

Quiz

Computers

University

Practice Problem

Hard

Created by

sudha reddy

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Java code?

    class output

    {

        public static void main(String args[])

        {

            char ch;

            ch = "hello".charAt(1);

            System.out.println(ch);

        }

   }

h

e

l

o

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Java code? 

    class output

    {

        public static void main(String args[])

        {

            char c[]={'a', '1', 'b' ,' ' ,'A' , '0'};

            for (int i = 0; i < 5; ++i)

            {

                   if(Character.isDigit(c[i]))

                       System.out.println(c[i]+" is a digit");

                   if(Character.isWhitespace(c[i]))

                       System.out.println(c[i]+" is a Whitespace character");

                   if(Character.isUpperCase(c[i]))

                       System.out.println(c[i]+" is an Upper case Letter");

                   if(Character.isLowerCase(c[i]))

                       System.out.println(c[i]+" is a lower case Letter");

               i=i+3;

            }

        }

    }

    1.a is a lower case Letter

   2.   is White space character

   1.b is a lower case Letter

    2.  is White space character

1.a is a lower case Letter

    2.A is an upper case Letter

1.a is a lower case Letter

    2.b is a lower case Letter

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Java code?

class output

    {

        public static void main(String args[])

        {

            String a = "hello i love java";

            System.out.println(a.indexOf('i')+" "+a.indexOf('o') +" "+a.lastIndexOf('i')+" "+a.lastIndexOf('o'));

        }

    }

6 4 6 9

5 4 5 9

7 8 8 9

4 3 6 9

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Java code?

    class output

   {

   public static void main(String args[])

        {

           String c = "Hello i love java";

         int start = 2;

          int end = 9;

           char s[]=new char[end-start];

           c.getChars(start,end,s,0);

           System.out.println(s);

     }

    }

Hello, i love java

i love ja

lo i lo

llo i l

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these methods can be used to convert all characters in a String into a character array?

charAt()

both getChars() & charAt()

both toCharArray() & getChars()

all of the mentioned

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Java program? 

    class string_class

    {

        public static void main(String args[])

        {

            String obj = "I LIKE JAVA";  

            System.out.println(obj.length);

        }

  

11

9

12

Error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

 Which of the following statements are incorrect?

String is a class

Strings in java are mutable

Every string is an object of class String

Java defines a peer class of String, called StringBuffer, which allows string to be altered

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers