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

INFEED

Hello World | PROGRAMMING| SBT | DAILY TEST | 15 JUN | ( tech mcq + coding )

 

 TECHNICAL MCQ AND PROGRAMMING  ONLY






TECHNICAL MCQ

1.  d

2.   b

3.   b

4.   b

5.   b

6.   c

7.   b

8.   d

9.    a

10.   b


***********************************************************

Programming 


1.

Problem Statement

You are given a string s=s1s2…sn of length n, which only contains digits 1, 2, ..., 9.

A substring sl…r of s is a string (sl)(sl+1)(sl+2)…(sr). A substring sl…r of s is called even if the number

represented by it is even.

Find the number of even substrings of s. Note, that even if some substrings are equal as strings, but

have different l and r, they are counted as different substrings.

Input Format

The first line contains an integer n — the length of the string s.

The second line contains a string s of length n. The string s consists only of digits 1, 2, ..., 9.

Constraints

(1≤n≤65000)

Output Format

Print the number of even substrings of s


PYTHON CODE :

n,a=int(input()),input()

print(sum(i+1 for i in range(n) if int(a[i])%2==0))


******************************************************


2.

Problem Statement

A word or a sentence in some language is called a pangram if all the characters of the alphabet of

this language appear in it at least once. Pangrams are often used to demonstrate fonts in printing or

test the output devices.

You are given a string consisting of lowercase and uppercase Latin letters. Check whether this string

is a pangram. We say that the string contains a letter of the Latin alphabet if this letter occurs in the

string in uppercase or lowercase.

Input Format

The first line contains a single integer n— the number of characters in the string.

The second line contains the string. The string consists only of uppercase and lowercase Latin

letters.

Constraints

(1 ≤ n ≤ 100)

Output Format

Output "YES"(without quotes), if the string is a pangram and "NO" otherwise.


PYTHON CODE :

input();print('YNEOS'[len(set(input().lower()))<26::2])


******************************************************

3.

Problem Statement

So, the New Year holidays are over. Santa Claus and his colleagues can take a rest and have guests

at last. When two "New Year and Christmas Men" meet, thear assistants cut out of cardboard the

letters from the guest's name and the host's name in honor of this event. Then the hung the letters

above the main entrance. One night, when everyone went to bed, someone took all the letters of our

characters' names. Then he may have shuffled the letters and put them in one pile in front of the

door.

The next morning it was impossible to find the culprit who had made the disorder. But everybody

wondered whether it is possible to restore the names of the host and his guests from the letters

lying at the door? That is, we need to verify that there are no extra letters, and that nobody will need

to cut more letters.

Help the "New Year and Christmas Men" and their friends to cope with this problem. You are given

both inscriptions that hung over the front door the previous night, and a pile of letters that were

found at the front door next morning.

Input Format

The input file consists of three lines: the first line contains the guest's name, the second line

contains the name of the residence host and the third line contains letters in a pile that were found

at the door in the morning. All lines are not empty and contain only uppercase Latin letters.

Constraints

The length of each line does not exceed 100.

Output Format

Print "YES" without the quotes, if the letters in the pile could be permuted to make the names of the

"New Year and Christmas Men". Otherwise, print "NO" without the quotes.



PYTHON CODE :

s,i=sorted,input;print('YNEOS'[s(i()+i())!=s(i())::2])


**************************************************

Post a Comment

Previous Post Next Post