student notes / est. for the classroom

HTML, CSS, JavaScript, Python, data science, computer networks — written the way you'd explain it to a classmate, not a compiler.

Top Job & Internship Portals

Handpicked portals for fresher jobs, tech roles, and listings in Hyderabad

GFG

GeeksforGeeks

Tech & Software Roles

Visit →
INT

Internshala

Fresher Jobs & Internships

Visit →
GOOG

Google Careers

Global Google Openings

Visit →
APN

Apna Jobs

Local Jobs in Hyderabad

Visit →
INS

Instahyre

Tech Roles in Hyderabad

Visit →
NAUK

Naukri.com

Fresher Jobs in Hyderabad

Visit →
📢 Updated daily

Internship & Job Alerts

01

Latest notes

July 24, 2026

TCS NQT questions

 

1. Find Nth term in mixed Fibonacci + Prime series

Question:
The series is:

1, 2, 1, 3, 2, 5, 3, 7, 5, 11, 8, 13, ...

Odd positions form Fibonacci series and even positions form prime numbers. Find the Nth term.

Example:

Input:
14

Output:
17

Python:

def is_prime(n):
    if n < 2:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

n = int(input())

fib = [1, 1]
while len(fib) < n:
    fib.append(fib[-1] + fib[-2])

primes = []
num = 2
while len(primes) < n:
    if is_prime(num):
        primes.append(num)
    num += 1

if n % 2 == 1:
    print(fib[n//2])
else:
    print(primes[n//2 - 1])



. Generate Alternate Geometric Series

Question:
Given a series where odd positions and even positions create separate geometric progressions.

Example:

Input:
5

Output:
1 1 2 2 4 4 8 8 16 16

Python:

n = int(input())

a = 1
result = []

for i in range(n):
    result.append(a)
    result.append(a)
    a *= 2

print(*result)

3. Check Anagram of Two Strings

Question:
Check whether two strings are anagrams.

Example:

Input:
abaac
aabca

Output:
True

Python:

s1 = input()
s2 = input()

if sorted(s1) == sorted(s2):
    print("True")
else:
    print("False")

4. Remove Consecutive Duplicate Digits

Question:
Remove repeated consecutive digits.

Example:

Input:
11223345

Output:
12345

Python:

s = input()

ans = s[0]

for i in range(1, len(s)):
    if s[i] != s[i-1]:
        ans += s[i]

print(ans)

5. Find Element Appearing Only Once

Question:
Given an array where every element appears twice except one element, find that element.

Example:

Input:
5
1 2 3 2 1

Output:
3

Python:

n = int(input())
arr = list(map(int,input().split()))

x = 0

for i in arr:
    x ^= i

print(x)

6. Matrix Trace

Question:
Find the trace of a square matrix.

Example:

Input:
3
1 2 3
4 5 6
7 8 9

Output:
15

Python:

n = int(input())

matrix = []

for _ in range(n):
    matrix.append(list(map(int,input().split())))

trace = 0

for i in range(n):
    trace += matrix[i][i]

print(trace)

7. Merge Two Arrays Alternately

Question:
Merge two arrays by taking alternate elements. Add remaining elements from the larger array.

Example:

A = [1,2,3]
B = [4,5,6,7]

Output:
1 4 2 5 3 6 7

Python:

a = list(map(int,input().split()))
b = list(map(int,input().split()))

result = []

i = j = 0

while i < len(a) and j < len(b):
    result.append(a[i])
    result.append(b[j])
    i += 1
    j += 1

result.extend(a[i:])
result.extend(b[j:])

print(*result)

8. Count Frequency of Characters

Question:
Find the frequency of each character in a string.

Example:

Input:
banana

Output:
b:1 a:3 n:2

Python:

s = input()

freq = {}

for ch in s:
    freq[ch] = freq.get(ch,0)+1

for k,v in freq.items():
    print(k,":",v)

9. Second Largest Number

Question:
Find the second largest element without sorting.

arr = list(map(int,input().split()))

largest = second = float('-inf')

for x in arr:
    if x > largest:
        second = largest
        largest = x
    elif x > second and x != largest:
        second = x

print(second)

10. Sum of Digits Until Single Digit

Example:

Input:
9875

9+8+7+5 = 29
2+9 = 11
1+1 = 2

Output:
2

Python:

n = int(input())

while n >= 10:
    s = 0
    while n:
        s += n % 10
        n //= 10
    n = s

print(n)

Important topics to prepare for TCS NQT Python:

  • Arrays and strings
  • Hashing/frequency counting
  • Number theory (prime, palindrome, factors)
  • Matrix problems
  • Sorting/searching
  • Basic recursion
  • Stack and queue implementation
  • Pattern/series problems












No comments:

Post a Comment

02

Capstone resource hub

Codingacharya

Capstone Learning Resources, Notes & Project Hub

TCS NQT Questions
Read Notes
Machine Learning – ACE Theory
Read Notes
Machine Learning PPT
Read Notes
MachienLearning LAB
Read Notes
CSPT LAB programs
Read Notes
Time table and CSPT syllabus
Read Notes
Appreciations
Read Notes
ISTE life memberships
Read Notes
Artificial Intelligence & Analytics
Read Notes
Fullstack Web Dev
Read Notes
MERN Web Dev
Read Notes
Course Structure
Read Notes
Cloud Computing
Read Notes
90 Days ML Challenge
Read Notes
Advanced Analytics & Viz
Read Notes
Advanced Machine Learning
Read Notes
React JS
Read Notes
ML Chaitanya
Read Notes
Important Links
Read Notes
CSS Effects
Read Notes
RESUME
Read Notes
Bootstrap CSS
Read Notes
MongoDB
Read Notes
OWN Python Package
Read Notes
HTML Course
Read Notes
HTML Projects
Read Notes
GitHub Projects
Read Notes
Angular JS
Read Notes
Journals
Read Notes
NLP Notes
Read Notes
Videos
Read Notes
Data Analytics & Viz
Read Notes
Cloud Computing (Archive)
Read Notes
Open CV
Read Notes
jQuery
Read Notes
React JS (Archive)
Read Notes
Node JS
Read Notes
DAV Theory
Read Notes
DAV Lab
Read Notes
Big Data Notes
Read Notes
R-Programming
Read Notes
HADOOP Lab
Read Notes
GATE DA
Read Notes
JAVA Lab
Read Notes
Computer Networks
Read Notes
03

Live projects & profiles