InfyTQ-Solutions

Solutions to infytq assignments, quiz and tests., updates/announcements:.

Uploaded my Data Structures File in this Repo. It was amazingly useful for quick revision during my Power Programmer Interview Preparation.

Hey there everyone!

Glad to have you here. Looking for resources for InfyTQ? Well, you are at the right place.

I am Omkar Deshpande and this is my github repo consisting of all the solutions to InfyTQ. I prepared this while I was preparing for InfyTQ exam back in June 2019. I always had to go back and check my solutions for revision, so instead thought to make a github repo, which is mobile handy and can also be used by others looking for a reference.

I would soon be uploading a blog on how I was able to crack the Power Programmer Interview and got selected for a Power Programmer Role at Infosys. I would mention all the resources used. Remember, the best resource available is your will-power! Donot rely on any paid courses or online services, and work on yourself every single day with consistency, and I am sure you would land at your dream job!

Further, I request you to please also update me the changes/incorrect/updations in this Solutions Repository. I would love to include your solutions/alternatives within this repo. Lets make this repo more and more generalised for the students preparing on InfyTQ platform.

General Information on InfyTQ

InfyTQ is a free platform open to all engineering students in their third and fourth year across India. The platform encourages holistic development by imparting technical as well as professional skills and help them become industry ready.

I started this course on June 15th 2019 . The platform consists of various assignments with rising difficulty levels.

I am presenting my solutions to all the assignments in the InfyTQ platform.

So go ahead and fork this repo and include your efficient solutions!

https://infytq.infosys.com - automatic! InfyTQ

Would love to include your solutions into this repo!

Happy reviewing! :octocat:

Codersdaily-logo

  • Create Account

Codersdaily-logo

Book a FREE live class. NOW!

Fill your details and select a date for your live class

infosys java assignment solutions github

  • 7 months, 1 week ago

Infosys Java Interview Questions and Answers

Explore a comprehensive collection of Java interview questions and answers tailored for Infosys, a leading global consulting and information technology services company. These curated interview questions cover a wide range of Java topics, from core concepts to advanced topics, providing aspiring candidates with a valuable resource to prepare for their Infosys Java interviews.

Q1.  How to submit exceptions from child to parent in Java?

Ans: In Java, exceptions are not directly "submitted" or transferred from a child class to a parent class. However, you can achieve a similar effect by allowing the exception to propagate up the call stack until it reaches a suitable exception handler. This typically involves catching the exception in the child class and then rethrowing it or allowing it to propagate up to a higher level.

Here's a simple example:

In this example, the Child class overrides the performOperation method from the Parent class. When an exception occurs in the parent class, it catches the exception, calls handleException to handle it, and then continues execution.

The Child class can catch the exception thrown by the parent class, perform additional handling if necessary, and then rethrow the exception or let it propagate further up the call stack.

Remember that this approach works for checked exceptions as well. Ensure that the exception types match or are compatible between the parent and child classes.

Q2.  What is an Optional class in Java?

Ans: The Optional class in Java is a container class that may or may not contain a non-null value. It was introduced in Java 8 as part of the java.util package to help alleviate the problem of dealing with null values and NullPointerExceptions. The primary goal of Optional is to provide a more expressive way to represent and handle the absence of a value.

Here are some key points about the Optional class:

1. Avoiding Null:

  • Optional is designed to encourage the avoidance of null references. Instead of returning a null to signify the absence of a value, a method can return an Optional instance.

2. Creation of Optional:

  • Optional.of(value) : Creates an Optional containing the specified non-null value.
  • Optional.ofNullable(value) : Creates an Optional containing the specified value, or an empty Optional if the value is null .
  • Optional.empty() : Creates an empty Optional .

3. Accessing the Value:

  • You can use methods like get , orElse , orElseGet , and orElseThrow to access the value inside the Optional or provide a default value or action if the value is absent.

4. Avoiding NullPointerExceptions:

  • Using Optional helps in writing more expressive and concise code that avoids accidental NullPointerExceptions caused by attempting to access methods or fields on null references.

5. Chaining Methods:

  • Optional provides methods like map , flatMap , and filter that allow you to chain operations on the value inside the Optional in a more functional programming style.

It's important to use Optional judiciously and not overuse it. It's generally recommended for method return types and not as a replacement for all uses of null . Additionally, be cautious when using get() without checking if a value is present, as it can lead to a NoSuchElementException .

Q3.  Difference between @RestController and @Controller.

Ans: In Spring Framework, @Controller and @RestController are annotations used to define classes as controllers, but they serve different purposes and are used in different contexts.

1. @Controller:

  • @Controller is a traditional Spring MVC controller annotation used to define a class as a controller. It is typically used for creating web applications following the Model-View-Controller (MVC) architectural pattern.
  • Controllers annotated with @Controller are capable of handling HTTP requests and returning views. They often have methods annotated with @RequestMapping to map specific URLs to controller methods.
  • The methods in a @Controller class return a view name or a ModelAndView object, and the view resolution is handled by the Spring MVC view resolver.

