Characters Flashcards

1
Q

What is a character in Java?
a) A data type designed to hold multiple characters
b) A data type designed to hold a single alphanumeric character
c) A method to store strings in Java
d) A class to handle numeric values

A

b) A data type designed to hold a single alphanumeric character

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How is a character stored internally in Java?
a) As a floating-point value
b) As a string
c) As an integer
d) As an object

A

c) As an integer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the default character encoding set in Java as of Java 18?
a) ASCII
b) ISO-8859-1
c) UTF-16
d) UTF-8

A

d) UTF-8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What happens when you add two character literals in Java using the plus operator?
a) The characters are concatenated
b) The characters are added as numeric values
c) The characters are subtracted
d) An error occurs

A

b) The characters are added as numeric values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is binary numeric promotion in Java?
a) Converting small numeric types into a larger type
b) Converting numeric types into strings
c) Converting numeric types into characters
d) Converting larger numeric types into smaller ones

A

a) Converting small numeric types into a larger type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the ASCII/UTF code for the uppercase letter ‘A’?
a) 130
b) 65
c) 97
d) 255

A

b) 65

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What will the output of System.out.println(upperA + upperA) be?
a) AA
b) 130
c) 65
d) Error

A

b) 130

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How does Java handle the comparison between lowercase and uppercase characters in character range checks?
a) Lowercase characters are considered smaller than uppercase
b) Lowercase characters have a higher UTF index than uppercase
c) Lowercase and uppercase characters are treated the same
d) Java does not differentiate between the two

A

b) Lowercase characters have a higher UTF index than uppercase

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the purpose of the BufferedReader in the CharacterArt class?
a) To read character input from the keyboard
b) To read data from a file
c) To write data to a file
d) To parse JSON data

A

b) To read data from a file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly