BADM /
211
/ /
Exam
/ //
1 Review Questions With Correct Answers
// // // // //
What /
/if /
/you /
/multiple /
/an /
/integer //with //a //string? //please //choose //the //outcome //for //Name2 //of //the //following //example
:Name //= //"Zilong"
Name2 //= //3 //*Name //- //CORRECT //ANSWERS(S)✔✔ZilongZilongZilong
What //is //the //object/variable //type //of //the //following //variable //X?
X //= //"1.0" //- //CORRECT //ANSWERS(S)✔✔Float
In //python //list //indices //start //with //number //- //CORRECT //ANSWERS(S)✔✔0
Consider //the //following //function:
def //sum_function(x=1, //y=2): //
sum=x+y
return(sum)
What //is //a //proper //way //to //call //this //function? //- //CORRECT //ANSWERS(S)✔✔sum_function()
,What /
/is //an //argument //in //function? //Is //it //mandatory? //- //CORRECT //ANSWERS(S)✔✔Input, //optional
How /
/to /
/check /
/the /
/first /
/10 //rows //for //a //data //set //called //"df" //in //Pandas. //- //CORRECT //ANSWERS(S)✔✔df.head(10)
How /
/to /
/quickly /
/check /
/the /
/number /
/of /
/column /
/and //rows //for //a //data //set //called //"df" //in //Pandas. //- //CORRECT //ANSWERS(S)✔✔df.shape
How /
/to /
/obtain /
/the /
/summary /
/statistic //of //all //variable //in //dataset //"df". //- //CORRECT //ANSWERS(S)✔✔df.describe()
How /
/do /
/you /
/load //
a/
/csv /
/into //
, a/
/DataFrame /
/in //pandas? //(import //pandas //as //pd) //- //CORRECT //ANSWERS(S)✔✔pd.read_csv('my.csv')
How /
/do /
/you /
/output //the //first //5 //rows //of //a //pandas //DataFrame //df? //- //CORRECT //ANSWERS(S)✔✔df.print()
How /
/to /
/select //"CustomerType" /
/column //from //hotel_df //DataFrame? //- //CORRECT //ANSWERS(S)✔✔hotel_df["CustomerType"]
How /
/to /
/select /
/booking /
/orders /
/with /
/ADR /
/(average /
/daily /
/price) /
/greater /
/than /
/100 //for //hotel_df //DataFrame? //- //CORRECT //ANSWERS(S)✔✔hotel_df[hotel_df["ADR"]>100]
How /
/to /
/select //"Adults" /
/and //"Children" /
/columns //from //hotel_df //set? //- //CORRECT //ANSWERS(S)✔✔hotel_df[["Adults", //"Children"]]
211
/ /
Exam
/ //
1 Review Questions With Correct Answers
// // // // //
What /
/if /
/you /
/multiple /
/an /
/integer //with //a //string? //please //choose //the //outcome //for //Name2 //of //the //following //example
:Name //= //"Zilong"
Name2 //= //3 //*Name //- //CORRECT //ANSWERS(S)✔✔ZilongZilongZilong
What //is //the //object/variable //type //of //the //following //variable //X?
X //= //"1.0" //- //CORRECT //ANSWERS(S)✔✔Float
In //python //list //indices //start //with //number //- //CORRECT //ANSWERS(S)✔✔0
Consider //the //following //function:
def //sum_function(x=1, //y=2): //
sum=x+y
return(sum)
What //is //a //proper //way //to //call //this //function? //- //CORRECT //ANSWERS(S)✔✔sum_function()
,What /
/is //an //argument //in //function? //Is //it //mandatory? //- //CORRECT //ANSWERS(S)✔✔Input, //optional
How /
/to /
/check /
/the /
/first /
/10 //rows //for //a //data //set //called //"df" //in //Pandas. //- //CORRECT //ANSWERS(S)✔✔df.head(10)
How /
/to /
/quickly /
/check /
/the /
/number /
/of /
/column /
/and //rows //for //a //data //set //called //"df" //in //Pandas. //- //CORRECT //ANSWERS(S)✔✔df.shape
How /
/to /
/obtain /
/the /
/summary /
/statistic //of //all //variable //in //dataset //"df". //- //CORRECT //ANSWERS(S)✔✔df.describe()
How /
/do /
/you /
/load //
a/
/csv /
/into //
, a/
/DataFrame /
/in //pandas? //(import //pandas //as //pd) //- //CORRECT //ANSWERS(S)✔✔pd.read_csv('my.csv')
How /
/do /
/you /
/output //the //first //5 //rows //of //a //pandas //DataFrame //df? //- //CORRECT //ANSWERS(S)✔✔df.print()
How /
/to /
/select //"CustomerType" /
/column //from //hotel_df //DataFrame? //- //CORRECT //ANSWERS(S)✔✔hotel_df["CustomerType"]
How /
/to /
/select /
/booking /
/orders /
/with /
/ADR /
/(average /
/daily /
/price) /
/greater /
/than /
/100 //for //hotel_df //DataFrame? //- //CORRECT //ANSWERS(S)✔✔hotel_df[hotel_df["ADR"]>100]
How /
/to /
/select //"Adults" /
/and //"Children" /
/columns //from //hotel_df //set? //- //CORRECT //ANSWERS(S)✔✔hotel_df[["Adults", //"Children"]]