Cts Detailed Document For Campus Placement

  • Uploaded by: Naman sharma
  • 0
  • 0
  • January 2021
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Cts Detailed Document For Campus Placement as PDF for free.

More details

  • Words: 3,097
  • Pages: 22
Loading documents preview...
Cognizant – About the company Cognizant Technology Solutions Corp (CTS) is an American multinational corporation that provides custom information technology, consulting, and business process outsourcing services.Originally founded as an in-house technology unit of Dun & Bradstreet in 1994, Cognizant started serving external clients in 1996. Cognizant is the dream company for almost all engineers. Thus, it is a company that hundreds of students apply to all across the world. It is important for you to be aware of the Cognizant recruitment process before you attend the drive. Visit Cognizant’s website for more information.

Academic Criteria 1) A candidate must have more than 60% marks in 10th and 12th (or diploma). 2) A candidate must have a minimum of 60% marks in graduation. 3) A maximum gap of 1 year is permissible after HSC(12th) and not after SSC(10th) or in between semesters of graduation. 4) A candidate should not have any pending backlogs at the time of appearing for Cognizant selection process.

Cognizant policies 1) If a candidate has attended an interview within the past 6 months from the date of new application, then he/ she is ineligible to apply. 2) If a candidate has been rejected by Cognizant in an interview, then the candidate is ineligible to apply again for a period of 6 months after the interview. 3) If for some reason Cognizant has terminated the candidate's application, then the candidate is ineligible to apply. 4) If for any reason a candidate after applying in Cognizant, misses the opportunity to give the interview then the candidate holds the right to apply again and can attend the selection process.

Nidhi Gu Anurag Singh

Cognizant Test pattern 2019 (on-campus)

 

Sections

Number of questions

Time duration

Quantitative Aptitude Logical Reasoning Verbal Ability Automata Fix

16 24 22 7

16 mins 35 mins 18 mins 20 mins

Programmer Analyst Trainee (CTC: 3.38 LPA) Associate (CTC: 6.5 LPA) Cognizant recruits its employees in two ways: 1. On-campus Recruitment  Aptitude  Programming  HR 2. Off-campus Recruitment  Aptitude  Programming  Technical Round  HR

Cognizant Interview Pattern for On-campus drives: 1. Logical Reasoning  Questions - 14  Time - 14 minutes  Difficulty - High  Cut-Off - 70% 2. Quantitative Aptitude  Questions - 16  Time - 16 minutes  Difficulty - Medium  Cut-Off - 70% 3. Verbal Ability  Questions - 25

Nidhi Gu Anurag Singh

 Time - 25 minutes  Difficulty - Medium  Cut-Off - 70% 4. Automata Fix  Questions - 7  Time - 20 minutes  Difficulty - High  Cut-Off - 70% Cognizant Interview Pattern for Off-campus drives: 1. Aptitude Questions    

Questions - 16 Time - 16 minutes Difficulty - High Cut-Off - 70%

2. Logical Questions    

Questions - 14 Time - 14 minutes Difficulty - Medium Cut-Off - 70%

3. English Questions    

Questions - 25 Time - 25 minutes Difficulty - Medium Cut-Off - 70%

4. Coding Questions    

Questions - 2 Time - 60 minutes Difficulty - Medium Cut-Off - 70%

Nidhi Gu Anurag Singh

Cognizant Syllabus (on-campus) Section

Topics

Quantitative Aptitude

Numbers Time and work Ratios and Proportion Averages, Profit & Loss Time, speed and distance Percentages Permutations and Combinations Probability Logarithms Geometry

Logical Reasoning

Data Arrangements Blood Relations Coding and Decoding series Analogy Odd Man out Data sufficiency Direction Sense Logical Sequence

Verbal Ability

Reading comprehension Para-jumbles Sentence completion Sentence improvement Sentence correction Vocabulary

Automata Fix

Logical Error Correction Syntax Error Correction Code Reuse

