Day 28 : Tasks



'X' is the wife of 'Y', 'Y' is the brother of 'Z' and 'Z' is the son of 'P'. How is 'P' related to 'X'?

  • Sister

  • Aunt

  • Brother

  • Father in Law

Ans : Father in Law Explanation :

The relationship chart, based on the given problem can be worked out as given below. 'Y' is the brother of 'Z' who is son of "P' So. Z' is also the son of 'P' When 'P' is the father of 'Y' and X' is the wife of 'Y' then 'P is the father-in-law of 'X'


Technical MCQ

A dedicated path is needed in ________ switching before the data is sent from the sender to the receiver but it is not needed in -------- switching.

  1. Packet, time division

  2. space division, packet

  3. packet, circuit

  4. circuit, packet

Ans : Circuit, Packet

Coding Question

There are N number of Pizza bowls and in each bowl there are ai pizzas . You can eat pizzas from any bowl but you cannot eat pizzas from two consecutive bowls . Find the maximum number of pizzas you can eat.

Input: First line of input contains a positive integer T denoting number of test cases. For each test case, first line contains N denoting number of pizza bowls . Second line contains N space seperated integers where each of them denotes number of pizzas in ith bowl.

Output: For each test case print the maximum number of pizzas you can eat.

Your Task: This is a functional problem you don't need to take input just complete the function maxPizza() which accepts two parameters an integer N (number of bowls) and an array arr (contains number of pizzas in ith bowl) and returns the maximum number pizzas you can eat.

Constraints: 1 <= T <= 100 1 <= N <= 105 1 <= ai <= 109

Example: Input: 2 5 1 2 3 4 5 5 5 3 4 11 2 Output: 9 16

Explanation: Testcase1: you can eat pizzas from bowl number 1, 3 and 5. Testcase2: you can eat pizzas from bowl number 1 and 4.

Solution :

int maxPizza(int n , int arr[])
if(n==1) return v[0];
for(int i=2;i<n;i++)
return v[n-1];