0% found this document useful (0 votes)
51 views5 pages

Index Page - AC - I

The document outlines a series of programming experiments and tasks, each associated with specific problems to solve using various programming concepts. These tasks include determining character types, manipulating arrays, creating classes with specific attributes and methods, and implementing algorithms for common coding challenges. The document serves as a structured index for coding exercises, likely aimed at enhancing programming skills in C++.

Uploaded by

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

Index Page - AC - I

The document outlines a series of programming experiments and tasks, each associated with specific problems to solve using various programming concepts. These tasks include determining character types, manipulating arrays, creating classes with specific attributes and methods, and implementing algorithms for common coding challenges. The document serves as a structured index for coding exercises, likely aimed at enhancing programming skills in C++.

Uploaded by

s211056
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Index Page

Sl no. Date Experiment Remarks Signature


1 1. Given a letter X. Determine whether X is Digit
or Alphabet and if it is Alphabet determine if it is
Capital Case or Small Case.
Note:
Digits in ASCII '0' = 48,'1' = 49 ....etc
Capital letters in ASCII 'A' = 65, 'B' = 66 ....etc,
Small letters in ASCII 'a' = 97,'b' = 98 ....etc
2. Given two numbers X, Y which donate
coordinates of a point in 2D plan. Determine in
which quarter does it belong.
Note: Print Q1, Q2, Q3, Q4 according to the
quarter in which the point belongs to. Print
"Origem" If the point is at the origin. Print "Eixo
X" If the point is over X axis. Print "Eixo Y" if
the point is over Y axis.
3. Given a number N. Print 2 lines that contain the
following respectively:
a) Print N in a reversed order and not leading
zeroes.
b) If N is a palindrome number print "YES"
otherwise, print "NO.
2 1. Given an array of positive integers arr[], return
the second largest element from the array. If the
second largest element doesn't exist then return -1.
2. Given two numbers N and M, a 2D array A of
size N * M which contains 'x' or '.' only and two
numbers X, Y which donates a cell position in A
such that X is the row number and Y is the column
number. Determine whether all neighbors of the
given cell are 'x' or not.
3. Given an array A of size N. Print the array
elements after shifting all zeroes in array A to the
right.
3 1. You have to create a class, named Student,
representing the student's details like, age (int),
first_name (string), last_name (string) and
standard (int). and store the data of a student.
Create setter and getter functions for each
element, that is, the class should at least have
following functions:
 get_age, set_age
 get_first_name, set_first_name
 get_last_name, set_last_name
 get_standard, set_standard
Also, you have to create another
method to_string() which returns the string
consisting of the above elements, separated by a
comma(,).
2. Create a class named Student with the
following specifications:
 An instance variable scroes to hold a
student's 5 exam scores.
 A void input() function that
reads integers and saves them to scroes .
 An int calculateTotalScore() function
that returns the sum of the student's
scores.
3. Design a class named Box whose dimensions
are integers and private to the class. The
dimensions are labelled: length l , breadth b ,
and height h .
The default constructor of the class should
initialize l ,b , and h to 0 .
The parameterized constructor Box(int length,
int breadth, int height) should initialize Box's l,b
and h to length, breadth and height.
The copy constructor Box(Box B ) should set l,b
and h to B's l, b and h, respectively.
Apart from the above, the class should
have functions:
 int getLength() - Return box's length
 int getBreadth() - Return box's breadth
 int getHeight() - Return box's height
long long CalculateVolume() - Return the
volume of the box
4 1. Create class Triangle has a function called
triangle (). Now we create a class derived from
the base class Triangle called Isosceles. Create a
derived class object and use it to access the
functions of the base class. Write a function in
Isosceles class such that the output is as given
below.
I am an isosceles triangle.
In an isosceles triangle two sides are equal.
I am a triangle.
2. Create three classes Person,
Professor and Student. The class Person should
have data members name and age. The
classes Professor and Student should inherit
from the class Person.
The class Professor should have two integer
members: publications and cur_id. There will be
two member functions: getdata and putdata. The
function getdata should get the input from the
user: the name, age and publications of the
professor. The function putdata should print
the name, age, publications and the cur_id of the
professor.
The class Student should have two data
members: marks, which is an array of size 6 and
cur_id. It has two member
functions: getdata and putdata. The
function getdata should get the input from the
user: the name, age, and the marks of the student
in 6 subjects. The function putdata should print
the name, age, sum of the marks and the cur_id
of the student.
For each object being created of the Professor or
the Student class, sequential id's should be
assigned to them starting from 1.
3. Given an abstract base class Cache with
member variables and functions:
mp - Map the key to the node in the linked list
cp - Capacity
tail - Double linked list tail pointer
head - Double linked list head pointer
set() - Set/insert the value of the key, if present,
otherwise add the key as the most recently used
key. If the cache has reached its capacity, it
should replace the least recently used key with a
new key.
get() - Get the value (will always be positive) of
the key if the key exists in the cache, otherwise
return -1.
You have to write a class LRUCache which
extends the class Cache and uses the member
functions and variables to implement an LRU
cache.
5 1. Valid Parentheses:Given a
string s containing just the
characters '(', ')', '{', '}', '[' and ']', determine if the
input string is valid.
2. Intersection of Two Arrays: Given two
integer arrays nums1 and nums2, return an array
of their intersection. Each element in the result
must be unique and you may return the result in
any order.
3. Next Greater Element I:
You are given two distinct 0-indexed integer
arrays nums1 and nums2, where nums1 is a
subset of nums2.
Determine the next greater element of nums2[j]
in nums2. If there is no next greater element,
then the answer for this query is -1.
Return an array ans of length nums1.length such
that ans[i] is the next greater element.
6 1. Given an array A of size N. The elements of
the array consist of positive integers. You have
to find the largest element with minimum
frequency.
2. Given a list of N words. Count the number of
words that appear exactly twice in the list.
3. You are given two strings of the same
length s and t. In one step you can choose any
character of t and replace it with another
character. Return the minimum number of
steps to make t an anagram of s. (Leetcode
1347 )
7 1. Two Sum-II (Leetcode 167)
Return the indices of the two
numbers, index1 and index2, added by one such
that numbers[index1]+numbers[index2]=target.
2. Find the length of the non duplicates elements
in given integer array.(Leetcode 26)
3. Rotate Array(Leetcode 189)
Given an integer array nums, rotate the array to
the right by k steps, where k is non-negative.
8 1. Max Consecutive Ones II:
Given a binary array, find the maximum number
of consecutive 1s in this array if you can flip at
most one 0.
2. Longest Substring Without Repeating
Characters:
Given a string s, find the length of the longest
substring without duplicate characters.
3. Find All Anagrams in a String:
Given two strings s and p, return an array of all
the start indices of p's anagrams in s. You may
return the answer in any order.
9 1. Implement a C++ program to find the largest
prime factor of an integer.
2. Implement a C++ program to find the number
of prime numbers that are strictly less than n.
3. Total Chocolates-II: Find the sum of the all
distinct prime factors of each number in the
given array, for the given T no.of testcases
where each test case consist of number of
elements N , followed by N elements of the
array.
10 1. Implement a C++ program to find the
count of set bits in an integer.
2. Given an array of size of N , the elemtns of
the arry in the range 0-N . find the missing
number.
3. Given array of size 2*N+2, in which every
element repeat twice except 2. Find those two
non repeated numbers.
4. Implement a C++ program to count the
number of bits needed to be flipped to convert A
to B to check if it is a power of 2.

You might also like