CTS Programming Questions Specific FAQ’s

Nidhi Gu Anurag Singh

Cognizant Programming Questions by Year 2015 2016 2017 2018

No. of Questions 0 2 0 2

Languages allowed None C, C++ None C, C++, Java, C#

Cut off Top 40% Top 40% Top 40% Top 30%

Cognizant Coding Questions For Coding Round Cognizant programming test Questions are of moderate difficulty, in this section since a third party hosts the round it is of moderate to high difficulty. So, practicing all the questions below is highly recommended, if you do so then CTS Coding Questions and Answers can be a cakewalk. This sections is also popularly known as Cognizant Automata Questions Round, Cognizant Automata Round section in Programming Test of CTS generally has a time limit of 1 hour or 1 hour 30 mins depending on difficulty of the given Cognizant Online Programming Questions to the student. We will suggest reading the CTS Programming Questions FAQ section at the end of the page as well. We think about 60% of the students appearing for Cognizant Coding Questions don’t clear this round of Cognizant Coding Test and are eliminated before the interview round.  

1 medium difficulty Question 1 hard Question

What is Automata Fix? What sort of questions can be expected?   

Candidate needs to fix all errors in a given code. Candidate needs to correct the syntax of the given code without changing its logic. Candidates need to complete the given code by reusing existing functions in the code.

Nidhi Gu Anurag Singh

AMCAT Programming (Automata) Questions – 1



C Program to check if two given matrices are identical [code language=”cpp”+ #include <stdio.h> #define N 4 // This function returns 1 if A[][] and B[][] are identical // otherwise returns 0 intareSame(int A[][N], int B[][N]) { inti, j; for (i = 0; i< N; i++) for (j = 0; j < N; j++) if (A[i][j] != B[i][j]) return 0; return 1; } int main() { int A[N][N] = { {1, 1, 1, 1}, {2, 2, 2, 2}, {3, 3, 3, 3}, {4, 4, 4, 4}}; int B[N][N] = { {1, 1, 1, 1}, {2, 2, 2, 2}, {3, 3, 3, 3}, {4, 4, 4, 4}}; if (areSame(A, B)) printf("Matrices are identical"); else printf("Matrices are not identical"); return 0; } [/code]

Nidhi Gu Anurag Singh

AMCAT Programming(Automata) Questions – 2 Print a given matrix in spiral form Given a 2D array, print it in spiral form. See the following examples. Please comment down the code in other languages as well below – Input: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Output: 1 2 3 4 8 12 16 15 14 13 9 5 6 7 11 10 Input: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Output: 1 2 3 4 5 6 12 18 17 16 15 14 13 7 8 9 10 11 Code inC [code language=”cpp”+ #include #define R 3 #define C 6 voidspiralPrint(int m, int n, int a[R][C]) { inti, k = 0, l = 0; /* k – starting row index m – ending row index l – starting column index n – ending column index i – iterator */

Nidhi Gu Anurag Singh

while (k &lt; m &amp;&amp; l &lt; n) { /* Print the first row from the remaining rows */ for (i = l; i&lt; n; ++i) { printf("%d ", a[k][i]); } k++; /* Print the last column from the remaining columns */ for (i = k; i&lt; m; ++i) { printf("%d ", a[i][n-1]); } n–; /* Print the last row from the remaining rows */ if ( k &lt; m) { for (i = n-1; i&gt;= l; –i) { printf("%d ", a[m-1][i]); } m–; } /* Print the first column from the remaining columns */ if (l &lt; n) { for (i = m-1; i&gt;= k; –i) { printf("%d ", a[i][l]); } l++; } } } /* Driver program to test above functions */ intmain() { int a[R][C] = { {1, 2, 3, 4, 5, 6}, {7, 8, 9, 10, 11, 12}, {13, 14, 15, 16, 17, 18} };

Nidhi Gu Anurag Singh

spiralPrint(R, C, a); return 0; } [/code]

1 2 3 4 5 6 12 18 17 16 15 14 13 7 8 9 10 11 Code in Java *code language=”java”+ private static int[] spiral(int[][] matrix) { //Test if matrix is rectangular intlen=matrix[0].length; for(inti=1; i<matrix.length; i++) { if(matrix[i].length!=len) { System.out.println("Not rectangular"); return null; } } int[] erg = new int[len*matrix.length]; int[] borders = new int[]{0,0,matrix.length-1, len-1}; int[] pointer = new int[]{0,0}; int state=0; for(inti=0; i<erg.length; i++) { erg[i]=matrix[pointer[0]][pointer[1]]; switch (state) { case 0: if(pointer[1] == borders[3]) { state++; pointer[0]++; borders[0]++; break; } pointer[1]++; break; case 1: if(pointer[0] == borders[2])

Nidhi Gu Anurag Singh

{ state++; pointer[1]–; borders[3]–; break; } pointer[0]++; break; case 2: if(pointer[1] == borders[1]) { state++; pointer[0]–; borders[2]–; break; } p ointer[1]–; break; case 3: if(pointer[0] == borders[0]){ state=0; pointer[1]++; borders[1]++; break; } pointer[0]–; break; } } return erg; } [/code] AMCAT Programming (Automata) Questions – 3

