QMmS

Cards (43)

  • R Programming Language
    • Used in Data Science
    • Free to use
    • Thousands of R packages
    • Developed in 1993 by Ross Ihaka
    • Widely used for statistical computing, data analysis, and data visualization
    • Platform-independent, it can run on Windows, macOS, and Linux operating systems
    • Open-source, it can be used without any licensing fees
    • Case sensitive
  • Applications and Uses of R
    • Visualization and Reporting
    • Basic Data Analysis
    • Statistical Analysis
  • Assignment
    = or <-
  • R Object or Variable
    Used to store data; saved in the workspace
  • Data Types / Atomic Data Structures
    • Numerical
    • Integer
    • Logical
    • Character
  • Coercion
    Forcing one type of data to another type
  • Vector
    Homogenous, all are numerical/integers/character/string
  • List
    Heterogenous, extension of vector, can also contain a matrix or a function as its elements
  • Line Chart
    Created using ggplot2, a package for creating elegant data visualisations using the grammar of graphics
  • Parametric
    Normally distributed
  • Non-Parametric
    Not normally distributed, Spearman rho, Kendall Tau
  • Correlation
    Evaluates the relationship between 2 variables
  • Correlation Coefficient Ranges
    • 0 to 0.10 = negligible
    • 0.10 to 0.39 = weak
    • 0.40 to 0.69 = moderate
    • 0.70 to 0.89 = strong
    • 0.90 to 1.00 = very strong
  • Shapiro Wilk Test
    Used to decide whether or not a sample fits a normal distribution
  • Pearson Correlation

    • Variables should be quantitative and continuous, linear dependence, no significant outliers, approximately normally distributed
  • Spearman Rho
    • Variables should be measured on an ordinal or continuous level, paired observations, monotonic relationship
  • Kendall Tau
    • Variables should be measured on an ordinal or continuous level, paired observations, skewed or not are okay
  • Chi Square
    Test of independence, used to analyze the frequency table/ contingency table, evaluate whether there is significant association between categorical variables
  • Java program to demonstrate the concept of interface inheritance
    1. Vehicle interface declares start() method
    2. Car interface extends Vehicle and declares stop() method
    3. Sedan class implements Car interface and provides implementations for start() and stop() methods
    4. In Main class, Sedan object is created and start() and stop() methods are called
  • Vehicle is an interface that declares a method start()
  • Car is an interface that extends the Vehicle interface and declares a method stop()
  • Sedan is a class that implements the Car interface. It provides implementations for both start() and stop() methods
  • Main class
    1. Create Sedan object
    2. Call start() method on Sedan object
    3. Call stop() method on Sedan object
  • Output:
    Sedan is Starting
    Sedan is Stopping
  • Implement multiple interfaces in Java
    1. Phone class defines basic phone functionalities
    2. Camera interface defines methods for taking pictures and recording videos
    3. Player interface defines methods for playing, pausing, and stopping music
    4. SmartPhone class extends Phone and implements Camera and Player, overriding the interface methods
  • In the main() method, an object of the SmartPhone class is created, and various methods such as voiceCall(), sms(), click(), record(), play(), pause(), and stop() are called to demonstrate the functionality of the SmartPhone class
  • Output:
    Make VoiceClass
    We Can send SMS
    Take a Selfi
    Take a video
    Play Music
    Pause Music
    Stop Music
  • Polymorphism means innumerable forms
  • Polymorphism
    The phenomenon by which an object can acquire an ability to operate from different perspectives
  • Polymorphism in Java

    • Makes it possible to write a method that can correctly process lots of different types of functionalities that have the same name
    • Provides consistency in the code
  • Advantages of Polymorphism in Java
    • Provides reusability to the code
    • A single variable can be used to store multiple data values
    • Easier for the programmer to debug the code
  • Types of Polymorphism
    • Compile-Time Polymorphism (Method Overloading)
    • Runtime Polymorphism (Method Overriding)
  • Compile-Time Polymorphism

    Also known as Static Polymorphism, the call to the method is resolved at compile-time
  • Runtime Polymorphism
    Also known as Dynamic Binding or Dynamic Method Dispatch, the call to an overridden method is resolved dynamically at runtime
  • Differences between Overloading and Overriding
    • Overloading: Occurs within one class, method names are same but parameters are different, return type can be same or different
    • Overriding: Occurs in two classes (superclass and subclass), method name and parameters are both the same, return type is always the same
  • Example of Compile-Time Polymorphism
    1. Create Shapes object
    2. Call area() method with different parameters
  • Example of Runtime Polymorphism
    1. Create Animal object
    2. Create Dog object (upcasting)
    3. Call eat() method on both objects
  • Rules in Polymorphism
    • Reference variable = Own class Object
    • Reference Variable = Child class Object
    • Reference variable Cannot point to Parent Class Object
  • Example of Polymorphism
    1. Create Triangle and Circle objects, both of type Shape
    2. Call area() method on both objects
  • Coercion
    Implicitly converting one type of object into a new object of a different kind, done automatically to prevent type errors