ICAR-IASRI MSc and PhD (Agricultural Statistics, Computer Application, Bioinformatics) · India · ICAR-Indian Agricultural Statistics Research Institute with the IARI Graduate School
Original practice questions written to the published syllabus · not past papersWriting correct, readable programs for data work: R and Python as the working languages, with the control structures, functions, data frames, vectorisation and debugging habits that later computing subjects assume. C and SAS are covered where agricultural universities still teach them.
In the exams: GATE DA 'Programming, Data Structures and Algorithms' (heavy: Python named); AICE-JRF Computer Application Unit 2 programming (heavy); AIEEA-PG Group 07 computer programming (present)
How our questions for ICAR-IASRI MSc and PhD spread across the units of Programming for Statistics & Data (R and Python). Difficulty: 13 easy, 18 medium, 0 hard.
| R: vectors, data frames, factors and lists | 7 | |
| R: functions, control flow and vectorisation | 6 | |
| Graphics in R (base and ggplot2) and Python (matplotlib) | 4 | |
| Writing functions and simple packages | 4 | |
| Algorithms, flowcharts and pseudocode | 3 | |
| Reading, cleaning and reshaping data | 3 | |
| Debugging, testing and code style | 3 | |
| Python: core types, NumPy arrays and pandas data frames | 1 |
Choose an answer, then open the working. Each explanation says why the right answer is right and why the others are not.
For a list lst in R, lst[1] and lst[[1]] return respectively:
C. A list of length one, and the element itself
Single brackets subset the list; double brackets extract the element.
Further reading: Wickham and Grolemund, R for Data Science; McKinney, Python for Data Analysis (2022); Kernighan and Ritchie, The C Programming Language (1988); Delwiche and Slaughter, The Little SAS Book (2019)
Why is seq_along(x) preferred to 1:length(x) in R loops?
D. 1:length(x) gives c(1, 0) when x is empty
With an empty x, 1:0 runs the loop twice with invalid indices; seq_along gives an empty sequence.
Further reading: Wickham and Grolemund, R for Data Science; McKinney, Python for Data Analysis (2022); Kernighan and Ritchie, The C Programming Language (1988); Delwiche and Slaughter, The Little SAS Book (2019)
R's lexical scoping means that a function looks up a free variable:
C. Where the function was defined
Lookup follows the defining environment, then its parents.
Further reading: Wickham and Grolemund, R for Data Science; McKinney, Python for Data Analysis (2022); Kernighan and Ritchie, The C Programming Language (1988); Delwiche and Slaughter, The Little SAS Book (2019)
Which join keeps only rows whose keys appear in both tables?
D. Inner join
Left and right joins keep all rows of one table; full keeps all of both.
Further reading: Wickham and Grolemund, R for Data Science; McKinney, Python for Data Analysis (2022); Kernighan and Ritchie, The C Programming Language (1988); Delwiche and Slaughter, The Little SAS Book (2019)
Which ggplot2 function splits a plot into panels by a variable?
A. facet_wrap
Facets create small multiples.
Further reading: Wickham and Grolemund, R for Data Science; McKinney, Python for Data Analysis (2022); Kernighan and Ritchie, The C Programming Language (1988); Delwiche and Slaughter, The Little SAS Book (2019)
The grammar of graphics that ggplot2 implements was set out by:
D. Wilkinson
Leland Wilkinson's The Grammar of Graphics.
Further reading: Wickham and Grolemund, R for Data Science; McKinney, Python for Data Analysis (2022); Kernighan and Ritchie, The C Programming Language (1988); Delwiche and Slaughter, The Little SAS Book (2019)
A scatter-plot matrix of several variables in base R is drawn with:
D. pairs()
pairs plots every pair of variables.
Further reading: Wickham and Grolemund, R for Data Science; McKinney, Python for Data Analysis (2022); Kernighan and Ritchie, The C Programming Language (1988); Delwiche and Slaughter, The Little SAS Book (2019)
Declaring package dependencies and versions for a project mainly prevents:
C. Breakage when shared libraries change
Pinned versions and project environments keep analyses reproducible.
Further reading: Wickham and Grolemund, R for Data Science; McKinney, Python for Data Analysis (2022); Kernighan and Ritchie, The C Programming Language (1988); Delwiche and Slaughter, The Little SAS Book (2019)
A well-designed function should:
D. Return values, not change globals
Pure, focused functions are easier to test and reuse.
Further reading: Wickham and Grolemund, R for Data Science; McKinney, Python for Data Analysis (2022); Kernighan and Ritchie, The C Programming Language (1988); Delwiche and Slaughter, The Little SAS Book (2019)
Which is a testing framework for R?
B. testthat
pytest is the common Python framework.
Further reading: Wickham and Grolemund, R for Data Science; McKinney, Python for Data Analysis (2022); Kernighan and Ritchie, The C Programming Language (1988); Delwiche and Slaughter, The Little SAS Book (2019)
Ten here, 31 in the app. The Laisha app has every practice question we have written to ICAR-IASRI MSc and PhD in this subject, marked as you go, with timed papers, a jump-to-unanswered list and a certificate when you pass at 70 per cent.
Free for ten days, then one subscription of US$10 a month. We would rather say so here than have you find it later.
An AI operating system for agriculture: free guides, manuals and tools written for every country.