2. @RestController:

  • @RestController is a specialized version of @Controller introduced in Spring 4.0. It is specifically designed for building RESTful web services. The @RestController annotation combines the @Controller and @ResponseBody annotations.
  • Controllers annotated with @RestController return the data directly as the HTTP response body. The response is often serialized to JSON or XML, and there is no view resolution involved. Each method in a @RestController class is annotated with @RequestMapping or other request mapping annotations.
  • @Controller is used for traditional web applications and is suitable for handling requests where views need to be rendered.
  • @RestController is used for building RESTful web services, where the response is typically in the form of data (JSON or XML) rather than a rendered view.
  • @RestController is a specialization of @Controller with the addition of @ResponseBody on every method, making it convenient for building RESTful APIs.

In summary, choose @Controller when building web applications with views, and use @RestController when building RESTful web services that return data directly in the response body.

Q4.  Differentiate between HashMap and HashTable.

Ans: Here's a comparison of HashMap and Hashtable in tabular form:

Feature

HashMap

Hashtable

Synchronization

Not synchronized by default. Can be synchronized externally using Collections.synchronizedMap().

Synchronized by default. All methods are synchronized.

Null Values

Allows null values for both keys and values.

Neither keys nor values can be null.

Performance

Generally better performance due to lack of synchronization. Preferred for single-threaded or low-concurrency scenarios.

Performance can degrade in high-concurrency scenarios due to synchronization.

Iterators

Fail-fast iterators. If the map is modified structurally while an iterator is in progress, it throws ConcurrentModificationException.

Fail-fast iterators.

Example Usage:

Recommendations:

  • Use HashMap when synchronization is not needed, or when external synchronization is acceptable.
  • For new code and in scenarios requiring concurrent access, consider using ConcurrentHashMap or Collections.synchronizedMap(new HashMap<>()) for better performance and flexibility.

If you need a synchronized map and are working with legacy code, Hashtable can be used.

Q5.  When to use interface and when to use abstract class?

Ans: The choice between using an interface and an abstract class in Java depends on the specific requirements and design goals of your application. Here are some considerations to help you decide when to use an interface and when to use an abstract class:

Use Interface When:

1. Multiple Inheritance:

  • Java supports multiple inheritance through interfaces, allowing a class to implement multiple interfaces.
  • If a class needs to inherit behaviors from multiple sources, interfaces are a suitable choice.

2. Contract without Implementation:

  • Interfaces allow you to define a contract (method signatures) without providing an implementation.
  • Useful when you want to ensure that multiple classes adhere to a specific set of methods without dictating the implementation details.

3. Encapsulation:

  • Interfaces help achieve better encapsulation by separating the definition of methods from the details of their implementation.
  • Implementing classes can provide their own implementation details while adhering to the interface contract.

4. Loose Coupling:

  • Using interfaces promotes loose coupling between classes. Classes that interact through interfaces are less dependent on each other's internal details.

5. API Design:

  • Interfaces are often used to design APIs (Application Programming Interfaces) where you want to provide a set of functionalities that can be implemented by different classes.

Use Abstract Class When:

1. Common Base Class:

  • If you have a common base class that contains shared implementation details, use an abstract class.
  • Abstract classes can provide a mix of abstract (unimplemented) and concrete (implemented) methods.

2. Code Reusability:

  • Abstract classes support code reusability by allowing the reuse of common implementation across multiple subclasses.
  • Subclasses can inherit both state (fields) and behavior (methods) from the abstract class.

3. Constructors:

  • Abstract classes can have constructors, allowing you to perform common initialization tasks when an object is created.
  • Constructors in interfaces were introduced in Java 9 but are not as flexible as those in abstract classes.

4. Partial Implementation:

  • Abstract classes can have both abstract and concrete methods, providing a partial implementation that subclasses can choose to override or inherit.

5. Access Modifiers:

  • Abstract classes can have access modifiers on their fields and methods, allowing better control over the visibility of members.

Guidelines:

  • If you need to provide a common base class, share code, or define some common state, use an abstract class.
  • If you want to define a contract for classes to implement without providing any shared implementation, use an interface.
  • In some cases, a combination of both interfaces and abstract classes may be appropriate for a flexible and extensible design.

Q6.  How to declare a class as static in java?

Ans: In Java, you cannot declare a top-level class (i.e., a class directly within a package) as static . The static keyword is used for class members (fields and methods) and nested classes within another class. Here's how you can use static within a class:

1. Static Nested Class:

  • A static nested class is a nested class that is declared with the static keyword.
  • It can be accessed using the enclosing class name.

2. Static Methods and Fields:

  • You can declare methods and fields as static within a class.
  • These methods and fields belong to the class itself, not to instances of the class.

3. Static Initialization Block:

  • You can use a static initialization block to perform actions when the class is loaded.
  • The static block is executed when the class is first loaded, and it runs only once.

