MCQ Answer

<p>What will be the output of the following Python code?</p> <pre><span class="sy0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(102,="" 204,="" 102);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">&gt;&gt;&gt;</span><span style="background-color: rgb(244, 244, 244); color: rgb(51, 51, 51); font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;"=""> a</span><span class="sy0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(102,="" 204,="" 102);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">=</span><span class="br0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">{</span><span class="nu0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(255,="" 69,="" 0);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">5</span><span class="sy0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(102,="" 204,="" 102);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">,</span><span class="nu0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(255,="" 69,="" 0);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">6</span><span class="sy0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(102,="" 204,="" 102);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">,</span><span class="nu0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(255,="" 69,="" 0);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">7</span><span class="br0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">}<br></span><span class="sy0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(102,="" 204,="" 102);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">&gt;&gt;&gt;</span><span style="background-color: rgb(244, 244, 244); color: rgb(51, 51, 51); font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;"=""> </span><span class="kw2" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" green;="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">sum</span><span class="br0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">(</span><span style="background-color: rgb(244, 244, 244); color: rgb(51, 51, 51); font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;"="">a</span><span class="sy0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(102,="" 204,="" 102);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">,</span><span class="nu0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(255,="" 69,="" 0);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">5</span><span class="br0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">)</span></pre>

What will be the output of the following Python code?

>>> a={5,6,7}
>>> sum(a,5)


निम्नलिखित Python कोड का आउटपुट क्या होगा?

>>> a={5,6,7}
>>> sum(a,5)
Topic : Sequence data types in python

A. 5

B. 23

C. 18

D. Invalid syntax for sum method, too many arguments सम मैथड के लिए इनवैलिड सिंटैक्स, बहुत सारे आर्ग्यमन्ट




Correct Answer is :

B. 23



Explanation
The second parameter is the start value for the sum of elements in set a. Thus, sum(a,5) = 5+(5+6+7)=23.
CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz