Шукаєте відповіді та рішення тестів для In24-S1-CS1033 - Programming Fundamentals? Перегляньте нашу велику колекцію перевірених відповідей для In24-S1-CS1033 - Programming Fundamentals в online.uom.lk.
Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!
Exercise L6.E1
Develop a program to read in two matrices A and B with dimensions n x m
and compute and display their product ABᵀ
(of dimensions n x n
). Assume that the elements of the matrices are integers. You must use functions while implementing this program.
Note: You should check for any errors when entering the matrices. Print “Invalid Matrix”
as the error message if the entered matrix does not comply with the given dimensions. Print “Error”
for any other exceptions you are handling.
Please submit the flowchart diagram that illustrates the algorithm of your program here.
Exercise L5.E4
Develop a program to input a matrix with any dimension and output the transpose of that matrix. You should stop accepting the rows when -1 is entered as the input. Use a 2D (two-dimensional) list to store the matrix. You should handle the exceptions such as checking the invalid rows with an inconsistent number of elements.
Note: Print “Invalid Matrix” as the error message for invalid rows with an inconsistent number of elements. Print “Error” for any other exceptions you are handling.
Please submit the flowchart diagram that illustrates the algorithm of your program here.
Exercise L5.E3
Suppose there are 4 students each having marks of 3 subjects. Develop a program to read the marks from the keyboard and calculate and display the total marks and average mark (rounded off to one decimal point) of each student. Use a 2D (two-dimensional) list to store the marks.
Please submit the flowchart diagram that illustrates the algorithm of your program here.
Exercise L5.E2
Develop a program to read the names of two sports that you and your friends love to play and watch. Then generate all sentences where the subject is in ["I", "We"], the verb is in ["play", "watch"] and the object is in the two sports. Use lists to store the words and generate the sentences by iterating through the lists using deeply nested loops.
Please submit the flowchart diagram that illustrates the algorithm of your program here.
Exercise L5.E1
Develop a program to find and display the minimum and the maximum among 10 numbers separated by white spaces (see the example) entered from the keyboard. You must use a list to store the numbers entered. The numbers can be negative or non-integers.
Please submit the flowchart diagram that illustrates the algorithm of your program here.
What will be the output of the following Python code segment?
def f(x,l): for i in range(x): l.append(i*i) print(l)f(3,[3,2])
What will be the output of the following Python function?
def findList( inputList ):
return [i for i in inputList if i%2 == 1]
Consider the following Python code of 4 lines, with line numbers (not part of the code) shown on the left. The objective is to write a string onto the file.
1 f = open('Out.txt', 'w')
2 f.write("this is the string")
3 ...........
4 print('Done...')
What should fill the blank at line 3 to make the code complete?
Out of the four control structures used in programs, a Python function is a:
What will be the output of the following Python code segment?
d = "M"def add( arg2 , arg1 = "U" ): global d d += arg2 + arg1 returnadd("o")print (d)
Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!