Tutor profile: Ayush A.
Questions
Subject: Discrete Math
A box contains 7 red, 5 white, and 4 black balls. What is the probability of your drawing at random one red ball?
There are 7 + 5 + 4 = 16 balls in the box. The probability of drawing one red ball is - P(R) = (number of possible ways of drawing a red ball) /(number of ways of drawing any ball) P(R) =7/ 16. This problem follows the basic way to calculate probability for a specific event A P(A) = count of event A in sample space / count of all events in sample space
Subject: C Programming
Write a program to check if two numbers are equal without using arithmetic operators or comparison operators.
The simplest solution for this is using Bitwise XOR operator (^). Based on idea that two equal numbers when XOR'ed returns 0. We will use this implement this progra,m. #include<stdio.h> int main() { int x = 10; int y = 10; if ( !(x ^ y) ) { printf(" x is equal to y "); } else { printf(" x is not equal to y "); } return 0; } Explanation - The program computes XOR of x and y. If value of XOR returns 0, the if expression will evaluate to 1(that is true), and print 2 numbers are equal, otherwise the else block will be executed.
Subject: Algebra
Given the function f(x) = 6 x + 1, What is the value of f(2) - f(1)
For f(2), the value of x will be replaced by 2 in f(x). So f(2) = (6 * 2) + 1 = 12 + 1 = 13 For f(1), the value of x will be replaced by 1 in f(x). So f(1) = (6 * 1) + 1 = 6 + 1 = 7 Finally, f(2) - f(1) = 13 - 7 = 6
Contact tutor
needs and Ayush will reply soon.