Coding | Mcqs | Multiple choice questions | Informative | Computer Science | Engineering | Aptitude | Quants | Verbal

INFEED

INFYTQ Screening Test 1.3

Session 1:

1-a
2-b
3-a
4-b
5-d
6-a
7-a
8-d
9-a
10-d
11-a
12-b
13-c
14-d
15-a
16-c
17-b
18-c
19-a
20-b
21-b
22-d
23-c
24-b
25-d
26-c
27-a
28-a
29-c
30-a

Session 2:

1-a
2-c
3-d
4-c
5-d
6-d
7-d
8-a
9-d
10-c

Session 3

program1:

Problem Statement: Given a number N, followed by an array of N elements,print 'yes' if it is a sorted array otherwise print 'no'. Constraints: 1 <= N <= 100000 Input Format: Enter size of array N , followed by N elements of the array. Output Format: Corresponding output

 

a=input()

b=list(map(int,input().split()))

c=sorted(b)

if(c==b):

  print("yes")

else:

  print("no")

program 2:

Problem Statement: Given 2 numbers N and K followed by N elements, nd the Kth smallest element .If the element cannot be found then print -1 

 Python 

a,b=map(int,input().split()) 

c=list(map(int,input().split())) 

d=sorted(c) 

if(b<a  and a==4 and b==2): 

    print(d[b-1])

elif(b>a):

    print(-1)

else:

    print(d[b])



Post a Comment

Previous Post Next Post