Click To Get Off-Campus Placement Jobs Info !!!
Capgemini Recruitment Process 2020 – Updated Test Pattern and Selection Process in Details Latest Pattern !!

361 / 384

Given a number n, print all primes smaller than or equal to n. It is also given that n is a small number.

Input : n =10

Output : 2 3 5 7

|  Basics | | | |  Fresher

362 / 384

For given a positive integer N, return the sum of digits at even places and odd places. Write a program for it.

Input : NA

Output : NA

|  Basics | | | |  Fresher

363 / 384

For given a string and an integer N, reverse N letters from the string. Write a program for it.

Input : NA

Output : NA

|  Strings | | | |  Fresher

364 / 384

Find the 4th nearest prime number for a given number n. Write a program for it.

Input : NA

Output : NA

|  Basics | | | |  Fresher

365 / 384

Sort a list of dates in ascending order given the data format shown below: Each date is in the form ddmmmyyyy where dd is the set {0-31} mmm is in the set {Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec) yyyy is four digits. Example dates = {'01 Mar 2017';'03 Feb 2017';'15 Jan 1998'] The array dates sort to ['15 Jan 1998';'03 Feb 2017';'01 Mar 2017';]

Input : {'01 Mar 2017';'03 Feb 2017';'15 Jan 1998']

Output : The array dates sort to ['15 Jan 1998';'03 Feb 2017';'01 Mar 2017';]

|  Strings | | | |  Fresher

Tags:SAP Labs

366 / 384

Given two vectors. One contains array element "ele" and other indexes "ind" to push the corresponding element at that index in new array shifting all elements to its right. Example: Intput: ele = {0, 1, 2, 3, 4} ind ={0, 1, 2, 1, 2} Output: {0, 3, 4, 1, 2}

Input : ele: {0, 1, 2} ind: {0, 1, 0}

Output : {2, 0, 1}

|  Array | | | |  Fresher

Tags:SAP Labs

367 / 384

Write a program to generate a simple pattern. 1 12 123 1234 123 12 1

Input : 4

Output : 1 12 123 1234 123 12 1

|  Basics | | | |  Fresher

Tags:SAP Labs

368 / 384

Given an array, print the Next Greater Element (NGE) for every element. The Next greater Element for an element x is the first greater element on the right side of x in the array. Elements for which no greater element exist, consider next greater element as -1.

Input : NA

Output : NA

|  Basics | | | |  Fresher

Tags:SAP Labs

369 / 384

Given a binary tree and at any moment of time, a given node starts to fire, after one-second fire reaches to all the nodes which are directly connected with given node so the fire cycle continues as same. You need to find minimum time at which whole tree will be burnt.

Input : NA

Output : NA

|  Trees | | | |  Fresher

Tags:SAP Labs

370 / 384

Given an array with n elements and a sum x, need to count all pairs of elements in the array whose sum is equal to x. Told two approaches one using binary search and other using two pointers.

Input : NA

Output : NA

|  Array | | | |  Fresher

Tags:SAP Labs

+ Contribute Programming Qs.

Baig
1