Remember, the static keyword is not used to declare top-level classes. Top-level classes are implicitly static in the sense that they can be accessed without creating an instance of the enclosing package. If you need to group related classes, consider using packages or inner classes within another class.

Q7.  Can we make the constructor private?

Ans: Yes, you can make a constructor private in Java. Making a constructor private is a common practice when you want to enforce a certain design pattern, such as the Singleton pattern, or when you want to create utility classes that should not be instantiated.

Here's an example of a private constructor:

In this example, the constructor private MyClass() is not accessible from outside the class, so you cannot create an instance of MyClass using new MyClass() . However, you can still use other methods or static members of the class.

As mentioned earlier, one common use case for private constructors is the Singleton pattern, where you want to ensure that only one instance of the class can be created. Here's an example of a Singleton class with a private constructor:

In this Singleton pattern, the only way to obtain an instance of Singleton is through the static method getInstance() . The private constructor ensures that no other class can directly instantiate it.

Q8.  Write a program for string reversal eg. if input is “abcd” then output should be: dcba.

Ans: Certainly! You can reverse a string in Java using various approaches. Here's a simple program using the StringBuilder class:

In this example, the reverseString method takes an input string, converts it to a StringBuilder , reverses it using the reverse() method, and then converts it back to a string using toString() .

You can run this program, and the output should be:

Q9.  Why do we use enum when constants are there?

Ans: Enums in Java provide a way to represent a fixed set of constants with more structure and type-safety compared to using plain constants. Here are some reasons why you might prefer enums over plain constants:

1. Type Safety:

  • Enums are types, which means they provide type safety. You can't accidentally assign a value that doesn't belong to the set of constants defined in the enum.
  • With plain constants, you might use primitive data types or strings to represent constants, and mistakes can occur due to typos or incorrect assignments.

2. Readability and Expressiveness:

  • Enums can make your code more readable by providing meaningful names for constant values.
  • Enums can be used to represent a set of related constants, making the code more expressive.

3. Grouping Related Constants:

  • Enums allow you to group related constants together in a single type.
  • This helps in organizing constants and provides a clear structure to your code.

3. Iterating Over Constants:

  • Enums can be easily iterated over using the values() method, which is useful in scenarios where you need to perform operations on all constants.

4. Switch Statements:

  • Enums work well with switch statements. Switching on enums is more readable and less error-prone than switching on integer or string constants.

5. Adding Methods and Behavior:

  • Enums can have methods and behavior associated with them, allowing you to attach functionality to each constant.
  • Plain constants are usually just static final fields without the ability to include behavior.

In this example, the Day enum represents days of the week, and it includes a method isWeekend() to check if a given day is a weekend. Enums provide a more structured way to represent and work with constants in this scenario.

Q10.  Find length of longest substring.

Ans: To find the length of the longest substring without repeating characters, you can use the sliding window approach. Here's a Java program that demonstrates how to achieve this:

This program defines a function lengthOfLongestSubstring that takes a string as input and returns the length of the longest substring without repeating characters. The sliding window is represented by the variables left and right , and a HashMap is used to store the index of each character.

You can change the value of the input variable to test the function with different strings. In the provided example, the input is "abcabcbb", and the output will be:

This means that the longest substring without repeating characters in "abcabcbb" is "abc"

Add a comment:

Latest posts.

Image

Top 50 Interview Questions on MS SQL Sever

May 7, 2024, 9:27 a.m.

Image

Top 40 MongoDB Interview Questions for 2024 with Answers

May 2, 2024, 12:03 p.m.

Image

Mastering the HR Interview: Top 10 Questions for IT Job Roles

May 1, 2024, 12:33 p.m.

Image

Top 10 Power BI Projects for Data Analytics Enthusiasts

April 30, 2024, 8:30 a.m.

Image

Top 30 PowerBi interview questions with answers 2024

April 29, 2024, 2:11 p.m.

Image

Top 50 Python Interview Questions with Answers 2024

April 25, 2024, 12:22 p.m.

infosys java assignment solutions github

  • What is Software Development
  • Agile Software Development
  • Software Developer
  • SDE Roadmap
  • SDE Interview Guide
  • SDE Companies
  • Types of Software Development
  • Learn Product Management
  • Software Engineering Tutorial
  • Software Testing Tutorial
  • Project Management Tutorial
  • Agile Methodology
  • Selenium Basics
  • Infosys Coding Sheet
  • Aptitude Ability
  • Verbal Ability
  • Computer Subjects
  • Computer Network
  • Database and Management System
  • OOPS Concepts
  • Data Structure and Algorithms
  • Easy Coding Problems
  • Medium Coding Problems
  • Hard Coding Problems

Infosys SDE Sheet

Infosys Limited is a multinational IT company based in India that offers business consulting, IT, and outsourcing services. It was founded in Pune and its headquarter is in Bangalore. Infosys is India’s second-largest IT company and many students dream to work at Infosys. This sheet consists of all the common interview questions and answers based on fundamental concepts and advanced topics to assist you to land a job at Infosys.