Given an n-by-n matrix of 0’s and 1’s where all 1’s in each row come before all 0’s, find the most efficient way to return the row with the maximum number of 0’s. Please comment down the code in other languages as well below – *code language=”cpp”+ #include <stdio.h> #include <stdlib.h> #include #define COL 4 #define ROW 4 using namespace std; int main() { intarr[ROW][COL]= { {1,1,1,1}, {1,1,0,0},

Nidhi Gu Anurag Singh

{1,0,0,0}, {1,1,0,0}, }; intrownum; inti = 0, j = COL-1; while(i;0) { if(arr[i][j]==0) { j–; rownum=i;} else i++; } printf("%d",rownum); getch(); return 0; } [/code]

AMCAT Coding Question 4 (Unsolved) A Pythagorean triplet is a set of three integers a, b and c such that a2 + b2 = c2. Given a limit, generate all Pythagorean Triples with values smaller than given limit. Input : limit = 20 Output : 3 4 5 8 6 10 5 12 13 15 8 17 12 16 20 A Simple Solution is to generate these triplets smaller than given limit using three nested loop. For every triplet, check if Pythagorean condition is true, if true, then print the triplet. Time complexity of this solution is O(limit3) where ‘limit’ is given limit. An Efficient Solution can print all triplets in O(k) time where k is number of triplets printed. The idea is to use square sum relation of Pythagorean triplet, i.e., addition of squares of a and b is equal to square of c, we can write these number in terms of m and n such that,

Nidhi Gu Anurag Singh

a = m2 - n 2 b=2*m*n c = m2 + n 2 because, a2 = m4 + n4 – 2 * m2 * n2 b2 = 4 * m2 * n2 c2 = m4 + n4 + 2* m2 * n2 We can see that a2 + b2 = c2, so instead of iterating for a, b and c we can iterate for m and n and can generate these triplets. Below is C implementation of above idea. *code language=”cpp”+ // A C program to generate pythagorean triplets // smaller than a given limit #include <stdio.h> #include <math.h> // Function to generate pythagorean triplets // smaller than limit void pythagoreanTriplets(int limit) { // triplet: a^2 + b^2 = c^2 int a, b, c=0; // loop from 2 to max_limitit int m = 2; // Limiting c would limit all a, b and c while (c < limit) { // now loop on j from 1 to i-1 for (int n = 1; n < m; ++n) { // Evaluate and print triplets using // the relation between a, b and c a = m*m – n*n; b = 2*m*n; c = m*m + n*n;

Nidhi Gu Anurag Singh

