Recent Articles

#### C/Java PROGRAMMING KICKSTART in Bengaluru (Bangalore)

1 week ago

SkillRack.com is an online platform to learn from programming basics to enhance your skills till competitive programming.

SkillRack is arranging a free half day orientation session for the 2018 batch students who are not yet placed. The session will consist of the following.

- 10 programming concepts and solving related programs asked in major IT companies hands-on (You will solve the programs using www.skillrack.com) and SkillRack mentors will assist you.

When is this session happening?
- The session will be happening on 11th October 2018 from 10:00 am to 12:30 noon at our Bengaluru office address mentioned below.

What is the cost involved?
- The orientation session is free and you need not pay for it.

Why is the session free (as every one has a business motive)?
- We are doing it free as a promotional activity

What's the count of participants allowed?
- Only 30 are allowed in a session. Hence please register at this Google Form link entering your email and phone number. We will email and confirm the approval of your registration.

What should you bring?
- Bring your own laptop or two can share one laptop (if your friend has one)
- You must your mobile HOTSPOT to connect to internet and solve the programs using www.skillrack.com

#### Print Series - AUTOMATA FIX

1 month ago

Problem - (ID 6463)

You are required to complete the given code by reusing existing functions. You can click on Run anytime to check the compilation/ execution status of the program. You can use printf to debug your code. The submitted code should be logically/syntactically correct and pass all test cases. Do not write the main() function as it is not required.

Code Approach: For this question, you will need to complete the code as in given implementation. We do not expect you to modify the approach.

The function printSeries(int S, int D, int T, char ch) accepts integer S as the starting term of series, integer D as the common difference for AP or common ratio for GP, integer T as the number of terms and a character ch as the series type to print. It is supposed to print the arithmetic progression if the character ch is 'A' and print the geometric progression if the character ch is 'G'.

The program must calculate both arithmetic progression and geometric progression.

However, an incomplete code in the function printSeries does not print the desired output for all the test cases.

You will have to complete the code to make it work so that the program passes all the test case.

Erroneous Code

void printSeries(int S, int D, int T, char ch)
{
while(T > 0)
{
if(ch == 'A')
{
S += D;
}
else if(ch == 'G')
{
S *= D;
}
printf("%d ", S);
T--;
}
}

Explanation:
The series value is printed from the second term without printing the first term as the printf statement is placed after calculating the next term in the series. So the value S must be printed before calculating the next term in the series.

Solution:

void printSeries(int S, int D, int T, char ch)
{
while(T > 0)
{
printf("%d ", S);
if(ch == 'A')
{
S += D;
}
else if(ch == 'G')
{
S *= D;
}
T--;
}
}

#### Same Positions Bit Count - AUTOMATA FIX

1 month ago

Problem - (ID 6439)

You are required to fix all logical errors in the given code. You can click on Run anytime to check the compilation/execution status of the program. You can use printf to debug your code. The submitted code should be logically/syntactically correct and pass all test cases. Do not write the main() function as it is not required.

Code Approach: For this question, you will need to correct the given implementation. We do not expect you to modify the approach or incorporate any additional library methods.

The function samePositionBitCount(int N1, int N2) accepts two integers N1 and N2 as the input. The function is supposed to return the count of bits which are equal in both the integers at the same positions.

The function compiles fine but fails to return the desired result due to logical errors.

Your task is to fix the program so that it passes all test cases.

Erroneous Code:

int samePositionBitCount(int N1, int N2)
{
int count = 0;
int N3 = N1 ^ N2;
int max = N1 > N2 ? N1 : N2;
while(N3 > 0)
{
if((N3 & 1) == 0)
{
count++;
}
max /= 2;
N3 /= 2;
}
return count;
}

Explanation:

Let 12 and 8 be the values of N1 and N2. So the value of N3 is N1 XOR N2 as given below,

1100 = 12 -> N1
1000 = 8  -> N2
----------
0100 = 4  -> N3

The count of zeroes in N3 gives the count of bits which are equal in the same positions.
The loop must run to check all the bits in N3 even if the leftmost bit in N3 (0100) is 0.
So the correct condition in the while loop must be,

while(max > 0)

Solution:

int samePositionBitCount(int N1, int N2)
{
int count = 0;
int N3 = N1 ^ N2;
int max = N1 > N2 ? N1 : N2;
while(max > 0)
{
if((N3 & 1) == 0)
{
count++;
}
max /= 2;
N3 /= 2;
}
return count;
}