Infosys-SDE-Sheet

Top Infosys Coding Questions:

Below is the list of most commonly asked Infosys Coding Questions:

Easy Coding Questions:

Solve

Medium Coding Questions:

Solve

Solve

Solve

Hard Coding Questions:

Solve

Solve

Solve


Please Login to comment...

Similar reads.

  • Company SDE Sheet
  • interview-questions
  • Interview Questions
  • Software Development

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

Time in Elektrostal , Moscow Oblast, Russia now

The clock will update automatically if you turn on javascript in your browser..

  • Tokyo 00:04
  • Beijing 23:04
  • Paris 17:04
  • London 16:04
  • New York 11:04
  • Los Angeles 08:04

Time zone info for Elektrostal

  • Elektrostal does not change between summer time and winter time.
  • The IANA time zone identifier for Elektrostal is Europe/Moscow.

Time difference from Elektrostal

10 hours10 hours
8 hours8 hours
7 hours7 hours
7 hours7 hours
6 hours6 hours
3 hours3 hours
2 hours2 hours
2 hours2 hours
1 hours1 hours
1 hours1 hours
1 hours1 hours
0
0
0
+1 hours
+2.5 hours
+5 hours
+5 hours
+5 hours
+6 hours
+7 hours

Sunrise, sunset, day length and solar time for Elektrostal

  • Sunrise: 03:48
  • Sunset: 21:14
  • Day length: 17h 26m
  • Solar noon: 12:31
  • The current local time in Elektrostal is 31 minutes ahead of apparent solar time.

Elektrostal on the map

  • Location: Moscow Oblast, Russia
  • Latitude: 55.79. Longitude: 38.46
  • Population: 144,000

Best restaurants in Elektrostal

  • #1 Tolsty medved - Steakhouses food
  • #2 Ermitazh - European and japanese food
  • #3 Pechka - European and french food

Find best places to eat in Elektrostal

  • Best restaurants with desserts in Elektrostal
  • Best dinner restaurants in Elektrostal
  • Best fast food restaurants in Elektrostal

The 50 largest cities in Russia

infosys java assignment solutions github

  • Internships New

InfyTQ - Java Coding Questions

Sanket Mishra

Sanket Mishra

Coding comprises 60% of the total weightage in the InfyTQ examination. If you are thoroughly prepared with the coding part then the chances of cracking the exam increase significantly as the cutoff is 65%.

Practice InfyTQ exam with Edyst Special Test Prep. Pack! Try 1 Free Module!

infosys java assignment solutions github

In this article, we will be discussing some previous coding questions that have been asked in the InfyTQ examination. This will give you an idea of the pattern of the questions asked.

To know the pattern and syllabus of the InfyTQ examination check our previous article on How to Prepare for the Infytq Examination?

Here are some of the Java coding questions that have been asked in previous years.

QUESTION 1:

Input: Given a list of numbers separated with a comma.The numbers 5 and 8 are present in the list.

Assume that 8 always comes after 5.

Case 1: num1 -> Add all numbers which do not lie between 5 and 8 in the Input List.

Case 2: num2 -> Numbers formed by concatenating all numbers from 5 to 8 in the list

.Output: Sum of num1 and num2

Example: 3,2,6,5,1,4,8,9

Num1: 3+2+6+9 =20

Num2: 5148O/p=5148+20 = 5168

Solution in Java

Question 2:.

A string which is a mixture of letters, numbers, and special characters from which produce the largest

even number from the available digit after removing the duplicates digits.

If an even number did not produce then return -1.

Ex: infosys@337

— — — — — — — — — — — -

Hello#81@21349

O/p : 984312

QUESTION 3:

Take input a number ’N’ and an array as given below.

Input:-N = 2

Array =1,2,3,3,4,4

Find the least number of unique elements after deleting N numbers of elements from the array.

In the above example, after deleting N=2 elements from the array.

In above 1,2 will be deleted.

So 3,3,4,4 will be remaining so,

2 unique elements are in the array i.e 3 and 4.

QUESTION 4:

A non-empty string containing only alphabets. print the longest prefix from the input string which is the same as the suffix.

Prefix and Suffix should not be overlapped.

Print -1 if no prefix exists which is also the suffix without overlap.

Do case-sensitive comparison.

Positions start from 1.

Input : xxAbcxxAbcxx

o/p: xx (‘xx’ in the prefix and ‘xx’ in the suffix and this is the longest one in the input string so the output will be ‘xx’).

Input: Racecar

o/p: -1 (There is no prefix which is also a suffix so the output will be -1).

QUESTION 5:

Number of odd sub-arrays.

Find the number of distinct subarrays in an array of integers such that the sum of the subarray is an odd integer, two subarrays are considered different if they either start or end at different indexes.

Explanation : Total subarrays are [1], [1, 2], [1, 2, 3], [2], [2, 3], [3]