if (c > limit) break; printf("%d %d %d\n", a, b, c); } m++; } } // Driver program int main() { int limit = 20; pythagoreanTriplets(limit); return 0; } [/code] 345 8 6 10 5 12 13 15 8 17 12 16 20 Time complexity of this approach is O(k) where k is number of triplets printed for a given limit (We iterate for m and n only and every iteration prints a triplet) Cognizant Coding Test for Automata (Easy) Ques. Find GCD of two Integers? #include int main() { int n1, n2,i,gcd;

printf("Enter two integers: "); scanf("%d %d",&n1,&n2);

Nidhi Gu Anurag Singh

for(i=1;i<= n1 &&i<= n2;++i) { // Checks if i is factor of both integers if(n1%i==0&& n2%i==0) gcd=i; }

printf("G.C.D of %d and %d is %d", n1, n2,gcd);

return0; } Option 2 if Numbers are both Positive and Negative? #include int main() { int n1, n2;

printf("Enter two integers: "); scanf("%d %d",&n1,&n2);

// if user enters negative number, sign of the number is changed to positive n1 =( n1>0)?n1 :-n1; n2 =( n2>0)?n2 :-n2;

while(n1!=n2) { if(n1 > n2)

Nidhi Gu Anurag Singh

n1 -= n2; else n2 -= n1; } printf("GCD = %d",n1);

return0; }

Ques. Remove all Vowels from a String using Pointers concept?

#include <stdio.h> #include <stdlib.h> #include <string.h> #define TRUE 1 # define FALSE 0 intcheck_vowel(char); main() { char string[100], * temp, * pointer, ch, * start; printf(“Enter a string\n”); gets(string); temp = string; pointer = (char * ) malloc(100); if (pointer == NULL) { printf(“Unable to allocate memory.\n”); exit(EXIT_FAILURE); } start = pointer; while ( * temp) { ch = * temp; if (!check_vowel(ch)) { * pointer = ch; pointer++;

Nidhi Gu Anurag Singh

} temp++; } * pointer = ‘\0’; pointer = start; strcpy(string, pointer); /* If you wish to convert original string */ free(pointer); printf(“String after removing vowel is \”%s\”\n”, string); return 0; } intcheck_vowel(char a) { if (a >= ‘A’ && a <= ‘Z’) a = a + ‘a’ – ‘A’; if (a == ‘a’ || a == ‘e’ || a == ‘i’ || a == ‘o’ || a == ‘u’) return TRUE; return FALSE;

Write a program to return a sorted array from two unsorted array? Examples: Input : a[] = {10, 5, 15} b[] = {20, 3, 2} Output : Merge List : {2, 3, 5, 10, 15, 20} Input : a[] = {1, 10, 5, 15} b[] = {20, 0, 2} Output : Merge List : {0, 1, 2, 5, 10, 15, 20} Please also comment the code down below in other languages. #include using namespace std; // Function to merge array in sorted order voidsortedMerge(int a[], int b[], int res[], int n, int m) { // Concatenate two arrays inti = 0, j = 0, k = 0; while (i< n) { res[k] = a[i]; i += 1;

Nidhi Gu Anurag Singh

k += 1; } while (j < m) { res[k] = b[j]; j += 1; k += 1; } // sorting the res array sort(res, res + n + m); } // Driver code int main() { int a[] = { 10, 5, 15 }; int b[] = { 20, 3, 2, 12 }; int n = sizeof(a) / sizeof(a[0]); int m = sizeof(b) / sizeof(b[0]); // Final merge list int res[n + m]; sortedMerge(a, b, res, n, m); cout<< “Sorted merged list :”; for (inti = 0; i< n + m; i++) cout<< ” ” << res*i+; cout<< “n”; return 0; } } Top of Form How to Find LCM of three numbers Please write your version or code in other Languages below in comments. You will find code in these languages:C C++ Java

Nidhi Gu Anurag Singh

