The goal of this coding exam is to quickly get you off the ground with the array method every ()
There is a selecting going on for civil service centre candidates have to participate in a number of events and the candid pose quotes more than 75 points in every event will be selected
Given candidateList as input it contains objects with name of the candidate and array consisting of poet attitude in each given by the candidate
Write a JS program to,
. Filter the candidates who have score more than 75 points in every event.
. Log the consisting of names of the selected candidates in the console
Input:
. The input will be a single line containing an array of objects candidatesList
Constraints
.keys object should be given in quotes
Sample input
[{'name:'blake,'points':[76,98,88,84]},{'name':'james','points':[098,12,33]},]
Output
[Blake]
Minimal Absolute Difference
There are N pyramids in a line.You are given their heights as a list of integers.Write a program to find the minimum absolute difference between the heights of any two different pyramids.
Input
The input is a single line containing space-separated integers.
Output
The output should be a single line containing the minimum absolute difference of any two different pyramid heights.
Explaanation
Given Pyramid heights are 7 1 5.
The absolute difference between the heights of any two different pyramids are
Matrix Triangle Sum
You are given a square matrix of size NxN, write a program to print the sum of upper and lower triangular elements.
Upper triangle consists of elements on the anti-diagonal and above it. The lower triangle consists of elements on the anti-diagonal and below it.
Explanation:
In the example,if the given matrix is
1 2 3
4 5 6
7 8 9
The upper triangle consists of elements on the anti-diagonal and above on it.
1 2 3
4 5
7
The sum of upper triangle elements is (1+2+3+4+5+7) equal to 22.
The lower triangle consists of elements on the anti-diagonal and below to it.
3
5 6
7 8 9
The sum of lower triangle elements is (3+5+6+7+8+9) equal to 38.
So the output should be
22
38
Sample Input
3 3
1 2 3
4 5 6
7 8 9
A ball is thrown vertically upwards with an initial velocity of 30 m/s.
Using a time step of 0.02 s up to 6.20 s, write a matlab code to give a plot of the vertical distance versus
time for this ball.
Hint ; Motion under gravity is described by the equation : 𝑣𝑦 = 𝑣𝑜𝑦𝑡 +
1
2
𝑔𝑡
2
and gravitational acceleration 𝑔 is here taken as negative.
Then use your code to answer the following questions:
(i) To what maximum height does the ball rise?
(ii) What is the index of time at maximum height?
(iii) How long does it take the ball to ascend to maximum height?
(iv) How long does it take the ball to hit the ground?
(v) What happens to the ball if the sign for gravitational acceleration is taken as positive?
A deduction of $20.00 is taken from the salary of an employee if the salary is less than $300.00 and a deduction of $30.00 if the salary is greater than or equal to $300.00. Input the salary and output the salary less the appropriate deduction.
Unique Matrix
You are given a N*N matrix. write a program to check if the matrix is unique or not. A unique Matrix is a matrix if every row and column of the matrix contains all the integers from 1 to N
Input:
The first line contains an integer N.
The next N lines contains N space separated values of the matrix.
Output:
The output contains a single line and should be True if the matrix is unique matrix and False otherwise.
Sample Input1
4
1 2 3 4
2 3 4 1
3 4 1 2
4 1 2 3
Sample Output1
True
Sample Input2
4
1 2 3 3
2 3 4 1
3 4 1 2
4 1 2 3
Sample Output2
False
Write C++ statements to perform the following tasks. Assume that each task related to each other.
(a) Create an array to hold 10 double values with initial value of 0.0.
(b) Assign value 55.5 to the last element in the array.
(c) Display the sum of the two first elements.
(d) Display all elements of the array using for loop.
(e) Computes the sum of all elements in the array using for loop and display the
result.
(f) Find the smallest and the largest value in the array and display the result.
Write a program to calculate simple integral?
Repeat Prob. 6.45 calculating the sum of every nth integer, beginning with the value assigned to nstart (i.e., for
i= nstart, nstart + n, nstart + 2*n, nstart + 3*n, etc.).
A program is usually not limited to a linear sequence of instructions. During its process it may bifurcate, repeat code or take decisions. For that purpose, C++ provides control structures that serve to specify what has to be done by our program, when and under which circumstances.
(a) What are the differences between a while loop and a do-while loop?
(4 marks)
(b) Convert the while loop in Program 4 to: i. do-while loop.
ii. for loop.
(3 marks) (3 marks)
(c) Develop a program that asks the user to enter an integer. If the user enters integer 1, then the program will display "Got 1" on the screen. If the user enters integer 66, then the program will display "Got 66" on the screen. . If the user enters integer 99, then the program will display "Got 99" on the screen. If the user enters an integer other than these three numbers, the program will display "Got something else" on the screen. You are required to switch structure.