#### COGNIZANT CTS AMCAT AUTOMATA FIX PROGRAMMING Latest Questions

1 month ago

COGNIZANT CTS AUTOMATA FIX PROGRAMMING QUESTIONS based on LATEST Drives

Error Correction Example Program:

Program 1) Fix Compilation Errors in multiplyNum function https://youtu.be/F7RRpBzcvLg
Program 2) countElements https://youtu.be/P_DJp7f1Qq4
Program 3) calculateSumOfOddElementsInMatrix https://youtu.be/4vD537GIZmI
Program 4) CTS Automata Fix Problem - Find Minimum Element https://youtu.be/OJB7Hbqwmkw
Program 5) CTS AUTOMATA FIX : drawPrintPattern with 1s  https://youtu.be/1HF-X-largg
Program 6) CTS AUTOMATA FIX : oddElements in Array in a new Array https://youtu.be/TeYFwWX_jjc
Program 7) CTS AUTOMATA FIX : removeElement in Array https://youtu.be/LcR5uJeEdzA
Program 8) Print sum of digits of elements in an Array https://youtu.be/eVn_Ldv6Hmw
Program 9) Printing 1 Pattern based on N in an Array https://youtu.be/z8-_c0cB-9Y
Program 10) getArraySum Logical Error https://youtu.be/njJfwPbneI0
Program 11) getPower negative values of Y https://youtu.be/IX_QRso7pzk
Program 12) manchester bits https://youtu.be/093XWG2o1eg
Program 13) character pattern printing https://youtu.be/9pL25oAuJlA
Program 14) Number Modulo Digits Count https://youtu.be/RWmxapZmW5g

#### Cognizant CTS LATEST TEST PATTERN for CAMPUS HIRING 2018-2019 Graduation Batch

1 month ago

Cognizant - CTS has revised it's campus hiring placement screening test pattern with the following sections.
1. Quantitative Aptitude (16 Questions - 16 Minutes)
2. Logical and Analytical Reasoning (24 Questions - 35 Minutes)
3. Verbal (22 Questions - 18 Minutes) (Includes Reading Comprehension)
4. AUTOMATA FIX (7 Questions - 20 Minutes) - NEWLY ADDED SECTION for 2019 Graduation Batch CAMPUS HIRING

Section 4: Automata Fix Coding
Cognizant has introduced a new coding module called AUTOMATA FIX in it's campus hiring screening test pattern.
The test will be delivered by Aspiring Minds (AMCAT). 5 questions will be of Error Rectification type and the remaining 2 questions will be of FIll in the Code (Using existing functions and completing the implementation logic type)

The following question types are available in AUTOMATA FIX.

Logical: The candidate is required to fix all logical errors in the given code. This checks the various logical concepts like conditions, looping etc.

Example Program 1: http://skillrack.com/solve/6426

Program 1) Fix Compilation Errors in multiplyNum function https://youtu.be/F7RRpBzcvLg
Program 2) countElements https://youtu.be/P_DJp7f1Qq4
Program 3) calculateSumOfOddElementsInMatrix https://youtu.be/4vD537GIZmI
Program 4) CTS Automata Fix Problem - Find Minimum Element https://youtu.be/OJB7Hbqwmkw
Program 5) CTS AUTOMATA FIX : drawPrintPattern with 1s  https://youtu.be/1HF-X-largg
Program 6) CTS AUTOMATA FIX : oddElements in Array in a new Array https://youtu.be/TeYFwWX_jjc
Program 7) CTS AUTOMATA FIX : removeElement in Array https://youtu.be/LcR5uJeEdzA
Program 8) Print sum of digits of elements in an Array https://youtu.be/eVn_Ldv6Hmw
Program 9) Printing 1 Pattern based on N in an Array https://youtu.be/z8-_c0cB-9Y
Program 10) getArraySum Logical Error https://youtu.be/njJfwPbneI0
Program 11) getPower negative values of Y https://youtu.be/IX_QRso7pzk
Program 12) manchester bits https://youtu.be/093XWG2o1eg
Program 13) character pattern printing https://youtu.be/9pL25oAuJlA
Program 14) Number Modulo Digits Count https://youtu.be/RWmxapZmW5g

Compilation:  Candidate needs to correct the syntax of the given code without changing it's logic.  This checks the candidate basic knowledge of syntax and language specific concepts.

Code reuse:  Candidate needs to complete the given code by reusing existing functions. This is a bit tougher than the logical and compilation based questions. The candidate is required to complete the code using the predefined structure or functions.