In this there are four subarrays which sum is odd i.e: [1],[1,2] ,[2,3],[3].

The questions asked are of medium difficulty and can be easily solved if you practice well. Practice on Complete Coding Test & Interview Preparation Pack to succeed at Coding rounds at companies like TCS (Ninja), Wipro, Infosys, Mindtree, ValueLabs, CGI, and many more.

W hen you practise, you get better. It’s very simple .

We hope you find this piece of writing helpful in any way possible.

Wanna drop us some suggestions & ideas to write articles on? Write to us @ [email protected]

Visit Edyst Website — www.edyst.com

Visit Edyst YouTube Channel — www.youtube.com/edyst

Visit Edyst Instagram Page- www.instagram.com/edystme/

Visit Edyst Telegram Channel- t.me/edystannouncements

About Edyst:

We are an online learning destination for aspiring software developers to get ready for the most in-demand job.

Check Edyst Most Popular Courses:

- Full Stack Web Developer Bootcamp

- Adv. Algorithms and Data Structures Bootcamp

- Python Programming: Intro + Advanced

- Java Programming: Intro + Advanced

- Complete Coding Test and Preparation Pack

- Wipro Elite NLTH 2021 Test Pack

Blog Author Image

Sanket is currently pursuing B.tech in Information Technology and loves to solve real-life problems through coding. He loves doing competitive programming & has also worked as a Content Creator Intern in many companies.

infosys java assignment solutions github

Company Preparation Pack

Try past year questions of companies of Accenture, Wipro, Cognizant, EPAM, Mintree, Capgemini.

Crack exams like TCS Ninja NQT, TCS Digital, Infosys HackWithInfy, Hexaware, Infosys Infy TQ, TCS CodeVita.

Try our Free Pack

See more companies

infosys java assignment solutions github

Basics Of Java

Enroll with the best online training institute, offering quality courses to fulfill your Basic Of Java needs, be it entry level or at an expert level!!

Latest posts

Weather App Application Project Using Python [2023]

Weather App Application Project Using Python [2023]

Book Query Application Project Using Python [2023]

Book Query Application Project Using Python [2023]

How FTX crashed and how FTX went from the 3rd largest cryptocurrency to bankruptcy in 2022?

How FTX crashed and how FTX went from the 3rd largest cryptocurrency to bankruptcy in 2022?

How to prepare for technical interview questions in 2023

How to prepare for technical interview questions in 2023

Instantly share code, notes, and snippets.

@rayanfer32

rayanfer32 / allSolutions.py

  • Download ZIP
  • Star ( 1 ) 1 You must be signed in to star a gist
  • Fork ( 0 ) 0 You must be signed in to fork a gist
  • Embed Embed this gist in your website.
  • Share Copy sharable link for this gist.
  • Clone via HTTPS Clone using the web URL.
  • Learn more about clone URLs
  • Save rayanfer32/8487cbdf8e38cb754308217284acf696 to your computer and use it in GitHub Desktop.
