Language Flashcards

1
Q

Everything is an ___ (can call member functions and properties on any variable)

A

object

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

___, ___, and ___ are represented as primitives at runtime

A

numbers; characters; booleans

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

What are the 4 types of integers

A

Byte, Short, Int, Long

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

___ or ___ is chosen based on the initial value given to an integer literal

A

Int, Long

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

You can specify Long by adding the ___ suffix

A

L

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

How do floating-point types differ from one another?

A

By how many decimals they can store

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

Variables initialized with fractional numbers are inferred to be of type ___

A

Double

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

You can specify Float with the ___ suffix

A

F or f

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

What happens if the initial value of a Float contains more than 6-7 decimal digits?

A

It will be rounded

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

Does Kotlin support implicit widening conversions for numbers?

A

No

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

How do you convert numeric values to different types?

A

By using Explicit Conversion functions

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

What are the 4 types of literal constants?

A

Decimals, Longs, Hexadecimals, and Binaries

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

You can use ___ in numeric literals.

A

Underscores

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

Numbers are stored as ___ unless ___ or ___ are involved.

A

JVM primitives; nullable; generics

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

Boxing of numbers doesn’t always preserve ___.

A

identity

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

Smaller numeric types are not ___ of bigger types, and therefore aren’t ___ ___ to bigger types.

A

sub-types; implicitly; converted

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

What are the 7 explicit conversion functions?

A

toByte(); toShort(); toInt(); toLong(); toFloat(); toDouble(); toChar()

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

Bitwise functions are ___ functions that can be called in ___ form.

A

named; infix

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

What are the 7 infix bitwise functions?

A

signed shift left (shl); signed shift right (shr); unsigned shift right (ushr); bitwise and (and); bitwise or (or); bitwise xor (xor); bitwise inversion (inv)

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

When operands are ___ ___ as floating-point numbers they follow the ___ for ___-___ arithmetic.

A

statically typed; standard; floating-point

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

When operands aren’t statically typed as floating-point numbers, operations use ___ and ___.

A

equals(); compareTo()

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

Characters can’t be directly treated as ___.

A

numbers

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

Characters have 10 types of ___ ___.

A

escape sequences

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

Booleans and Characters are ___ if a nullable reference is needed.

A

boxed

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

Arrays have ___ and ___ functions that turn into [] by operator overloading.

A

get; set

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

What are the 3 ways to create an Array?

A

arrayOf(); arrayOfNulls(); Array constructor

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

Arrays are ___.

A

invariant

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

Primitive type arrays provide arrays of primitive types without ___ ___.

A

boxing overhead

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

Primitive type arrays have no ___ relationship to Array class.

A

inheritance

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

Primitive type arrays have the same set of ___ and ___ as the Array class.

A

methods; properties

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

Each primitive type array has it’s own corresponding ___ ___.

A

factory function

32
Q

What are the 4 types of unsigned integers?

A

UByte; UShort; UInt; ULong

33
Q

Unsigned integers support most ___ of signed integers.

A

operations

34
Q

Unsigned integers are implemented using ___ ___.

A

inline classes

35
Q

Unsigned integers have their own corresponding ___ types.

A

Array

36
Q

Unsigned integers have ___ and ___ suffixes.

A

u; U

37
Q

Unsigned long has ___ and ___ suffixes.

A

uL; UL

38
Q

___ or ___ is chosen based on the size of unsigned literal.

A

UInt; ULong

39
Q

Strings are ___.

A

immutable

40
Q

You can concatenate strings using the ___ operator.

A

plus (+)

41
Q

String ___ are preferable over concatenation.

A

templates

42
Q

You can access characters of a String by using ___ operations.

A

indexing

43
Q

String can be iterated over with a ___-___.

A

for-loop

44
Q

What are the 2 types of Strings?

A

escaped; raw

45
Q

Template expressions start with a ___.

A

dollar sign ($)

46
Q

Templates can contain a ___ ___ or ___.

A

simple name; expression

47
Q

Templates are supported in both types of ___.

A

strings

48
Q

‘if’ can be used as an ___, i.e. it returns a value.

A

expression

49
Q

‘if’ expressions are required to have an ___ branch.

A

else

50
Q

The last expression of an ‘if’ block is the ___ of the block.

A

value

51
Q

‘when’ is analogous to the ___ statement in C-like languages.

A

switch

52
Q

Each ‘when’ branch can be a ___.

A

block

53
Q

‘when’, like ‘if’ can be used as a ___, or ___.

A

expression; statement

54
Q

Like ‘if’, if ‘when’ is used as an expression an ___ branch is required.

A

else

55
Q

‘when’ branch conditions may be combined with a ___.

A

comma (,)

56
Q

‘when’ branches may have ___ ___ as conditions.

A

arbitrary expressions

57
Q

‘when’ branches may check a value for being ___ or ___ a ___ or ___.

A

in; !in; range; collection

58
Q

‘when’ branches can check that a value ___ or ___ of a type.

A

is; !is

59
Q

If no argument is given to ‘when’ then branch conditions are ___ expressions.

A

boolean

60
Q

It is possible to ___ a ‘when’ ___ in a variable.

A

capture; subject

61
Q

for-loops iterate through anything providing an ___.

A

iterator

62
Q

You can iterate over a range of numbers using the ___ ___.

A

range expression

63
Q

A for-loop over a range or array is compiled to an ___-___ loop.

A

index-based

64
Q

You can iterate with an index using the ___ property or ___ function.

A

indices; withIndex()

65
Q

A number of packages are imported by ___ in ___ kotlin file.

A

default; every

66
Q

Additional packages are imported depending on ___.

A

platform

67
Q

When importing you can disambiguate name clashes by using the ___ keyword.

A

as

68
Q

What other declarations can you use ‘import’ on?

A

top-level functions and properties; functions and properties in object declarations; enum constants

69
Q

Top-level declarations marked ___ are private to the ___ it’s declared in.

A

private; file

70
Q

What are the 3 jump expressions? What is their type?

A

return; break; continue; Nothing

71
Q

Any ___ can be marked with a label.

A

expression

72
Q

What are the 2 types of ‘return’ labels?

A

qualified; implicit

73
Q

Qualified ‘return’ allows returning from ___ ___.

A

outer function

74
Q

___ labels have same name as function to which lambda is passed.

A

implicit

75
Q

A ___ statement from an ___ function returns from the anonymous function.

A

return; anonymous