Search Header Logo

Quiz sobre Comandos do Spark

Authored by Marco Rezende

Education

University

Used 2+ times

Quiz sobre Comandos do Spark
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

Selecione o comando que projeta/seleciona apenas as colunas ‘home_team’ e ‘home_goal’ do DataFrame.

df.withColumn(‘home_team’, ‘home_goal’)

df.filter(‘home_team’, ‘home_goal’)

df.select(‘home_team’, ‘home_goal’)

df.join(‘home_team’, ‘home_goal’)

df.project(‘home_team’, ‘home_goal’)

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Selecione o comando que filtra apenas as partidas do palmeiras como visitante.

df.filter(df.away_team, ‘Palmeiras-SP’)

df.filter(df.away_team == ‘Palmeiras-SP’)

df.select(‘Palmeiras-SP’)

df.join(away_team, ‘Palmeiras-SP’)

df.filter(df.away_team = ‘Palmeiras-SP’)

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Selecione o comando que filtra apenas as partidas do flamengo como mandante no ano de 2015.

df.filter(df.home_team == ‘Flamengo-RJ’ and df.season == 2015)

df.filter(df.home_team == ‘Flamengo-RJ’)

df.filter(‘Flamengo-RJ’, 2015)

df.join(home_team, ‘Flamengo-RJ’)

df.filter((df.home_team == ‘Flamengo-RJ’) & (df.season == 2015))

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Selecione o comando que renomeia a coluna “home_team” para “mandante” no DataFrame.

df.withRename(‘home_team’, ‘mandante’)

df.rename(‘home_team’, “mandante”)

df.withColumnRenamed(‘home_team’, ‘mandante’)

df.withColumnRename(‘home_team’, ‘mandante’)

df.rename(‘home_team’, col(‘mandante’))

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Selecione o comando que remove coluna “round” do DataFrame.

df.withDrop(‘round’)

df.drop(‘round’)

df.withColumn(‘round’)

df.withColumnRename(‘round’)

df.drop(‘home_team’)

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Selecione o comando que informa a quantidade de linhas do DataFrame.

df.show()

df.collect()

df.rows()

df.shape()

df.count()

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Qual comando cria uma nova coluna chamada “vencedor” com valor dela sendo o nome do time que ganhou a partida, caso haja empate dê o valor “Empate”?

df.withColumn(‘vencedor’, when(df.home_goals > df.away_goals, df.home_team).when(df.home_goals < df.away_goals, df.away_team).otherwise(‘Empate’))

df.withColumn(‘vencedor’, when(df.home_goals == df.away_goals, ‘Empate’).otherwise(df.home_team))

df.withColumn(‘vencedor’, when(df.home_goals > df.away_goals, df.home_team).otherwise(‘Empate’))

df.withColumn(‘vencedor’, when(df.home_goals < df.away_goals, df.away_team).otherwise(‘Empate’))

df.withColumn(‘vencedor’, when(df.home_goals == df.away_goals, ‘Empate’).when(df.home_goals > df.away_goals, df.home_team).otherwise(df.away_team))

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?