Questions: 9 913

Answers by our Experts: 9 913

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

You are given an array of N non-negative integers: A1A2, ..., AN. An alternating subsequence is a subsequence in which the indices of any two consecutive elements differ by exactly two in the original array. That is, if Ai1Ai2, ..., Aik is some subsequence, then for it to be an alternating subsequence, (i2 - i1 = 2), (i3 - i2 = 2), and so on should all hold true. Among all alternating subsequences, find the one which has maximum sum of elements, and output that sum.

Input

The first line of the input contains an integer T denoting the number of test cases.

The first line of each test case contains an integer N denoting the number of elements in the array.

The second line contains N space-separated integers A1A2, ..., AN denoting the array A.

Output

For each test case, output a single line containing the answer.

Note

A subsequence with only a single integer is also an alternating subsequence.


Create a Student class, where attributes associated with each student are name, registration


number, father name, degree and department. All attributes should not be accessed directly.


One can view the details of all students. Note student attributes cannot be changed by any


means after initialization. (Hint use constant objects)

Write a program that calculates and prints the monthly paycheck for an employee. The program takes as input



the gross pay and name of the employee from the user. It then calculates the net pay after taking the following



deductions on the gross pay:



Income Tax = 15%



Medicare Tax = 3.5%



Pension Fund = 2.75%



House Rent = 1000 Rs (fixed amount)



T


  1. Your task is to define the sendApology() function with the following details:
  2. Return type - void
  3. Function name - sendApology
  4. Parameters - a character and an integer.
  5. The sendApology() function will first check if the character passed is either 's', 'o', 'r', or 'y'. If it is, print it based on the passed integer number of times. For example, if the passed integer is 5, then you need to print the character 5 times. Otherwise, just ignore it (i.e. don't do anything).

OUTPUT

sooorrrrrrrrryyyyy

Given Code Editor:

#include <iostream>

using namespace std;

void sendApology(char, int);

int main(void) {

sendApology('s', 2);

sendApology('f', 10);

sendApology('b', 3);

sendApology('o', 5);

sendApology('r', 12);

sendApology('m', 5);

sendApology('v', 2);

sendApology('y', 7);

 return 0;

}

void sendApology(char letter, int n) {

  // TODO: Implement the function definition  

}


Write a program that computes the cost of a long distance call. The cost of call is determined according to the following rate schedules.

• A call made between 8:00 AM and 6:00 PM is billed at a rate of 6 rupees per minute.

• A call made before 8:00 AM or after 6:00 PM is charged at a rate of 3.75 rupees.

According to this schedule, if a call starts at any time between 8:00 AM and 6:00 PM, and it ends after 6:00 PM then it will be charged at the rate of 6 rupees per minute for the time before 6:00 PM and for the rest of the time rate will be 3.75 rupees per minute. For example if a call starts at 5:55 PM and ends at 6:05 PM then charges on this call will be 48.75 (30 rupees for first 5 minutes and 18.75 rupees for rest of the time).

Similarly if call starts at the time before 8:00 AM but ends after 8:00 AM then it will be charged at rate of 3.75 rupees for the time before 8:00 AM and for remaining minutes after 8:00 AM the rate will be 6 rupees per minute.



Using function, write and run a C++ program to computer the root of a quadratic equation,stating the conditions for real,complex and double roots respectively in your program

Using user defined function;write and run C++ program that computes the first 10 terms of an Arithmetic Progression (AP)

Write a c++ program to display the Fibonacci series of the first 50 integer numbers.

Write a c++ program to compute the results of five HND 1 students taking all the first semester courses displaying their number,course title and grades.

Given an integer n (between 1 and 104) find two prime numbers (possibly same) p1,p2 such that p1+p2=n



In case there are multiple solutions, you can output any of them.




If there is no solution, then print -1 -1 instead.


LATEST TUTORIALS
APPROVED BY CLIENTS