#DSA-Assgn-1
def merge_list(list1, list2):
merged_data=""
list3=list()
#write your logic here
list2.reverse()
for i in range((len(list2))):
if list2[i] is not None:
merged_data+="%s%s "%(list1[i],list2[i])
else:
merged_data+="%s "%(list1[i])
resultant_data=merged_data
return resultant_data
#Provide different values for the variables and test your program
list1=['A', 'app','a', 'd', 'ke', 'th', 'doc', 'awa']
list2=['y','tor','e','eps','ay',None,'le','n']
merged_data=merge_list(list1,list2)
print(merged_data)
#DSA-Assgn-2
class Car:
def __init__(self,model,year,registration_number):
self.__model=model
self.__year=year
self.__registration_number=registration_number
def get_model(self):
return self.__model
def get_year(self):
return self.__year
def get_registration_number(self):
return self.__registration_number
def __str__(self):
return(self.__model+" "+self.__registration_number+" "+(str)(self.__year))
#Implement Service class here
class Service:
def __init__(self,car_list):
self.car_list=car_list
def get_car_list(self):
return self.car_list
def find_cars_by_year(self,year):
cars_in_year=[]
for car in self.car_list:
if(car.get_year()==year):
cars_in_year.append(car)
return cars_in_year
def add_cars(self,new_car_list):
self.car_list.extend(new_car_list)
return self.car_list
def remove_cars_from_karnataka(self):
for car in self.car_list:
if(car.get_registration_number().find("KA")):
print(car)
self.car_list.remove(car)
return self.car_list
car1=Car("WagonR",2010,"KA09 3056")
car2=Car("Beat", 2011, "MH10 6776")
car3=Car("Ritz", 2013,"KA12 9098")
car4=Car("Polo",2013,"GJ01 7854")
car5=Car("Amaze",2014,"KL07 4332")
#Add different values to the list and test the program
car_list=[car1, car2, car3, car4,car5]
#Create object of Service class, invoke the methods and test your program
ser=Service(car_list)
cl=ser.get_car_list()
for car in cl:
print(car)
print("---------------------------")
cy=ser.find_cars_by_year(2013)
for car in cy:
print(car)
car4=Car("afadf",2017,"KA01 7854")
car5=Car("dsasada",2017,"KL07 4332")
print("---------------------------")
sd=ser.add_cars([car4,car5])
for car in sd:
print(car)
print("---------------------------")
sa=ser.remove_cars_from_karnataka()
for car in sa:
#print(car)
pass
#PF-Prac-2
def bracket_pattern(input_str):
opening='('
closing=')'
pattern=0
for bracket in input_str:
if input_str[0] is closing or input_str[-1:] is opening:
return False
if bracket is opening:
pattern+=1
else:
pattern-=1
if(pattern%2==0):
return True
else:
return False
input_str="(())()"
print(bracket_pattern(input_str))
#PF-Prac-4
def find_nine(nums):
#Remove pass and write your code here
nums4=nums[:4]
if 9 in nums4:
return True
else:
return False
nums=[1,3,4,5,6]
print(find_nine(nums))
#PF-Prac-5
def count_digits_letters(sentence):
#start writing your code here
letters=0
nums=0
for i in sentence:
if(i.isdigit()):
nums+=1
else:
letters+=1
result_list=[letters,nums]
return result_list
sentence="Infosys Mysore 570027"
print(count_digits_letters(sentence))
#PF-Prac-6
def list123(nums):
#start writing your code here
seq=False
for i in range(len(nums)-2):
if(nums[i]==1 and nums[i+1]==2 and nums[i+2]==3):
return True
return False
nums=[1,1,1,2,3]
print(list123(nums))
#PF-Prac-7
def seed_no(number,ref_no):
#start writing your code here
num1=number
digits=[]
while(num1>0):
digits.append(num1%10)
num1=num1//10
prod=number
for i in digits:
prod=prod*i
if(prod==ref_no):
return True
else:
return False
number=123
ref_no=728
print(seed_no(number,ref_no))
#PF-Prac-8
def calculate_net_amount(trans_list):
#start writing your code here
net_amount=0
for transaction in trans_list:
action=transaction[0]
amount=int(transaction[2:])
if(action=='D'):
net_amount+=amount
else:
net_amount-=amount
return net_amount
trans_list=["D:330","D:200","W:230","D:100"]
print(calculate_net_amount(trans_list))
#PF-Prac-9
def generate_dict(number):
#start writing your code here
new_dict={}
for num in range(1,number):
new_dict[num]=num**2
return new_dict
number=20
print(generate_dict(number))
#PF-Prac-10
def string_both_ends(input_string):
#start writing your code here
if(len(input_string)>1):
start=input_string[:2]
end=input_string[-2:]
return start+end
else:
return -1
input_string="w3"
print(string_both_ends(input_string))
#PF-Prac-11
def find_upper_and_lower(sentence):
#start writing your code here
caps=small=0
for i in sentence:
if(i.isupper()):
caps+=1
else:
small+=1
result_list=[caps,small]
return result_list
sentence="Come Here"
print(find_upper_and_lower(sentence))
#PF-Prac-12
def generate_sentences(subjects,verbs,objects):
sentence_list=[]
#start writing your code here
for subj in subjects:
for verb in verbs:
for obj in objects:
sentence=subj+" "+verb+" "+obj
sentence_list.append(sentence)
return sentence_list
subjects=["I","You"]
verbs=["love", "play"]
objects=["Hockey","Football"]
print(generate_sentences(subjects,verbs,objects))
#PF-Prac-13
def close_number(num1,num2,num3):
flagA=flagB=False
#start writing your code here
diffs=[]
#cond A to check numbers close by atmost 1
ndiff=[num1-num2,num2-num3,num3-num1]
for i in ndiff:
if(i<=0):
diffs.append(i*-1)
else:
diffs.append(i)
if(min(diffs)<=1):
flagA=True
#find missing num
print(diffs)
#cond B to check missed number>2
diffs.remove(1)
if(max(diffs)>2):
flagB=True
if (flagA and flagB):
return True
else:
return False
print(close_number(1,2,3))
#PF-Prac-16
def rotate_list(input_list,n):
#start writing your code here
output_list=[]
if(n==0)
return input_list
readPos=len(input_list)-n
for i in input_list:
output_list.append(input_list[readPos])
readPos+=1
if(readPos==len(input_list)):
readPos=0
return output_list
input_list= [1,2,3,4,5,6]
output_list=rotate_list(input_list,1)
print(output_list)
#PF-Prac-32
#import math
def check_squares(number):
#start writing your code here
limit=int(number**0.5)+1
print(limit)
for i in range(1,limit):
for j in range(1,limit):
res=(i**2)+(j**2)
if(res==number):
return True
return False
number=13
print(check_squares(number))
#PF-Prac-33
def integer_to_english(number):
#start writing your code here
subNum=""
inEnglish=""
numWord={0:"\0",1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine",10:"ten",11:"eleven",12:"twelve",13:"thirteen",14:"fourteen",15:"fifteen",16:"sixteen",17:"seventeen",18:"eighteen",19:"nineteen",20:"twenty",30:"thirty",40:"fourty",50:"fifty",60:"sixty",70:"seventy",80:"eighty",90:"ninty",100:"hundred",1000:"thousand"}
if(number>1000):
return -1
else:
if(number in numWord.keys()):
inEnglish=numWord[number]
return inEnglish
else:
subNum=str(number)
if(number>99):
hundreds=int(subNum[0])
tens=int(subNum[1])*10
units=int(subNum[2])
if(number<=99):
tens=int(subNum[0])*10
units=int(subNum[1])
if(number<100):
inEnglish=numWord[tens]+" "+numWord[units]
else:
if(number<=120):
tens=tens+units
inEnglish=numWord[hundreds]+" "+"hundred and "+numWord[tens]
else:
inEnglish=numWord[hundreds]+" "+"hundred and "+numWord[tens]+" "+numWord[units]
return inEnglish
number=140
print(integer_to_english(number)+" only!")
"""Consider a non-empty array of comma separated strings instr, where each element is of the format alphabets:number, return the string outstr after performing the below operations for each element:
Find sum of squares of the digits present in number
If the sum is even, then rotate the corresponding alphabets once towards right
If the sum is odd, rotate the corresponding alphabets twice towards left
Concatenate the rotated alphabets to the output string outstr separated by ','(comma)
Assumption: number will always be non zero positive integer and alphabets will contain at least one alphabet
Input format:
Read the array of strings instr with the elements separated by ','(comma) from the standard input stream.
Output format:
Print the string outstr to the standard output stream.
[Sample Input]:
rtAG:10328,nsHDE:85637
[Sample Output ]:
GrtA,HDEns
[EXPLANATION]:
The first string is ‘rtAG:10328’, the sum of square of the digits 1, 0, 3, 2 and 8 is 78 which is even. So the alphabets after rotating once towards the right is 'GrtA'. The second string is 'nsHDE:85637', the sum of square of the digits 8, 5, 6, 3 and 7 is 183 which is odd. So the alphabets after rotating twice towards the left is 'HDEns'. Hence the output is 'GrtA,HDEns'
[SOLUTION]
"""
instr="rtAG:10328,nsHDE:85637"
strs=instr.split(',')
outlist=[]
def rotright1(code):
return code[-1]+code[:-1]
def rotleft2(code):
return code[2:]+code[:2]
for msg in strs:
code,value=msg.split(":")
squares=list(str(value))
sqsum=0
sqsum=sum([int(i)**2 for i in squares])
if(sqsum%2 == 0):
outlist.append(rotright1(code))
else:
outlist.append(rotleft2(code))
outstr=",".join(outlist)
print(outstr)

@rayanfer32

rayanfer32 commented Jul 8, 2019

Learn and Practice👍

Sorry, something went wrong.

Cybo The Global Business Directory

  • Moscow Oblast
  •  » 
  • Elektrostal

State Housing Inspectorate of the Moscow Region

Phone 8 (496) 575-02-20 8 (496) 575-02-20

Phone 8 (496) 511-20-80 8 (496) 511-20-80

Public administration near State Housing Inspectorate of the Moscow Region

COMMENTS

  1. ErShreyas/InfyTQ-Programming-Using-Java

    Hii friends, In this repo I have provided Infosys Springboard Assignment's solutions. If you are facing any problem while doing assignments you can comment below the video. - GitHub - ErShreyas/InfyTQ-Programming-Using-Java: Hii friends, In this repo I have provided Infosys Springboard Assignment's solutions. If you are facing any problem while doing assignments you can comment below the video.

  2. infytq-assignment-solutions · GitHub Topics · GitHub

    Add this topic to your repo. To associate your repository with the infytq-assignment-solutions topic, visit your repo's landing page and select "manage topics." GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.

  3. InfyTQ-Programming-Using-Java/Programming Using Java Solutions ...

    Hii friends, In this repo I have provided Infosys Springboard Assignment's solutions. If you are facing any problem while doing assignments you can comment below the video. - ErShreyas/InfyTQ-...

  4. InfyTQ-Solutions

    The platform consists of various assignments with rising difficulty levels. I am presenting my solutions to all the assignments in the InfyTQ platform. So go ahead and fork this repo and include your efficient solutions! https://infytq.infosys.com - automatic! InfyTQ. Would love to include your solutions into this repo!

  5. Infosys Java Interview Questions and Answers

    Prepare for Infosys Java interviews with confidence using our curated collection of Java interview questions and answers. Covering fundamental concepts to advanced topics, this resource is tailored for candidates aspiring to join Infosys, a global leader in IT consulting. Elevate your Java skills, tackle technical discussions effectively, and enhance your chances of success in Infosys Java ...

  6. Infosys Certification Exam (InfyTQ) 2021

    What is InfyTQ Certification Exam:-. InfyTQ Certification Exam is a Certification Exam by Infosys that you have the opportunity to get Job into Infosys as well as certified from Infosys and Become "Infosys Certified Software Programmer". InfyTQ Certification Exam is for the BE/BTECH/MTECH/MCA/MCM In the third Year 6 Sem if you are graduate ...

  7. Infosys-Springboard-Programming-using-Java/Final_Assignment_1 ...

    This repository aims to provide the solutions of the problems in the Certification course "Programming Using Java" on Infosys Springboard - ayush03ch/Infosys-Springboard-Programming-using...

  8. Infosys SDE Sheet

    Infosys SDE Sheet. Infosys Limited is a multinational IT company based in India that offers business consulting, IT, and outsourcing services. It was founded in Pune and its headquarter is in Bangalore. Infosys is India's second-largest IT company and many students dream to work at Infosys. This sheet consists of all the common interview ...

  9. PDF Russian Offensive Campaign Assessment

    3 Institute for the Study of War and AEI's Critical Threats Project 2024 migrant workplaces and increase crackdowns at border crossings to temporarily placate emotional cries

  10. Time in Elektrostal, Moscow Oblast, Russia now

    Sunset: 09:07PM. Day length: 17h 24m. Solar noon: 12:25PM. The current local time in Elektrostal is 25 minutes ahead of apparent solar time.

  11. InfyTQ

    Basics Of Java. Enroll with the best online training institute, offering quality courses to fulfill your Basic Of Java needs, be it entry level or at an expert level!! 2 days. InfyTQ features Java coding questions, that require you to be up-to-date with the latest released technologies in the industry.

  12. ayush03ch/Infosys-Springboard-Programming-using-Java

    This Repository contains all the solutions of assignments in the Certification course Programming Using Java NOTE : The arrangements of module might change with time, files I have placed in certain directories might be in differenet categorization on the platform.

  13. Real Time Java Projects and Online Training by H2k Infosys. · GitHub

    The H2K Infosys Java/J2EE training course is divided into 8 exhaustive modules. Module 1 delves deep into the topics of Core Java and JDBC. Module 2 throws light on J2EE Concepts, EL Expressions, Servlets and JSP. You will be taught about XML, Struts and MVC framework as part of Module 3.

  14. INFOSYS Python Practice solutions · GitHub

    INFOSYS Python Practice solutions. print (integer_to_english (number)+" only!") Read the array of strings instr with the elements separated by ',' (comma) from the standard input stream. Print the string outstr to the standard output stream. The first string is 'rtAG:10328', the sum of square of the digits 1, 0, 3, 2 and 8 is 78 which is even.

  15. infytq-solutions · GitHub Topics · GitHub

    GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects. ... you can find solution to Infosys Springboard DBMS Part-1 assignments, quiz and exercises. ... You can add Java Solution of question or some other question which was not added here.

  16. State Housing Inspectorate of the Moscow Region

    State Housing Inspectorate of the Moscow Region Elektrostal postal code 144009. See Google profile, Hours, Phone, Website and more for this business. 2.0 Cybo Score. Review on Cybo.

  17. Solutions to InfyTQ Assignments, quiz and tests.

    InfyTQ is a free platform open to all engineering students in their third and fourth year across India. The platform encourages holistic development by imparting technical as well as professional skills and help them become industry ready. I started this course on June 15th 2019. The platform consists of various assignments with rising ...

  18. YAKOR HOTEL

    Many travellers enjoy visiting Summery House A.I. Morozova (7.6 miles), Shirokov House (8.5 miles), and Pavlovo-Pokrovskaya Factory (8.5 miles). See all nearby attractions. Yakor Hotel, Elektrostal: See 6 traveller reviews, candid photos, and great deals for Yakor Hotel, ranked #3 of 4 hotels in Elektrostal and rated 3 of 5 at Tripadvisor.

  19. Infosys-DSA-using-java/Set Interface Assignment 1 at main

    Contribute to MeetNM/Infosys-DSA-using-java development by creating an account on GitHub.

  20. GitHub

    This Repository contains all the solutions of assignments in the Certification course Data Structures and Algorithms Using Java NOTE : The arrangements of module might change with time, files I have placed in certain directories might be in differenet categorization on the platform.

  21. Infosys-DSA-using-java/HashMap Assignment 1 at main

    Contribute to MeetNM/Infosys-DSA-using-java development by creating an account on GitHub.

  22. Infosys-DSA-using-java/Stack Assignment 1 at main

    Contribute to MeetNM/Infosys-DSA-using-java development by creating an account on GitHub.

  23. assignment-solutions · GitHub Topics · GitHub

    Add this topic to your repo. To associate your repository with the assignment-solutions topic, visit your repo's landing page and select "manage topics." GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.