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
Arrays have ___ and ___ functions that turn into [] by operator overloading.
get; set
26
What are the 3 ways to create an Array?
arrayOf(); arrayOfNulls(); Array constructor
27
Arrays are \_\_\_.
invariant
28
Primitive type arrays provide arrays of primitive types without ___ \_\_\_.
boxing overhead
29
Primitive type arrays have no ___ relationship to Array class.
inheritance
30
Primitive type arrays have the same set of ___ and ___ as the Array class.
methods; properties
31
Each primitive type array has it's own corresponding ___ \_\_\_.
factory function
32
What are the 4 types of unsigned integers?
UByte; UShort; UInt; ULong
33
Unsigned integers support most ___ of signed integers.
operations
34
Unsigned integers are implemented using ___ \_\_\_.
inline classes
35
Unsigned integers have their own corresponding ___ types.
Array
36
Unsigned integers have ___ and ___ suffixes.
u; U
37
Unsigned long has ___ and ___ suffixes.
uL; UL
38
\_\_\_ or ___ is chosen based on the size of unsigned literal.
UInt; ULong
39
Strings are \_\_\_.
immutable
40
You can concatenate strings using the ___ operator.
plus (+)
41
String ___ are preferable over concatenation.
templates
42
You can access characters of a String by using ___ operations.
indexing
43
String can be iterated over with a \_\_\_-\_\_\_.
for-loop
44
What are the 2 types of Strings?
escaped; raw
45
Template expressions start with a \_\_\_.
dollar sign ($)
46
Templates can contain a ___ \_\_\_ or \_\_\_.
simple name; expression
47
Templates are supported in both types of \_\_\_.
strings
48
'if' can be used as an \_\_\_, i.e. it returns a value.
expression
49
'if' expressions are required to have an ___ branch.
else
50
The last expression of an 'if' block is the ___ of the block.
value
51
'when' is analogous to the ___ statement in C-like languages.
switch
52
Each 'when' branch can be a \_\_\_.
block
53
'when', like 'if' can be used as a \_\_\_, or \_\_\_.
expression; statement
54
Like 'if', if 'when' is used as an expression an ___ branch is required.
else
55
'when' branch conditions may be combined with a \_\_\_.
comma (,)
56
'when' branches may have ___ \_\_\_ as conditions.
arbitrary expressions
57
'when' branches may check a value for being ___ or ___ a ___ or \_\_\_.
in; !in; range; collection
58
'when' branches can check that a value ___ or ___ of a type.
is; !is
59
If no argument is given to 'when' then branch conditions are ___ expressions.
boolean
60
It is possible to ___ a 'when' ___ in a variable.
capture; subject
61
for-loops iterate through anything providing an \_\_\_.
iterator
62
You can iterate over a range of numbers using the ___ \_\_\_.
range expression
63
A for-loop over a range or array is compiled to an \_\_\_-\_\_\_ loop.
index-based
64
You can iterate with an index using the ___ property or ___ function.
indices; withIndex()
65
A number of packages are imported by ___ in ___ kotlin file.
default; every
66
Additional packages are imported depending on \_\_\_.
platform
67
When importing you can disambiguate name clashes by using the ___ keyword.
as
68
What other declarations can you use 'import' on?
top-level functions and properties; functions and properties in object declarations; enum constants
69
Top-level declarations marked ___ are private to the ___ it's declared in.
private; file
70
What are the 3 jump expressions? What is their type?
return; break; continue; Nothing
71
Any ___ can be marked with a label.
expression
72
What are the 2 types of 'return' labels?
qualified; implicit
73
Qualified 'return' allows returning from ___ \_\_\_.
outer function
74
\_\_\_ labels have same name as function to which lambda is passed.
implicit
75
A ___ statement from an ___ function returns from the anonymous function.
return; anonymous