Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

Probelm Solving Using Python End Sem

This document is an examination paper for the B. Tech (CSE) program at Navrachana University, scheduled for May 17, 2024. It includes instructions for the examination, a series of questions related to problem-solving using Python, and specifies the total marks and time allotted. The questions cover various topics such as data structures, error correction, and programming tasks.

Uploaded by

RISHI KACHHADIA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Probelm Solving Using Python End Sem

This document is an examination paper for the B. Tech (CSE) program at Navrachana University, scheduled for May 17, 2024. It includes instructions for the examination, a series of questions related to problem-solving using Python, and specifies the total marks and time allotted. The questions cover various topics such as data structures, error correction, and programming tasks.

Uploaded by

RISHI KACHHADIA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Enrollcnt No:

NAVRACHAMA
LukeUNIVERSITY
School: School of Engincering&Technology (SET)
P'rogram/s: B. Tech (C'SE)
Year:I Semester:
xamination: nd-Sennester Examinalion
Examination Ye:ar: May, 2024
Course Code: (S193 Course Name: Problem Solving using Python
Date: 17-Mav-2024 Total Marks: 40
Time: l1:00 am to01:00 pm Total Pages: 4

Instructions:
’Use of anon-programmable and non-gaphic scientific or general calculator isnot permitled.
’*COs=Cowse Outcome mapping. # BTL=Bloom's Taxonony Level mapping
’ Wriie each question on neN page.
’ Atemplall the questions and sub-questions sequentially in the ascending order.as given in the
question paper:
> Rough workis bedone at the last page of themain answer-book

Q. No. Details Marks CO BTL


Q.1 Select themost appropriate option/s (may be one or more than one) for 08 CO 2
the followingquestions Write only the Option Letters, A, B, C, D in 1,3
Vour answerS

1.1: Which of the following statements (one or more) is (are) valid:


(A)A set can have astring and a tuple as its elements.
(B) A
set can have another set as an element.
(C)A set can have a list as its element.
(D) A set can be converted to a list.

I.2: Which of the following operations are not permitted on a tuple?


(Select one or more options as applicable)
(A) 11[3] --|[| Note: len(tl )> 4
(B) 11.count(1), where tl = (3, 5, 2, 6, 7)
(C) 12 = tuplc(x for x in range(7)
(D)l[3| -11|| Note: len(t)>4

1.3: Which of'the following operations are not pemitted ona string?

Page: l of4
(Selectone or more options as applicalble)Given: strl s str2
"'second
(A) strl|0)
(B)srl strl|0].upp)
(Osulower)
(D) sr2.capitalize)
14:\Which of the following expressions (may be one
are not valid)
or more than onc)
(A) 25-7*8/2
(B)--17
(C) S not- 7
(D) 6&-8

1.5: sl=}
sl[], sl[2] - (11, 12)
Which one of the following statements is
not exactly true?
(A) sl is a set
(B) 11 is the second value of s1,
because index in Python starts witlh 0
(C) 12 is the second value of sl
(D) Left-side of '= in the 2nd statement
is not tuple while the right-side
is a tuple.
1.6: d={0: 10, 1:21}
for x, v in d.keys(), d.values():
print (x, V, end =*")
Which one of the following statements is true?
(A) There will be an error in this
program.
(B) 0 110 21 willbe printed
(C) type(d) will display <class 'set'>
(D) 010121 will be printed
1.7: Which one of the following statements is not
valid for a list.
(A) A list can be an element of a list.
(B) A list can be an element of a tuple.
(C)A list can be a value in a dictionary.
(D) Alist can be an clement of a set.

1.8: Which one of the following expression's value is


True?
(A) Hello'> hell' and by' < Bye
(B) 9 %11+45 II7>= 15% 17
(C) 2 --3 +4 // 5 * 6> 10
(D) 'h'* 5< hello' or bar' *2> baroda

Q.2 Your answer should have 3 lines very clearly,


neatly, nd specifically 08 CO

Page: 2 of 4
written: Line-1: The Error/s;
Output/s Line-2: Correction/s; and Line-3:
The ,3
Find error/s, if any in the
ollowing expressions / prograins, correct
error/s, and writc the output. (Atempt any our), Condition: No valuc he
should be/get deletcd.
2.1: setI 1,2, |3, 4, 5), (6, 7), "atb- c"}. Condition: len(set) should
not change
2.2: ('a', 'b','c) +(|) +(2.3)
2.3: ('a'. b', c]+[||+(2, 3)
2.4: ||: 'one', 2: lwo', 3: 'thrce', 4: four', 1: One', 3:*Thrce"}
2.5:"123"+(6.7)" +|"8,9")
Q.3 08 CO
31: Which data structures in Python does not support indexing? Write
1, 3
the characteristics of such a data structure. Characteristics should
include (a) lypes of clements supported, (b) any restrictions on its
elements. (c) at least 3 operations (functions) permissible on the data
structur, and (d) what opcrations (functions) are not permitted"?

3.2: (a) Write at least 3 opcrations (functions) other than min(), max().
function
sum), etc supported by a tuple. Briefly explain what each
does. (b) Write at least 2 operations /functions which are not supported
by a tuple. Give possible reasons for these operations not being
supported by a tuple.

08 CO 3
Q.4 Write a program for any two of thefollowing: 2, 3
Output should
4.1: Input is a positive integer to be accepted from auser.
be (a)Count of number of digits in the given number, and (b) Sum of
digits in the given number. Do not use str), len() functions. Example:
17
Input: 37 142; Output: Count of digits=5, Sum of digits =
Output should
4.2: Input is a positive integer to be accepted from a user.
integer in the reverse order of the given number. Do not use str).
be an
len() functions. Example: Input: 37142; Output: 24173
4.3: Find the sum of the following series:
S=|-2+3-4 +5-6+ ... up to nterms, n > 5(to be
acccpted from auser)

08 CO 3. 4
Q.5 Writea programfor any oneof the following parts:
3, 4
5.1:Acccpt afloat (decimal) number consisting of digits 1l to 9 fromn a
user (do not include 0 in the decimal part). Outputs: (a) Whole part and
Decimal Part; (b) Count thc number of decinal digits and sum of

Page: 3of 4
decimal digits. Exanple: Input: 5794.21368; Outputs: (a) Whole part
5794, Decimal part 21638; (b)Count of decimal digits - 5; sum of
deciinal digits 20
Hint-1: Take int() and subtract to get Decimal Part (decl ); add
0.00000001. Wint-2: Multiply by 10 to get dccimal part's digits. Hint-3:
Loop condition: deel < l and decl>0.09

$.2: Find the sum of 8terms of the following series:


sinx = X -x**3/3! + x**$/ 5! - x**7/7! + ... up to 8terms.
xvalue (between 0and 1.57) is to be accepted from a user.
Hint: Use theratio of consecutive terms to derive the next term from the
previous term. 3! is 3-factorial, etc.

******* ******* **** End of Question Paper k** * * **

You might also like