0% found this document useful (0 votes)
17 views2 pages

ECL 201 Lab Exam Model Questions

Scl
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)
17 views2 pages

ECL 201 Lab Exam Model Questions

Scl
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

ECL 201 Scien fic Compu ng Lab

Lab Examina on Model Ques ons

1. Write a program to print the first 25 natural numbers.

2. Write a program to enter a four digit number. A er that, print the rightmost digit.

3. Write a program to Calculate the average of five numbers entered by the user and
display the result.

4. Write a program to Convert Fahrenheit to Celsius and display the result

5. Write a program to display the grades A, B, C, D, E, F and S, according to the marks


obtained.

6. Write a program to find the area and circumference of a circle. User is entering the
radius.

7. Write a program to find whether the entered year is leap year or not.

8. Write a program to print the mul plica on table of a number entered by the user.
(print first 10 rows in the table)

9. Write a program to plot the func on sin t for the vector t=[0,10] with increment of
0.1
10. Let A and B be two one-dimensional arrays showing the roll number and height of 5
students. Plot this.
11. Let A and B be two one-dimensional arrays showing the roll number and marks of 5
students. Plot this
12. Let A and B be two one-dimensional arrays showing the roll number and height of 5
students. Plot this
13. Write a program to print the first 10 numbers which are mul ples of 2 and 3.
3

14. Write and execute a func on to return the value of ∫ e t dt


||

−3

15. Write a program to print the first 10 numbers which are mul ples of 3 and 5.
16. Write and execute a func on to return first and second deriva ve of the func on
f(t) = 3t4 + 5

17. Write a program to find the sum of digits of a 3 digit number entered by a user.

18. Compute π for the first 10, 20, 50 and 100 terms of the series. Display the values in
each case.
19. Write a program to print the first 10 prime numbers.
20. Plot f(t) = cos(5t) for the vector t=[0,10] with increment of 0.1.

21. Write a program to display the grades A, B, C, D, E, F and S, according to the marks
obtained.

22. Write a program to compute the eigen values of a matrix A (say 5x5 matrix).Plot the
output. Find the transpose of the matrix A, find the eigen values and compare it with
the eigen values obtained earlier. (use library func on for eigen values).

23. Write a program to find the area and circumference of a circle. User is entering the
radius.

24. Write a program to solve the first order differen al equa on with an ini al condi on
of x(0) = 1.
dx
+ 2x = 0
dt

25. Write a program to calculate the SPGA for a student when grades of 5 subjects are
entered. Assume all subjects have 4 credits.

26. Plot f(t) = cos(t)cos(5t) + cos(5t) for the vector t=[0,10] with increment of 0.1.
27. Find the sum of the following series
x3 x5 xn
sum = x − + − …
3 ! 5! n!
28. Find the number of occurrence of each digit (0 to 9) in the number entered by user.

29. Write a program to find the largest of a 2D array of MxN numbers entered by the
user. Also find the sum of numbers of each row and print the result.

a) Without using library functions.


b) Using library functions.

30. Write a program to sort an array of 10 numbers in ascending order

a) Without using library functions.


b) Using library functions.

31. Consider the following waveform, x(t) as

x(t) =
{
sin ( 2512πt )+sin ( 70512πt ) , 5≤ t ≤ 75
0 , t elsewhere

Common questions

Powered by AI

Calculating the area and circumference of a circle is a fundamental computational task important for applications in engineering, physics, and computer graphics. Using the formulas area = πr² and circumference = 2πr, a pprogram takes the radius 'r' as input, applies these formulas, and outputs both area and circumference. This task requires accurate floating-point arithmetic for precise results. A sample algorithm involves reading a user-input radius, calculating both metrics, and displaying the results.

A year is a leap year if it is divisible by 4, but not divisible by 100, unless it is also divisible by 400. In a program, these conditions can be structured with if-else statements: check if the year is divisible by 4 and, in sub-conditions, handle divisibility by 100 and 400. This allows you to output whether a year is a leap year or not.

Using a loop to sum the digits of a 3-digit number offers computational simplicity and clarity. Upon extracting each digit using modulus and integer division, a loop iterates through the digits, summing them in sequence. This method efficiently reduces error-prone steps and leverages control structures. The implementation involves repeating the modulus (number % 10) and division (number // 10) operations until all digits are processed, adding each to a running total.

Eigenvalues of a matrix can be computed using numerical libraries such as NumPy in Python, which offer built-in functions to find the eigenvalues of a matrix. To investigate the implications of comparing eigenvalues of a matrix and its transpose, note that for real matrices, their eigenvalues are the same because transposing a matrix does not change its determinant or characteristic polynomial. This property is important in understanding symmetry and properties of matrix related linear transformations.

To determine the first 10 prime numbers programmatically, one can use the Sieve of Eratosthenes or a simple trial division algorithm. In the trial division method, for each candidate number, you check divisibility from numbers 2 up to the square root of the candidate number. If it's not divisible by any of these, it is prime. A program can implement this method by iterating through numbers starting from 2, checking divisibility, and counting primes until reaching 10.

Using series approximation, specifically involving zeta functions or other number-theoretic approaches, is a mathematically intensive process more theoretical than direct computation. While theoretically interesting, such methods are less computationally feasible for explicit prime determination compared to sieves or trial division due to the intensive calculations required and rounding errors on finite systems. Modern systems, however, enable hybrid techniques, where series underlying larger sieve optimizations are feasible for complex, large dataset applications.

To solve the differential equation dx/dt + 2x = 0 with the initial condition x(0) = 1, one can use techniques like separation of variables or an integrating factor method. The integrating factor, e^(2t), transforms the equation into an exact differential form, allowing integration over both sides from t = 0. Applying the initial condition finds C (the constant of integration), and the solution takes the form x(t) = Ce^(-2t). The initial condition shows that C=1, resulting in x(t) = e^(-2t)

To calculate grades from numerical scores, you define a mapping between score ranges and letter grades. For example, scores between 90-100 might correspond to an 'A', and so on for 'B', 'C', etc. The criteria for an effective grading scale should ensure that grade boundaries reflect meaningful differences in performance, are fair, and are transparent to students. The scale should also align with overall educational goals.

To find the rightmost digit of a four-digit number, one simple algorithm involves using modulus operation. By taking the number modulo 10 (number % 10), you can retrieve the remainder, which is the rightmost digit. This operation effectively isolates the last digit of any integer number.

Plotting the function f(t) = cos(t)cos(5t) + cos(5t) over a specified interval involves several steps: define the interval, such as t=[0,10], and determine the increment, such as 0.1. Using a computational tool or language, compute the function values for each t in the range. Then, choose a suitable plotting library to graph these computed points as a continuous plot. Libraries like matplotlib (in Python) can be used to plot easily and adjust plot aesthetics like labels and titles.

You might also like