InfyTQ is an online certification and recruitment exam conducted by Infosys for engineering students. It assesses candidates on programming, database management, and aptitude skills. This article covers commonly asked InfyTQ questions along with detailed solutions and explanations.
The InfyTQ exam consists of the following sections:
Problem Statement: Write a program to find the second largest number in an array without sorting.
Solution in Python:
def second_largest(arr):
first, second = float('-inf'), float('-inf')
for num in arr:
if num > first:
second, first = first, num
elif num > second and num != first:
second = num
return second if second != float('-inf') else "No second largest element"
arr = [10, 20, 4, 45, 99]
print("Second Largest Number:", second_largest(arr))
Explanation:
first
and second
) to store the largest and second-largest numbers.Feature | Primary Key | Unique Key |
---|---|---|
Uniqueness | Ensures unique values | Ensures unique values |
NULL Values | Not Allowed | Allowed |
Number of Keys | Only one per table | Multiple unique keys allowed |
Usage | Used to uniquely identify a record | Used for uniqueness but not as an identifier |
Example:
CREATE TABLE Students (
StudentID INT PRIMARY KEY,
Email VARCHAR(50) UNIQUE,
Name VARCHAR(50)
);
Problem Statement: A and B together can complete a task in 10 days. A alone can complete the work in 15 days. In how many days can B alone complete the work?
Solution:
Identify the incorrect part of the sentence:
“Each of the boys in the class are responsible for keeping their desk clean.”
Answer: “are” should be replaced with “is”
Corrected Sentence: “Each of the boys in the class is responsible for keeping their desk clean.”
Explanation:
Practicing InfyTQ questions on programming, DBMS, aptitude, and verbal ability can significantly improve your chances of success. Keep practicing coding problems, SQL queries, and aptitude questions to strengthen your preparation.
For more such InfyTQ questions and solutions, stay tuned!