0% found this document useful (0 votes)
61 views3 pages

Noc20-Cs26 Week 02 Assignment 01

Data structures and algorithms assignment exercise

Uploaded by

atabe tah
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)
61 views3 pages

Noc20-Cs26 Week 02 Assignment 01

Data structures and algorithms assignment exercise

Uploaded by

atabe tah
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/ 3

02/07/2020 Programming, Data Structures And Algorithms Using Python - - Unit 5 - Week 2 Quiz

(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)

[email protected]

NPTEL (https://swayam.gov.in/explorer?ncCode=NPTEL) » Programming, Data Structures And Algorithms Using

Python (course)

Announcements (announcements) About the Course (https://swayam.gov.in/nd1_noc19_cs40/preview)

Ask a Question (forum) Progress (student/home) Mentor (student/mentor)

Unit 5 - Week 2 Quiz

Course
outline Week 2 Quiz
How to access The due date for submitting this assignment has passed. Due on 2019-08-21, 23:59 IST.
the portal As per our records you have not submitted this assignment.

Week 1: All questions carry equal weightage. All Python code is assumed to be executed using Python3. You
Introduction may submit as many times as you like within the deadline. Your final submission will be graded.
Note:
Week 1 Quiz If the question asks about a value of type string, remember to enclose your answer in single
or double quotes.
Week 2: Basics If the question asks about a value of type list, remember to enclose your answer in square
of Python brackets and use commas to separate list items.

1) One of the following 10 statements generates an error. Which one? (Your answer should be a number
Week 2 Quiz
between 1 and 10.)
Quiz : Week 2
Quiz x = [1,"abcd",2,"efgh",[3,4]] # Statement 1
(assessment? y = x[0:50] # Statement 2
name=89) z = y # Statement 3
w = x # Statement 4
Week 2 x[1] = x[1] + 'd' # Statement 5
Programming y[2] = 4 # Statement 6
Assignment
x[1][1] = 'y' # Statement 7
z[0] = 0 # Statement 8
Week 3: Lists, w[4][0] = 1000 # Statement 9
inductive
a = (x[4][1] == 4) # Statement 10
function
definitions,
sorting

No, the answer is incorrect.


Score: 0

A dA

https://onlinecourses.nptel.ac.in/noc19_cs40/unit?unit=20&assessment=89 1/3
02/07/2020 Programming, Data Structures And Algorithms Using Python - - Unit 5 - Week 2 Quiz

Accepted Answers:
Week 3 (Type: Regex Match) [ ]*7[ ]
Programming
Assignment 2.5 points

2) Consider the following lines of Python code. 2.5 points


Week 4: Sorting,
Tuples, x = [13,4,17,1000]
Dictionaries, w = x[1:]
Passing
u = x[1:]
Functions, List
y = x
Comprehension
u[0] = 50
y[1] = 40
Week 4 Quiz

Which of the following is correct?


Week 4
Programming
x[1] == 40, y[1] == 40, w[0] == 4, u[0] == 50
Assignment
x[1] == 50, y[1] == 40, w[0] == 50, u[0] == 50
Week 5: x[1] == 4, y[1] == 40, w[0] == 4, u[0] == 50
Exception x[1] == 40, y[1] == 40, w[0] == 50, u[0] == 50
handling,
No, the answer is incorrect.
input/output, file Score: 0
handling, string
Feedback:
processing (d) x[1] == 40, y[1] == 40, w[0] == 4, u[0] == 50
x and y refer to the same list, while w and u are two independent slices. The update to u[0] does not
Week 5 affect any of the other names. The update to y[1] is also reflected in x[1].
Programming
Accepted Answers:
Assignment
x[1] == 40, y[1] == 40, w[0] == 4, u[0] == 50

Week 6: 3) What is the value of endmsg after executing the following lines?
Backtracking,
startmsg = "hello"
scope, data
structures; endmsg = ""
stacks, queues for i in range(0,len(startmsg)):
and heaps endmsg = startmsg[i] + endmsg

Week 6 Quiz

No, the answer is incorrect.


Week 7: Classes, Score: 0
objects and user
Feedback:
defined "olleh"
datatypes
The loop reverses the string by inserting each letter in startmsg at the beginning of endmsg.
Accepted Answers:
Week 7 Quiz
(Type: Regex Match) \s*\'olleh\'\s*
(Type: Regex Match) \s*\"olleh\"\s*
Week 8: Dynamic
programming, 2.5 points
wrap-up
4) What is the value of mylist after the following lines are executed?

Week 8 def mystery(l):


Programming l = l + l
Assignment return()

Download videos mylist = [22,34,57]


mystery(mylist)
Text Transcripts

N h i i

https://onlinecourses.nptel.ac.in/noc19_cs40/unit?unit=20&assessment=89 2/3
02/07/2020 Programming, Data Structures And Algorithms Using Python - - Unit 5 - Week 2 Quiz

No, the answer is incorrect.


Online Score: 0
Programming Feedback:
Test - Sample [22,34,57]
The update l = l + l inside the function creates a new list, so the list passed as the argument is not
Online changed.
Programming Accepted Answers:
Test 1, 26 Sep (Type: Regex Match) \s*\[\s*22,\s*34,\s*57\s*]\s*
2019, 09:30-11:30
2.5 points
Online
Programming
Test 2, 26 Sep
2019, 20:00-22:00

https://onlinecourses.nptel.ac.in/noc19_cs40/unit?unit=20&assessment=89 3/3

You might also like