0% found this document useful (0 votes)
9 views4 pages

NTT Data Coding & Aptitude Guide

Uploaded by

Bhavana Biradar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views4 pages

NTT Data Coding & Aptitude Guide

Uploaded by

Bhavana Biradar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

NTT DATA PRACTICE SHEET - PART 3 (Mixed

Coding + Aptitude Formulas + Tricks)

1. Check Armstrong Number


num = int(input("Enter number: "))
sum = 0
temp = num
while temp > 0:
digit = temp % 10
sum += digit ** 3
temp //= 10
print("Armstrong") if num == sum else print("Not Armstrong")

2. Fibonacci using Recursion


def fib(n):
if n <= 1:
return n
else:
return fib(n-1) + fib(n-2)

n = int(input("Enter terms: "))


for i in range(n):
print(fib(i), end=" ")

3. Find Factorial (Recursion)


def fact(n):
return 1 if n == 0 else n * fact(n-1)

num = int(input("Enter number: "))


print("Factorial:", fact(num))

4. Palindrome String
s = input("Enter string: ")
print("Palindrome") if s == s[::-1] else print("Not Palindrome")

5. Count Vowels in String


s = input("Enter string: ")
vowels = "aeiouAEIOU"
count = sum(1 for i in s if i in vowels)
print("Vowel Count:", count)
6. File Handling (Write & Read)
f = open("[Link]", "w")
[Link]("NTT Data Practice!")
[Link]()

f = open("[Link]", "r")
print([Link]())
[Link]()

7. List Comprehension Example


nums = [1,2,3,4,5]
squares = [x*x for x in nums]
print(squares)

8. Prime Number Check


n = int(input("Enter number: "))
if n > 1:
for i in range(2, int(n**0.5)+1):
if n % i == 0:
print("Not Prime")
break
else:
print("Prime")
else:
print("Not Prime")

9. Find Largest Element in List


nums = [10, 22, 5, 75, 65]
print("Largest:", max(nums))

10. Remove Duplicates from List


nums = [1,2,2,3,4,4,5]
print(list(set(nums)))

11. Reverse Words in Sentence


s = "NTT Data Online Assessment"
print(' '.join(reversed([Link]())))

12. Dictionary Sorting by Value


data = {'a':3, 'b':1, 'c':2}
sorted_data = dict(sorted([Link](), key=lambda x:x[1]))
print(sorted_data)
13. Check Leap Year
y = int(input("Enter year: "))
print("Leap Year") if (y%4==0 and (y%100!=0 or y%400==0)) else print("Not Leap Year")

14. Sum of Digits (Loop)


n = int(input("Enter number: "))
sum = 0
while n > 0:
sum += n % 10
n //= 10
print("Sum:", sum)

15. Find Second Largest Element


nums = [10, 20, 4, 45, 99]
[Link]()
print("Second Largest:", nums[-2])

16. Using Lambda Function


add = lambda a,b: a+b
print(add(5,10))

17. Regex: Validate Email


import re
email = input("Enter email: ")
pattern = r'^[a-z0-9]+@[a-z]+\.[a-z]{2,3}$'
print("Valid") if [Link](pattern, email) else print("Invalid")

18. Count Words in Sentence


s = input("Enter sentence: ")
print("Word Count:", len([Link]()))

19. OOP Example (Class & Object)


class Car:
def __init__(self, brand):
[Link] = brand

def show(self):
print("Car Brand:", [Link])

c = Car("BMW")
[Link]()

20. Swap Two Numbers (Without Temp)


a,b = 5,10
a,b = b,a
print(a,b)

APTITUDE FORMULAS & TRICKS


• **Simple Interest (SI)** = (P × R × T) / 100
• **Compound Interest (CI)** = P × (1 + R/100)^T - P
• **Speed, Distance, Time** → S = D/T
• **Average Speed** = (2xy)/(x+y)
• **Percentage Change** = ((New - Old)/Old) × 100
• **Profit %** = (Profit / Cost Price) × 100
• **Loss %** = (Loss / Cost Price) × 100
• **Alligation Rule:** (High - Mean) : (Mean - Low)
• **Work Formula:** (A × B) / (A + B) for combined work rate.
• **Permutations:** nPr = n! / (n−r)!
• **Combinations:** nCr = n! / (r! (n−r)!)
• **Clock Angle Formula:** θ = |30H − (11/2)M|

LOGICAL REASONING & MEMORY TIPS


1. Read the question twice before solving – trick words like “not” or “except” are common traps.
2. For sequence/pattern questions, note **differences** between numbers.
3. Blood relations: Start from the **reference person** and trace step by step.
4. Direction sense: Assume facing North; rotate based on left/right turns.
5. Syllogisms: Use Venn diagrams mentally.
6. For puzzles, create a **table/chart** to visualize.
7. Practice with a timer — many OA tests are about **speed + accuracy**.
8. Take deep breaths before starting coding sections — panic ruins logic.
9. During MCQs, **eliminate wrong choices first** — 50% success by elimination.
10. If stuck in coding — write logic in plain English first, then convert line by line.

You might also like