#### TCS NINJA Test Pattern 2018-2019 Batch

2 months ago

TCS Ninja test pattern for 2019 Batch students to be conducted in September 2018

MCQ - Section 1:
Session 1: Contains 20 questions related to Quantitative Aptitude, Reasoning (Duration 40 minutes). (This session will not be there for students who have got 75% in 10th, 12th and in their college. This is applicable only students from accredited colleges)
Session 2: Contains 10 questions related to English Verbal Reasoning and Proficiency (Duration 10 minutes).
Session 3: Contains 10 questions related to C programming proficiency (Duration 20 minutes)

Programming - Section 2:
Contains 1 Programming Challenge to be solved in 20 minutes.

#### Medals - When Gold, Silver and Bronze are awarded?

5 months ago

Bronze medals are awarded when the following tasks are fulfilled.
- 1 medal for solving a Daily Challenge
- 1 medal for scoring 40% or above in any MCQ Aptitude Test
- 2 medals for scoring 60% or above in any MCQ Aptitude Test
- 1 medal for posting approved solution in Discussion Forum
- 1 medal for posting approved Interview Experience in Discussion Forum
- 1 medal for posting approved On Campus Event in Discussion Forum
- 1 medal for solving a challenge in Programming Test
- 2 medals for completing a unit in Programming Course (Like C, Java & Python)
- 5 medals for completing a programming track (Set of 10 problems)
- 2 medals for completing a unit in Aptitude Course
- 1 medal for solving exactly one challenge in CPL Programming Test

Silver medals are awarded when the following tasks are fulfilled.
- 1 medal for solving exactly two challenges in CPL Programming Test

Gold medals are awarded when the following tasks are fulfilled.
- 1 medal for solving all three challenges in CPL Programming Test

More tasks will be added when new features are introduced or based on the feedback from users.

#### Reverse a String in Java

5 months ago

In this program we will reverse an input String and print the reversed String.

We will use StringBuilder to achieve the reversal.

import java.util.Scanner;

public class Hello {

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();

//We will reverse the String using StringBuilder.
StringBuilder sb=new StringBuilder(input);

//Now reverse the input value and print
System.out.println(sb.reverse().toString());

}
}

#### Program to print Fibonacci series in Java

5 months ago

In this article we will look at a Java program that will print Fibonacci series upto a certain number of terms using recursion.

The number of terms is passed as input.

import java.util.Scanner;

public class Hello {

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int termsCount = sc.nextInt();
int sum = 1, curr = 1;
System.out.println(curr);
fibonacci(curr, sum, termsCount);
}

private static void fibonacci(int curr, int sum, int remainingTerms) {
if (remainingTerms != 1) {
System.out.print(sum);
fibonacci(sum, curr + sum, remainingTerms - 1);
}
}
}

#### INFOSYS Test Pattern 2019 Batch - LATEST

5 months ago

INFOSYS Campus Hiring TEST Pattern (The campus hiring online test pattern has not been changed for the past 4 years. The latest Infosys pattern for 2018 - 2019 graduation batch is given below.

Test Duration: 95 minutes
Total Questions: 65
Sectional Cut-Off: Yes it is present
Negative Marking: No (There is no negative marking for all the three sections)

3 Sections in the test are
Section 1: Quantitative/CryptArithmetic/Analytical Puzzles: 10 questions in 35 minutes
Section 2: Logical/Analytical Reasoning : 15 questions in 25 minutes
Section 3: Verbal :  40 questions in 35 minutes.

But Infosys changes the question by preparing different question sets for each event. So while you will get the similar pattern of questions, it is difficult to get the exact questions repeated.

Section 1 Quantitative/CryptArithmetic/Analytical Puzzles Topics:
- Time Speed & Distance
- Crypt Arithmetic
- Percentages
- Profit & Loss
- Mensuration/Geometry
- Permutation & Combination
- One analytical puzzle where data is given and 3-4 questions are asked based on the given data.

Observation: 5-6 questions will be easy to solve. Remaining questions will be time consuming - particularly crypt arithmetic and the analytical puzzle questions.

Section 2 Logical/Analytical Reasoning Topics:
- Data Interpretation / Logical Puzzle
- Logically Following Options/ Syllogism questions modified in a different manner
- Data Suffiency

Observation: Easiest section to solve if you have practised similar type of questions earlier.

Section 3 Verbal Topics: