FYUG Even Semester Exam, 2024 MATHEMATICS (2nd Semester) Mathematical Programming (MATSEC-151T)

Subject: Mathematics
Paper Code: MATSEC-151T
Semester: 2nd Semester (FYUG)
Full Marks: 50
Time Duration: 2 Hours

SECTION-A (1 Mark Each)

Answer any fifteen questions. All questions solved below.

Question 1

1

What is the C character set?

The C character set includes upper and lowercase alphabets (A-Z, a-z), digits (0-9), and special characters like +, -, *, /, %, &, and punctuation marks.

Question 2

1

What are keywords in C?

Keywords are reserved words in C that have a predefined meaning to the compiler and cannot be used as identifiers.

Question 3

1

Name three classes of data types in C.

The three classes are Primary (Built-in), Derived, and User-defined data types.

Question 4

1

Write the general format of scanf function.

scanf("control_string", &variable1, &variable2, ...);

Question 5

1

What are logical operators in C?

Logical operators include AND (&&), OR (||), and NOT (!).

Question 6

1

Value of: 5+5 == 10 && 2+3 > 5?

(5+5 == 10) is True (1); (2+3 > 5) is False (0). Since 1 && 0 is 0, the value is False.

Question 7

1

Write the C expression for sqrt(b² - 4ac) > 0.

sqrt(b * b - 4 * a * c) > 0

Question 10

1

Write the general syntax of simple IF statement.

if (expression) { statement; }

Question 11

1

What is an exit-controlled loop?

A loop where the test condition is evaluated at the end of the loop body (e.g., do-while loop).

Question 15

1

What are void functions?

Functions that do not return any value to the calling function.

Question 19

1

What is the first subscript of an array in C?

The first subscript (index) is always 0.

SECTION-B (2 Marks Each)

Answer any five questions.

Question 21

2

Rules for naming identifiers in C.

  • Must begin with a letter or underscore (_).
  • Can contain letters, digits, and underscores.
  • Cannot be a keyword.
  • Case sensitive.

Question 23

2

Difference between ++i and i++.

++i (Prefix) increments the value first and then uses it in the expression. i++ (Postfix) uses the current value in the expression first and then increments it.

Question 25

2

C program to check whether a number is odd or even.

#include <stdio.h>
int main() {
int n;
scanf("%d", &n);
if (n % 2 == 0) printf("Even");
else printf("Odd");
return 0;
}

SECTION-C (5 Marks Each)

Answer any five questions.[span_42](end_span)

Question 35

3+2=5

(a) Sum of first n natural numbers using while loop.

#include <stdio.h>
int main() {
int n, i = 1, sum = 0;
scanf("%d", &n);
while (i <= n) {
sum += i;
i++;
}
printf("%d", sum);
return 0;
}

(b) Difference between exit-controlled and entry-controlled loop.[span_44](end_span)

In an entry-controlled loop (for, while), the condition is checked before entering the loop. In an exit-controlled loop (do-while), the body is executed at least once before checking the condition.

Question 36

3+2=5

(a) Explain switch statement with example.

The switch statement allows a variable to be tested for equality against a list of values (cases).

switch(choice) {
case 1: printf("One"); break;
default: printf("Other");
}

(b) Difference between break and continue.[span_49](end_span)

Break terminates the loop or switch entirely. Continue skips the current iteration and jumps to the next iteration of the loop.

Question 37

3+2=5

C program for Factorial using Recursion.

int fact(int n) {
if (n == 0) return 1;
return n * fact(n - 1);
}

Centigrade to Fahrenheit/Kelvin.[span_53](end_span)

F = (C * 9/5) + 32; K = C + 273.15.

Question 39

5

Program to find sum of array elements.

#include <stdio.h>
int main() {
int a[10], n, sum = 0;
scanf("%d", &n);
for(int i=0; i<n; i++) {
scanf("%d", &a[i]);
sum += a[i];
}
printf("Sum = %d", sum);
return 0;
}

Would you like me to create a flowchart illustrating the difference between entry-controlled and exit-controlled loops?