As discussed with Nikhil and kashish I am uploading the sample file for exam. The date is 22nd March (Wednesday) and exam starts at 6:20 Aistralian Sydney timing. Its a 2 hr long exam. Please arrange expert for that
Western Sydney University Sample Exam - Autumn Session 2021 Unit Name: Programming for Data Science Unit Number: 301113 Number of �estions: 4 Total Number of Pages: 2 Unit Coordinator: Laurence Park Time Allowed: 1.5 hours (includes reading time) Value of �estions: Exam questions are worth 10 marks, giving a total of 40 marks. Each question shows the breakdown of marks. Answering �estions: Answer all questions in the provided script books. Resources Allowed: This is an open book computer lab exam. This computer test requires the use of Rstudio and vUWS. A computer is to be used to answer questions. No communication software is allowed. No other devices are allowed. This paper must be returned to the person running the test. Before the test is started • Start vUWS and download the exam scripts and data using the links in the vUWS exam page. • Write your name, student number and unit details at the top of your script �le following the example below (make sure to replace Laurence’s details with yours): # Student Surname: Park # Student Firstname: Laurence # Student ID: 99999999 # Unit Name: Programming for Data Science # Unit Number: 301113 All code is R code. Do not start the exam until told to do so. Task 1: Algorithms (2 + 3 + 3 + 2 = 10 marks) 1. Write the code to print “Start exam!” if the variable countdown equals 0. 2. Write a while loop that prints the statement “Time remaining: X” at each iteration, where X is 10 at the �rst iteration, 9 in the second, and counts down to 0. 3. Write a for loop that loops from 0 to 1000, with intervals of size 100 (i.e. 0, 100, 200) and prints “Time elapsed: X” at each iteration, where X is the loop variable. 4. Give an example of an in�nite loop and explain why it is an in�nite loop. Task 2: Functions (2 + 3 + 3 + 2 = 10 marks) 1. Write a function with one argument, a numeric variable x, that returns double that number as output. 2. Write a function with two arguments that returns the product of the two. 3. Write a function with two arguments, that returns the product of the two. But if the second argument is not provided, it uses the default value of 2 for that missing argument. 4. R is a functional language. Explain what it means for a language to be functional. 1 Task 3: Data Structures and Analysis (2 + 3 + 3 + 2 = 10 marks) The CSV �le task3data.csv contains details of the size of a set of electrical components. 1. Write the code to load the �le task3data.csv, then print the number of rows and the column names of the data frame. 2. Write the code to provide the rows where the variable “back” is greater than 100. 3. Write the code to �nd the value(s) of “front” in the rows where the value of “back” is the maximum. 4. A record of who has purchased each component is required, where each component could be purchased any number of times. Brie�y describe a data structure to record the purchase information. Task 4: Visualisation (2 + 3 + 3 + 2 = 10 marks) Run the below code to create the data frame d with columns degree, inCount and outCount, then use the data frame to perform the following tasks. x <- 1:100="" d="">-><- data.frame(degree = x, incount = ceiling(10000*xˆ{-2.2}), outcount = ceiling(10000*xˆ{-2.4})) 1. provide the code to produce a plot of degree and incount (degree is the x axis) with the axis labelled and the plot titled. 2. provide the code to produce a log-log plot (both x and y axis have log scales) of degree and incount (degree is the x axis) with the axis labelled and the plot titled. 3. provide the code to produce a log-log plot (both x and y axis have log scales) of degree and incount (degree is the x axis) with the axis labelled and the plot titled. also include a line estimating the mean in count for each degree. 4. describe a plot that allows us to compare the incount and outcount variables. 2 before the test is started task 1: algorithms (2 + 3 + 3 + 2 = 10 marks) task 2: functions (2 + 3 + 3 + 2 = 10 marks) task 3: data structures and analysis (2 + 3 + 3 + 2 = 10 marks) task 4: visualisation (2 + 3 + 3 + 2 = 10 marks) data.frame(degree="x," incount="ceiling(10000*xˆ{-2.2})," outcount="ceiling(10000*xˆ{-2.4}))" 1.="" provide="" the="" code="" to="" produce="" a="" plot="" of="" degree="" and="" incount="" (degree="" is="" the="" x="" axis)="" with="" the="" axis="" labelled="" and="" the="" plot="" titled.="" 2.="" provide="" the="" code="" to="" produce="" a="" log-log="" plot="" (both="" x="" and="" y="" axis="" have="" log="" scales)="" of="" degree="" and="" incount="" (degree="" is="" the="" x="" axis)="" with="" the="" axis="" labelled="" and="" the="" plot="" titled.="" 3.="" provide="" the="" code="" to="" produce="" a="" log-log="" plot="" (both="" x="" and="" y="" axis="" have="" log="" scales)="" of="" degree="" and="" incount="" (degree="" is="" the="" x="" axis)="" with="" the="" axis="" labelled="" and="" the="" plot="" titled.="" also="" include="" a="" line="" estimating="" the="" mean="" in="" count="" for="" each="" degree.="" 4.="" describe="" a="" plot="" that="" allows="" us="" to="" compare="" the="" incount="" and="" outcount="" variables.="" 2="" before="" the="" test="" is="" started="" task="" 1:="" algorithms="" (2="" +="" 3="" +="" 3="" +="" 2="10" marks)="" task="" 2:="" functions="" (2="" +="" 3="" +="" 3="" +="" 2="10" marks)="" task="" 3:="" data="" structures="" and="" analysis="" (2="" +="" 3="" +="" 3="" +="" 2="10" marks)="" task="" 4:="" visualisation="" (2="" +="" 3="" +="" 3="" +="" 2="10">- data.frame(degree = x, incount = ceiling(10000*xˆ{-2.2}), outcount = ceiling(10000*xˆ{-2.4})) 1. provide the code to produce a plot of degree and incount (degree is the x axis) with the axis labelled and the plot titled. 2. provide the code to produce a log-log plot (both x and y axis have log scales) of degree and incount (degree is the x axis) with the axis labelled and the plot titled. 3. provide the code to produce a log-log plot (both x and y axis have log scales) of degree and incount (degree is the x axis) with the axis labelled and the plot titled. also include a line estimating the mean in count for each degree. 4. describe a plot that allows us to compare the incount and outcount variables. 2 before the test is started task 1: algorithms (2 + 3 + 3 + 2 = 10 marks) task 2: functions (2 + 3 + 3 + 2 = 10 marks) task 3: data structures and analysis (2 + 3 + 3 + 2 = 10 marks) task 4: visualisation (2 + 3 + 3 + 2 = 10 marks)>