Extension methods on IEnumerable<T>. All of them taking a delegate
1. CustomAll - Should work as All operation of Linq, with custom logic passed as delegate
2. CustomAny - Should work as Any operation of Linq, with custom logic passed as delegate
3. CustomMax - Should work as Max operation of Linq, with custom logic passed as delegate
4. CustomMin - Should work as Min operation of Linq, with custom logic passed as delegate
5. CustomWhere - Should work as Where operation of Linq, with custom logic passed as delegate
6. CustomSelect - Should work as Select operation of Linq, with custom logic passed as delegate
Extension methods on IEnumerable<T>. All of them taking a delegate
1. CustomAll - Should work as All operation of Linq, with custom logic passed as delegate
2. CustomAny - Should work as Any operation of Linq, with custom logic passed as delegate
3. CustomMax - Should work as Max operation of Linq, with custom logic passed as delegate
4. CustomMin - Should work as Min operation of Linq, with custom logic passed as delegate
5. CustomWhere - Should work as Where operation of Linq, with custom logic passed as delegate
6. CustomSelect - Should work as Select operation of Linq, with custom logic passed as delegate
Create a Product-Inventory software (No need of user Input or any other validations)
Product: (Override Equals or implement IEquatable<T>)
1. Id
2. Price
3. IsDefective
Inventory:
1. Dictionary containing all the products and their respective quantities in the inventory
2. Total value of the inventory
Methods
1. Add Product
2. Remove Product
3. Update Product Quantity
On change of Product’s Price, Inventory total value should get updated
If a Product becomes defective, remove it from the inventory.
(Handle them through EventHandler)
Consider the following signal
x(n) = ASin(2πf1n) + BSin(2πf2n) + CSin(2πf3n);
where A = 9, B = 8, C = 9
Also f1 = 250 Hz, f2 = 750 Hz and f3 = 989
Sampling Frequency fs = 4000 Hz
Perform the following operation on signal x(n) in MATLAB by developing a code:
a) Plot the signal x(n) in time domain.
b) Perform the DFT of the signal and plot magnitude values of signal in frequency
domain.
c) Apply a Low-pass FIR filter (Use convolution to apply filter) with 500 Hz cut-off
frequency to filter the signal x(n).
d) Plot the signal x(n) in time and frequency domain after filtration
Create a list of integers and call where method on it and pass delegate to it in the following ways:
Find odd - Lambda Expression – without curly brackets
Find Even - Lambda Expression – with curly brackets
Find Prime – Anonymous Method
Find Prime Another – Lambda Expression
Find Elements Greater Than Five – Method Group Conversion Syntax
Find Less than Five – Delegate Object in Where – Method Group Conversion Syntax in Constructor of Object
Find 3k – Delegate Object in Where –Lambda Expression in Constructor of Object
Find 3k + 1 - Delegate Object in Where –Anonymous Method in Constructor of Object
Find 3k + 2 - Delegate Object in Where –Lambda Expression Assignment
Find anything - Delegate Object in Where – Anonymous Method Assignment
Find anything - Delegate Object in Where – Method Group Conversion Assignment
Maintain a list of ducks to do following operations
1. Add a duck
2. Remove a duck
3. Remove all ducks
4. Capability to iterate the duck collection in increasing order of their weights. This should be the collections default iteration behaviour
5. Capability to iterate the duck collection in increasing order of number of wings.
Maintain a list
Create an equipment – mobile and immobile
Delete
Move – mobile and immobile (this is going to update certain properties in equipment)
List all equipment. (just the basic details – name and description)
Show details (all details – including distance moved till date and maintenance cost)
List all mobile equipment -> Use Lambda
List all Immobile equipment -> Use Lambda
List all equipment that have not been moved till now
Delete all equipment
Delete all immobile equipment
11Delete all mobile equipment
Create a console application for the above scenario meeting all requirements. Use in-memory objects for storing data. Also make sure to validate user input and show appropriate messages for invalid inputs.
Try using Lambda, Linq, Select, Where query etc. for this assignment
Non-Adjacent Combinations of Two Words
Given a sentence as input, find all the unique combinations of two words and print the word combinations that are not adjacent in the original sentence in lexicographical order.
Input
The input will be a single line containing a sentence.
Output
The output should be multiple lines, each line containing a valid unique combination of two words. The words in each line should be lexicographical order and the lines as well should be in lexicographical order. A valid combination will not contain the words that appear adjacent in the given sentence. Print "No Combinations" if there are no valid combinations.
Sample Input 1
raju always plays cricket
Sample Output 1
always cricket
cricket raju
plays raju
Sample Input 2
python is a programming language
Sample Output 2
a language
a python
is language
is programming
language python
programming python
Sample Input 3
to be or not to be
Sample Output 3
be be
be not
or to
to to
Rotate Matrix Rings
Given a matrix of order M*N and a value K, write a program to rotate each ring of matrix clockwise by K elements. If in any ring has less than or equal to K elements, then don’t rotate that ring.
Input
The first line of input will be two space-separated integers denoting M and N.
The next M lines will contain N space-separated integers.
The next line will contain integer, denoting K.
Output
The output should be M*N matrix by rotating matrix by K elements.
For example, if given M and N are 4 and 4 respectively. If matrix elements are
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
If given K is 3. Rotate each ring of matrix by 3 elements.
In above matrix, the elements (1, 2, 3, 4, 8, 12, 16, 15, 14, 13, 9, 5) is a ring, similarly, the elements (6, 7, 11, 10) will make a ring.
Therefore, by rotating each ring in clockwise direction by 3 elements will give (13, 9, 5, 1, 2, 3, 4, 8, 12, 16, 15, 14) and (10, 6, 7, 11). So output should be
13 9 5 1
14 7 11 2
15 6 10 3
16 12 8 4
Explain the difference between
constructor and initializer list. With program.