Home / MCQ Bank / Computer
Computer Functions In Python

What will be the output of the following Python code? def sum(*args): '''Function returns the sum of all values''' r = 0 for i in args: r += i return r print sum.__doc__ print sum(1, 2, 3) print sum(1, 2, 3, 4, 5)

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option A • 6 15

Related Computer Questions

Which of the following device is used with an X.25 network to provide service to asynchronous terminals The datatype that means a variable length non binary string is ______ What will be the output of the following code? #include <bits/stdc++.h> using namespace std; void convert(int arr[], int n) { int temp[n]; memcpy(temp, arr, n*sizeof(int)); sort(temp, temp + n); unordered_map<int, int> map; int sort_index = 0; for (int i = 0; i < n; i++) map[temp[i]] = sort_index++; for (int i = 0; i < n; i++) arr[i] = map[arr[i]]; } void printArr(int arr[], int n) { for (int i=0; i<n; i++) cout << arr[i] << " "; } int main() { int arr[] = {3,5,2,4}; int n = sizeof(arr)/sizeof(arr[0]); convert(arr , n); printArr(arr, n); return 0; } What is the time complexity of the Dynamic Programming solution for the "Longest Palindromic Substring" problem? Which of the following is a disadvantage of parallel array over the traditional arrays?