CU SEC-2 Python Programming and LaTeX, 2024

University of Calcutta question paper, B.Sc. Honours Semester II, 2024. Python Programming and LaTeX. Typed in LaTeX, searchable, with a printable PDF.

Open this paper in MathQP

  1. texttt a or b
  2. texttt (a and b) or c
  3. texttt a and (b or c) .
  4. What is a list in Python? How can you check if 3 is an element of the list texttt [1, 7, 5, 3, 4] ?
  5. Write down the syntax of an if-else statement in Python. Write a Python program using if-else statements to check whether a number is even or odd.
  6. Given a list : texttt primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] . How do you obtain the first four primes?
  7. Define dictionary with example in Python.
  8. Use SymPy to compute the expression x 3 + x e y for x = 1.5 , y = 0.75 .
  9. Write a Python program to find the surface area ( 4 pi r 2 ) of a sphere, where radius of spherer is given.
  10. texttt x = 'Hello’; print(x+x)
  11. texttt print(len(["Math", 2, 4, 6]))
  12. texttt print(4%2+5**2**2+5/2) .
  13. Explain the importance of “break” and “continue” statements with examples in Python.
  14. Write a Python program to calculate the sum of three given numbers. If the values are equal, print “The numbers are all equal”.
  15. Write the values of y in following code : qmarks 3+2 y = [x for x in range(10) if x print(y).
  16. Write a Python function to compute S = sum n=1 30 frac 1 u n 2 + 1 where u 1 = 1 , u 2 = 1 and u n+1 = u n + u n-1 , n ge 2 .
  17. Write a Python program to generate a list of all primes number between two positive integers 20 and 50 .
  18. Find the value of python code texttt 2**6 - 35//6%7 .
  19. Use SymPy to find the roots of the equation x 4 - x 2 + 1 = 0 .
  20. Use SymPy to simplify the expression (x 3 + y 3)(x 3 y + 2y 2) .
  21. Write short notes on the list operations : (i) texttt sort() (ii) texttt append() (iii) texttt pop() .
  22. Write a Python program to check whether a year is a leap year or not.
  23. Plot the functions f(x) = x 2 and g(x) = x 3 on the same graph over the interval [-2, 2] using a dashed line for f(x) and a dotted line for g(x) . Also add labels to the axes and a title to the graph.
  24. f(x) = x 2 in (-2, 2) in color black.
  25. g(x) = x 3 - 2 in (-2, 2) in color blue.
  26. What is the output of the LaTeX command : texttt textbackslash frac d dx textbackslash left( textbackslash int 0 textasciicircum x f(t),dt textbackslash right)=f(x).
  27. What is the wrong with the following input in LaTeX command? What is the right way to do it? texttt If theta = pi then sin theta = 0 .
  28. Write down codes in LaTeX to produce the following output : left | frac 1 1+x right |.
  29. Write three LaTeX commands for font size and style of a tex.
  30. Write the command in LaTeX to generate the expression forall x in mathbb R .
  31. Write LaTeX command for the following output : alpha 2 + beta 2 = gamma 2.
  32. What is the command for an underlined text in LaTeX? Give one example.
  33. Write the following statement in LaTeX : “The well-known Pythagorean theorem x 2 + y 2 = z 2 was proved to be invalid for other exponents. Meaning the next equation has no integer solutions : x n + y n = z n, quad x, y, z in mathbb N . ''
  34. Write a block of LaTeX code to display the mathematical expressions : alpha lambda sqrt tan theta beta beta 2 beta 3 dfrac 1 3 -10 sqrt 3 .
  35. Write a block of LaTeX source code to create the following table : || Amount (kg) | Rate/kg | Delivery place | |Item I|2500|370|Kolkata| |Item II|750|251|Chennai| |Item III|350|75|Mumbai|
  36. Write a block of LaTeX code to print the following system of equations in its present form : 20x + 7y + 45z + 11u = 1 15z + 9u = 7 5x + 17y + 5z + 9u = 1 13y + 6z + 3u = 2.
  37. Write code in LaTeX for typesetting the following : f(x) = -1 x < 0 phantom + 0 x = 0 +1 x > 0.