CIS 103 Programming Fundamentals I - Mathematical Functions, Characters, and Strings

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/16

flashcard set

Earn XP

Description and Tags

These flashcards cover key concepts related to mathematical functions, characters, and strings in Java, as taught in CIS 103 Programming Fundamentals I.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

17 Terms

1
New cards

What is the purpose of the Math class in Java?

To provide useful methods for performing common mathematical functions.

2
New cards

What method returns the square root of a number in Java?

Math.sqrt(double a)

3
New cards

What does the method Math.pow(a, b) return?

Returns a raised to the power of b.

4
New cards

What is the value returned by Math.ceil(2.1)?

3.0

5
New cards

What character data type represents a single character in Java?

char

6
New cards

How do you denote a character literal in Java?

A character literal is enclosed in single quotation marks, e.g., 'A'.

7
New cards

What does the escape sequence '\n' represent?

Linefeed (new line).

8
New cards

What is the purpose of the equals() method for strings in Java?

To compare if two strings are equal.

9
New cards

What Java class allows you to manipulate strings?

String class.

10
New cards

What is the returned value of message.length() for String message = "Hello"?

5

11
New cards

What method is used to concatenate two strings in Java?

concat(s1) or the + operator.

12
New cards

What does the method charAt(index) do?

Returns the character at the specified index from this string.

13
New cards

What does the method indexOf(ch) return?

Returns the index of the first occurrence of ch in the string.

14
New cards

What does the method Math.random() return?

A random double value in the range [0.0, 1.0[.

15
New cards

What does the sprintf method do in Java?

Formats output based on format specifiers.

16
New cards

How do you declare a string in Java?

Using the String data type, e.g., String message = "Welcome".

17
New cards

How is Unicode represented in Java?

Using a 16-bit encoding scheme preceded by \u, expressed in four hexadecimal digits.