If you can write a program to find LCM of two numbers. Then you can very easily write a program to find LCM of three numbers also , cause lcm(a,b,c)=lcm(a,lcm(b,c))lcm(a,b,c)=lcm(a,lcm(b,c)). So here’s your c program to find LCM of three numbers. C Program to find lcm of 3 numbers *code language=”cpp”+ #include<stdio.h> int lcm(int,int); int main(){ inta,b,c,l,k; printf("Enter any three positive integers "); scanf("%d%d%d",&a,&b,&c); if(ac) k= lcm(l,c); else k= lcm(c,l); printf("LCM of two integers is %d",k); return 0; } int lcm(inta,int b){ int temp = a; while(1){ if(temp % b == 0 && temp % a == 0)

Nidhi Gu Anurag Singh

break; temp++; } return temp; } [/code] Code in C++ [code language=”cpp”+ #include using namespace std; int lcm(int, int, int); inthcf(int, int, int); int main() { inta,b,c; int LCM, HCF; cout<<"Enter 1st number: "; cin>>a; cout<<"Enter 2nd number: "; cin>>b; cout<<"Enter 3rd number: "; cin>>c; LCM = lcm(a,b,c); HCF = hcf(a,b,c); cout<<"LCM of "<=y&&x>=z) max=x; else if(y>=x&&y>=z) max=y;

Nidhi Gu Anurag Singh

else if(z>=x&&z>=y) max=z; for(count=1;flag==0;count++) { lcom=max*count; if(lcom%x==0 &&lcom%y==0 &&lcom%z==0) { flag=1; } } returnlcom; } inthcf(int p, int q, int r) { intgcf=1,flag=0, count; for(count=1; flag==0;count++) { if(p%count==0&&q%count==0&&r%count==0) gcf=count; if(count>p&&count>q&&count>r) { flag=1; } } returngcf; } [/code] Java Program to Find LCM of N Numbers LCM of three Numbers in Java *code language=”java”+ public class LCM { public static long lcm(int[] numbers) { long lcm = 1; int divisor = 2; while (true) { intcnt = 0; boolean divisible = false; for (inti = 0; i
Nidhi Gu Anurag Singh

* lcm (n1,n2,… 0)=0.For negative number we convert into * positive and calculate lcm. */ if (numbers[i] == 0) { return 0; } else if (numbers[i] < 0) { numbers[i] = numbers[i] * (-1); } if (numbers[i] == 1) { cnt++; } /** * divide numbers by devisor if complete division i.e. without * remainder then replace number with quotient; used for find * next factor */ if (numbers[i] % divisor == 0) { divisible = true; numbers[i] = numbers[i] / divisor; } } /** * If divisor able to completely divide any number from array * multiply with lcm and store into lcm and continue to same divisor * for next factor finding. else increment divisor */ if (divisible) { lcm = lcm * divisor; } else { divisor++; } /** * Check if all numbers is 1 indicate we found all factors and * terminate while loop. */ if (cnt == numbers.length) { return lcm; } } } public static int lcm2(int num1, int num2) { if(num1==0 || num2==0){

Nidhi Gu Anurag Singh

return 0; }else if(num1<0){ num1=num1*(-1); }else if(num2<0){ num2=num2*(-1); } int m = num1; int n = num2; while (num1 != num2) { if (num1 < num2) { num1 = num1 + m; } else { num2 = num2 + n; } } return num1; } public static void main(String[] args) { int[] numbers = {140, 72, 130}; System.out.println("*** Least Common Multiple ***"); System.out.println("LCM(Least Common Multiple) of N numbers using Table method "); System.out.println(lcm(numbers)); System.out.println("LCM of two numbers using repetative addition"); System.out.println(lcm2(1, 72)); } } [/code] Output: *** Least Common Multiple *** LCM(Least Common Multiple) of N numbers using Table method 32760 LCM of two numbers using repetative addition 72

Nidhi Gu Anurag Singh

Related Documents

Cts Ppt
February 2021 2
Document
March 2021 0
Document
February 2021 2

More Documents from "AjitaSP"