Search Header Logo

OO e Kotlin

Authored by Robison Brito

Computers

University

Used 4+ times

OO e Kotlin
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword do you use to define a function in Kotlin?

fun

func

function

main

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following do you need to create a Kotlin program that prints a line of text?

comment describing what your program does

a main() function

curly braces {} around the instructions to the system


a call to print() or println()

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What do you expect this Kotlin code to do?

Print one line of text

Print two lines of text

Print three lines of text

Print two lines of text separated by a blank line

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

How would you modify this main() function so that it prints a 6-layer cake for someone's 4th birthday?


Set val age to 6, set val layers to 4

Set val age to "4", set val layers to "6"

Set val age to 4, set val layers to 6


Leave the code as-is

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Which of these options correctly calls the function, below, and passes it valid input arguments?

createMessage("Amy", "Australia", 20)

createMessage("Evan", England, 9)


createmessage("Tom", "Thailand", “40”)

createMessage(Heather, “Haiti”, 7)

6.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Which of the following is a difference between a class and an instance?

You can think of a class as a blueprint and an instance as the actual “thing".

A class is like architectural plans for a bridge, and the Golden Gate bridge an instance of those plans.


A class is for defining categories of "things", while instances are for defining their properties.


You can create multiple instances from a class, but you can't create classes from instances.

7.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Which of the following is NOT a way for creating a comment in Kotlin?

Add // at the beginning of or inside a line and anything after that // is considered a comment.

Put /* or /** to start a block comment, and end it with */.


Use // to turn the rest of a function into a comment.


Use /* to start a comment that is one line long.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?