0% found this document useful (0 votes)
15 views9 pages

TCS Tech 9

The document contains a series of programming logic questions with their respective answers, covering topics such as output of code snippets, concepts of overloading destructors, dynamic memory allocation techniques, and data structures. Additionally, it includes coding tasks related to text processing and generating match schedules for a cricket league. Each question is followed by the correct answer option or output format as specified.

Uploaded by

Keerthikeshan
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)
15 views9 pages

TCS Tech 9

The document contains a series of programming logic questions with their respective answers, covering topics such as output of code snippets, concepts of overloading destructors, dynamic memory allocation techniques, and data structures. Additionally, it includes coding tasks related to text processing and generating match schedules for a cricket league. Each question is followed by the correct answer option or output format as specified.

Uploaded by

Keerthikeshan
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/ 9

Programming Logic

Q1.What would be the output of below code?

Type your answer here:

Answer: Apple Fruit11


Q2. Specify the precise answer for Overloading of destructor:
A. Partially Possible
B. Possible
C. Not Possible
D. None of the given options

Answer: Option C

Q3. Which of the following is not a technique of dynamic memory allocations?


A. dmalloc()
B. realloc()
C. calloc()
D. malloc()

Answer: Option A

Q4. When the given code is executed, what will be the output that is printed?

Enter your answer ONLY as a NUMERAL in the box.

Answer: 11

Q5. Match the pairs.

Real Time Usages Terms Best Suited underlined data


structures

A Network data mode 1


Tree

B Relational Database Management 2 Queue


System 3 Array

4 Graph

A. A-3, B-2
B. A-4, B-3
C. A-3, B-1
D. A-2, B-4

Answer: Option C

Q6. Which of the following statements about constructor is NOT true?


A. We can define more than one constructor with different signature in same class
B. We can overload constructor in derived class
C. Constructor has no return type
D. Constructor has the same name as the class name

Answer: Option B

Q7. Glass box testing is also known as


A. White Box Testing
B. Sanity Testing
C. Black Box Testing
D. Smoke Testing

Answer: Option A
Q8. Write the output for the below code.

A. NullPointerException
B. Error in Main Method
C. Advanced Java
D. Java EE

Answer: Option C

Q9. A bus conductor has a bunch of coins, each coin has a different value. New coins are added
at the end of the bunch. Only coins are issued to customers from the top side of the bunch.
Developer X wants to implement this in application by the help of data structure. Which data
structure is best suitable for implementation of current logic?
A. Queue
B. Graph
C. Stack
D. Tree

Answer: Option A

Q10. What is the full form of ROI in the context of Software development?
A. Return-on-investment
B. Rationality-of-internet
C. Reduction-of-investment
D. Rate-of-integration

Answer: Option A
Coding

Q1. Take a single line text message from the user. Separate the vowels from the text. Find the
repeating occurrences of vowels from the text message. Display count of which vowel has
repeated how many times.
Display a new Text message by removing the vowel characters as output.
Display the output in the exact format shown below in example, after displaying count of
characters on next lines display the new text message on next line. “Hll wlcm” is the new text
message.
If a text message entered by a user does not contain any vowels then display 0 as output. If a
text message entered by a user contains any numeric value then display 0 as output.
If User enters a blank or empty text message, display “INVALID INPUT” as output. Message
“INVALID INPUT” is case sensitive. Display it in the exact format given.

Example1:
Input:
Hello welcome
Output
a:0
e:3
i:0
o:2
u:0
Hll wlcm

Example2:
Input:
Hll wlcm
Output:
0

Solution in C++:
Q2. Indian Premier League IPL Cricket Matches are organized for a few Days. The problem is to
prepare a timetable from Day 1 to Day n, where n depends on the number of teams
participating. Set A represents the Names of Teams participating. Set A will be input from the
user. Do not show an input user message. Directly accept the team names as string values and
enter q to stop taking inputs.
Write code to display Pairing of Teams and possible number of matches possible excluding Semi
Final and Final.
Note: Minimum 3 Teams are required and maximum limit of Teams is 12.

Example1:
Input Values
CHENNAI
MUMBAI
KOLKATA
PATNA
Q

Output Values
TOTAL MATCHES:6
CHENNAI-VS-MUMBAI
CHENNAI-VS-KOLKATA
CHENNAI-VS-PATNA
MUMBAI-VS-KOLKATA
MUMBAI-VS-PATNA
KOLKATA-VS-PATNA
Solution in C++:

You might also like