Python Questions

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Q1-

Given array-(2,6,3,5,8,9)

Possible XSeries-(2,3,5), (2,3,5,8)


1 Output-Longest XSeries (2,3,5,8)

#XSeries -where sum of two numbers results in next number

Q2-Find longest substring of unique characters which is case insensitive

These were the questions asked on June 6th.


First Program
You have to return a 4 digit OTP by squaring the digits.
Digits from above example is 3,5,8
Square of those numbers is 9,25,65
2 So the otp to be returned is first four digits 9256

Second program
A string will be given combination of letters and special characters. You have to return a reversed string kee
Example : sd&hg#j
Answer to be returned is : jg&hd#s

First program:
For a given list of numbers, find its factors and add the factors. Then if the sum of factors is present in the o
Example:
Input: 0,1,6
Factors of 0 = 0. Thus sum = 0
3 Factors  1 = 1. Thus sum = 1
Factors of 6 = 1,2,3. Thus sum = 6
Output = 1,6
If the sum numbers are not present in original list, then return -1.

Second Program: Maximum number of swaps will be given and an list of digits will be given. We have to sw
Question 1:

Given a string, find the substring based on following conditions,

The substring must be the longest one of all the possible substring in the given string.
There must not be any repeating characters in the substring.
If there is more than one substring satisfying the above two conditions, then print the substring which occu
Length of the substring must be minimum 3.
If there is no substring satisfying all the aforementioned conditions then print -1.

Question 2:

4 Given an array of integers, find the combination of integers forming a sequence which satisfies the below c

The ith  integer must satisfy the given equation in the sequence
(1)  \begin{equation*} X[i] = X[i-1] + X[i-2] \end{equation*}

The length of the sequence must be maximum possible


If there is more than one sequence satisfying above two conditions then print that sequence which contain
In case there is no combination of integers possible then print -1.
See the example below:
Example 1:
If the given integers are 4, 2, 7, 5, 3, 8, 10, 11, 19 then the possible combinations of integers satisfying abov
combination of integers whose length is greater than 4 and satisfies the given equation.
Example 2:
If the given integers are 1,5,6,10 then print -1.

Even-Odd Series

Given a string and it contains the digits as well as non-digits. We have to find the count of non-digits. If it is
E.g. The given string is  */24#5%7&9*3@. We have to count the non-digit. It’s 7, odd. Then remove all the d
numbers then after the even number of completion print the remaining odd numbers.

5 Prosnic Number

Given a string in which random numbers are present and we have to find the product and the number(one

E.g. Given a string contains 1203456. The multiplication of 3 and 4(one is lesser and one is greater) product
in the string and so on. In such a way, We have to find all the numbers and in the output just we have to sto

If we haven’t found the product then print -1.


My Questions:

1. A simple String rotation type question where INPUT will be given in the form of Dictionary  and based on
6
2. It is based on matrix which i felt  a bit difficult. We  have to find the number which occur consecutively 4
elements find the minimum among them.If there is no such element print “-1”.
--
Regards
 
Gopal Gupta  (M.Tech.,B.Tech.) |Sr. Astt. Professor | +91-9711110221
 
ABES Engineering College, Ghaziabad
Campus 1, 19th KM Stone, NH 24, Ghaziabad -201 009, U.P.
Office: +91 120 7135112 (Ext: ExtensionNumber  )|Fax: +91 120 7135115
W: http://abes.ac.in, E: info@abes.ac.in

Follow our updates on:       

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy