M1 Python Set 1 and 2
M1 Python Set 1 and 2
Instructions:.Candida
1) Fi tes should read the in
gures in brackets on structions carefully.
2) Assume Suitable da the right-hand side indicate full marks.
ta
3) First Question is co if necessary.
mpulsory.
4) Attempt any one fro
m Question 2 and 3
Answer briefly:
Given a list of non-ne
the list. ga tiv e integers, you· are initia
lly positioned at the fir
Ea ch el em en t in the
st index of
Ql array represents your ma
Determine if you are ab ximum jump length at tha
C0-1 le to reach the last ind t position.
Determine if you are ex.
SO- Example: ab le to rea ch the last index.
BL-6 Input: {2,3,l,1,41 [S)
Output: true •
Explanation: Jump l
step from index Oto 1,
then 3 steps to the last
index.
Given a list of integers
, ret
specific target. You ma urn indices of the two numbers such that they
y assume that each inp ad
Q2 you may not use the sam ut would have exactly on d up to a
e element twice. e solution, and
C0-1 Example:
SO- Input:
BL-6 nums = [2, 7, 11, 15),
target= 9,
Output: nums[0J + nu
ms[l] = 2 + 7 = 9, retur
n [O, I].
Q3
Write a python progra
C0-1 m to take string input
frequency of each char from the user and print
so- acter in the string. the count of
BL-6°
El' GINEERING
I
'Pi~
1 ~~n ---_ _:_A:c:ad:e::_rr1 -:--·c_Y_e_ar-r-:_20_2_ 4-=-2_0 2_5~--: ---;-:-;- ----~
Program: BTI Year: II Semester: IV
Stream: Computer Engineering
Subject: Basics of Python
ime: 45 Minutes (08:05 am to 08:50 am)
Date: 06/02/2025 No ..of Pages: I
Marks: 10 SET:A
Class Test-I
Answer briefly:
Write a program to take input from the user and store the values in a list datatype.
Ql The list may consist of unsorted items. Find the smallest missing positive integer from
C0-1 the list.
SO- Example: [5]
BL-6 Input:,,[1, 2, 0]
Output: 3
Given a non-empty array of digits representing a non-negative.integer, plus one
to the integer. • •
Q2 The digits are stored such that the most significant digit is at the head of the
list, and each element in the array contains a single digit. L
C0-1 You may assume the integer does not contain any leading zero, except the number [S]
SO- 0 itself.
BL-6 Example:
Input: [1,2,3]
Output: [1,2,41 The array represents the inte1;er 123.
Q3
Write a program to accept a string from the user. Remove the vowels from it and
C0-1 [5]
display' the new string.
SO-
BL-6
I