Day 17 - HITech

Day 17 - HITech

Professional Development

22 Qs

quiz-placeholder

Similar activities

java revews

java revews

Professional Development

20 Qs

Assessment 1

Assessment 1

Professional Development

20 Qs

OCP 1Z0-819 - Chapter3

OCP 1Z0-819 - Chapter3

Professional Development

20 Qs

Advanced JavaScript

Advanced JavaScript

Professional Development

20 Qs

VAC

VAC

Professional Development

20 Qs

Core Java Assessment

Core Java Assessment

Professional Development

25 Qs

Java Basics

Java Basics

Professional Development

27 Qs

PAI

PAI

Professional Development

20 Qs

Day 17 - HITech

Day 17 - HITech

Assessment

Quiz

Computers

Professional Development

Easy

Created by

Venkatesh iGen

Used 4+ times

FREE Resource

22 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

public class Main {

    public static void main(String[] args) {

        String s = "abc";

        int sum = 0;

        for (char c : s.toCharArray()) {

            sum += c;

        }

        System.out.println(sum);

    }

}

294

297

300

303

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

public class Main {

    public static void main(String[] args) {

        String s = "a1b2c3";

        int sum = 0;

        for (int i = 1; i < s.length(); i += 2) {

            sum += s.charAt(i) - '0';

        }

        System.out.println(sum);

    }

}

6

3

5

4

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

public class Main {

    public static void main(String[] args) {

        int[] arr = {513, 46, 29};

        int max = 0;

        for (int num : arr) {

            while (num > 0) {

                max = Math.max(max, num % 10);

                num /= 10;

            }

        }

        System.out.println(max);

    }

}

6

5

9

3

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

public class Main {

    public static void main(String[] args) {

        String s = "6589";

        char[] arr = s.toCharArray();

        char temp = arr[0];

        arr[0] = arr[arr.length - 1];

        arr[arr.length - 1] = temp;

        System.out.println(new String(arr));

    }

}

6589

9586

9865

9568

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

public class Main {

    public static void main(String[] args) {

        int[] a = {10, 20, 30};

        int sum = 0;

        for (int i = 1; i < a.length; i++) {

            sum += a[i] - a[i - 1];

        }

        System.out.println(sum);

    }

}

20

10

30

40

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

public class Main {

    public static void main(String[] args) {

        String[] s = {"abc", "de", "fghi"};

        int count = 0;

        for (String str : s) {

            count += str.length();

        }

        System.out.println(count);

    }

}

4

8

5

9

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

public class Main {

    public static void main(String[] args) {

        int n = 237541;

        int count = 0;

        while (n > 0) {

            int d = n % 10;

            if (d == 2 || d == 3 || d == 5 || d == 7) count++;

            n /= 10;

        }

        System.out.println(count);

    }

}

6
5
4
3

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?