IGNOU MMT-001 Solved Assignment 2024 for M.Sc. MACS

IGNOU MMT-001 Solved Assignment 2024 | M.Sc. MACS

Solved By – Narendra Kr. Sharma – M.Sc (Mathematics Honors) – Delhi University

365.00

Share with your Friends

Details For MMT-001 Solved Assignment

IGNOU MMT-001 Assignment Question Paper 2024

mmt-001-solved-assignment-2024-qp-616f3128-f04e-4648-b29f-9a2564256269

mmt-001-solved-assignment-2024-qp-616f3128-f04e-4648-b29f-9a2564256269

MMT-001 Solved Assignment 2024 QP
  1. Write the output of the following C C C\mathrm{C}C codes, with proper justification for each.
    i)
    main()
    {
    int a = 2 , b = 4 , c = 5 a = 2 , b = 4 , c = 5 a=2,b=4,c=5\mathrm{a}=2, \mathrm{~b}=4, \mathrm{c}=5a=2, b=4,c=5;
    a = b + c a = b + c a=b+c\mathrm{a}=\mathrm{b}+\mathrm{c}a=b+c;
    b = a + c b = a + c b=a+c\mathrm{b}=\mathrm{a}+\mathrm{c}b=a+c;
    c = a b c = a b c=a-b\mathrm{c}=\mathrm{a}-\mathrm{b}c=ab;
    printf ("%d,%d,%d", a, b, c);
    }
    ii) main()
    {
    }
    iii)
    main()
    {
    int i , j = 1 i , j = 1 i,j=1i, j=1i,j=1;
    for ( i = 1 ; i <= 10 ; i = i + 2 ) i = 1 ; i <= 10 ; i = i + 2 ) i=1;i<=10;i=i+2)i=1 ; i<=10 ; i=i+2)i=1;i<=10;i=i+2)
    {
    j = i j j = i j j=i-jj=i-jj=ij;
    while( j <= 2 j <= 2 j<=2j<=2j<=2 )
    printf("%d ", i + j + + ) i + j + + ) i+j++)i+j++)i+j++);
    }
    }
    iv) main()
    {
    int a = 10 , b = 20 , c = 30 a = 10 , b = 20 , c = 30 a=10,b=20,c=30\mathrm{a}=10, \mathrm{~b}=20, \mathrm{c}=30a=10, b=20,c=30;
    int p = 2 p = 2 **p=2* \mathrm{p}=2p=2;
    a = c / p a = c / p a=c//**p\mathrm{a}=\mathrm{c} / * \mathrm{p}a=c/p;
    b = c b = c b=c\mathrm{b}=\mathrm{c}b=c;
    printf("a = % d , b = % d " , a , b ) % d , b = % d " , a , b ) %d,b=%d”,a,b)\% \mathrm{~d}, \mathrm{~b}=\% \mathrm{~d} “, \mathrm{a}, \mathrm{b})% d, b=% d,a,b);
    }
    v) func (int x x xxx )
    {
    static int a = 0 a = 0 a=0a=0a=0;
    a + = x a + = x a+=x\mathrm{a}+=\mathrm{x}a+=x;
    return(a);
    }
    main()
    {
    int p p ppp;
    for ( p = 1 ; p <= 5 ; + + p ) ( p = 1 ; p <= 5 ; + + p ) (p=1;p<=5;++p)(p=1 ; p<=5 ;++p)(p=1;p<=5;++p)
    printf("%d", fun(p));
    }
  2. (a) Explain the use of the functions getchar(), putchar(), gets() and puts() functions, with a suitable program.
    (b) Arrange the following operators in descending order of their priority. If any two operators have the same priority, then specify their associativity.
+ = , % , + , , (unary), ! = , , + + + = , % , + , , (unary), ! = , , + + +=,quad%,quad+,quad**,quad**” (unary), “quad!=,quad-,quad+++=, \quad \%, \quad+, \quad *, \quad * \text { (unary), } \quad !=, \quad-, \quad+++=,%,+,, (unary), !=,,++
(c) Write a loop that examines each character in a character type array called text, and determines how many of the characters are letters, how many are digits, how many are whitespace characters, and how many are other characters.
3. (a) Explain how will you read a three-dimensional array using for loops.
(b) Suppose you wish to solve the equation x 5 + 3 x 2 10 = 0 x 5 + 3 x 2 10 = 0 x^(5)+3x^(2)-10=0x^5+3 x^2-10=0x5+3x210=0 for x x xxx. Rearrange this equation to get an appropriate fixed point iteration method. Then write a program to get an approximate value of the root of the equation. The initial guess must be entered by the user. Your programme must be able to flag a warning message if the initial guess is too far from the exact root. In that case, your program must be able to suggest an initial guess to the user. Terminate the program and print the current value of the root as soon as the difference between two successive approximations becomes smaller than 0.005 .
4. (a) How is an external variable defined? How is it initialised? What happens when an external variable definition does not include the assignment of an initial value? (3)
(b) When passing an argument to a function, what is the difference between passing by value and passing by reference?
(c) Explain the use of the string library functions strncpy () and strncat (), with the help of an example for each.
5. (a) A C program contains the following statements:
char u, v = ‘A’; char p u , p v = & v ; ppv = v+1; u = p v + 1 ; p u = & u ; char u, v = ‘A’; char p u , p v = & v ; ppv = v+1; u = p v + 1 ; p u = & u ; {:[” char u, v = ‘A’; “],[” char “**pu”,”**pv=&v;],[” ppv = v+1; “],[u=**pv+1;],[pu=&u;]:}\begin{aligned} & \text { char u, v = ‘A’; } \\ & \text { char } * \mathrm{pu}, * \mathrm{pv}=\& \mathrm{v} ; \\ & \text { ppv = v+1; } \\ & \mathrm{u}=* \mathrm{pv}+1 ; \\ & \mathrm{pu}=\& \mathrm{u} ; \end{aligned} char u, v = ‘A’; char pu,pv=&v; ppv = v+1; u=pv+1;pu=&u;
Suppose each character occupies one byte of memory. If the value assigned to u u uuu is stored in (hexadecimal) address F8C and the value assigned to v is stored in the address F8D, then
i) What value is represented by &v?
ii) What value is assigned to pv?
iii) What value is represented by *pv?
iv) What value is assigned to u u uuu ?
v) What value is represented by &u?
vi) What value is assigned to pu?
(b) How would you differentiate between the terms pointer to an array and array of pointers? Give proper examples.
6. (a) What does the following C C C\mathrm{C}C function compute? Discover.
int some_fun(int n n n\mathrm{n}n )
{
if ( n % 2 == 0 ) ( n % 2 == 0 ) (n%2==0)(\mathrm{n} \% 2==0)(n%2==0)
return 2;
int d , s = sqrt ( n ) d , s = sqrt ( n ) d,s=sqrt(n)d, s=\operatorname{sqrt}(n)d,s=sqrt(n);
for ( d = 3 ; d <= s ; d = d + 2 ) ( d = 3 ; d <= s ; d = d + 2 ) (d=3;d<=s;d=d+2)(d=3 ; d<=s ; d=d+2)(d=3;d<=s;d=d+2)
if ( n % d == 0 ( n % d == 0 (n%d==0(\mathrm{n} \% \mathrm{~d}==0(n% d==0 )
return d;
return n n nnn;
}
(b) What do you understand by a nested structure? Explain with an example. Also, explain how would you access the members of a structure or a nested structure using pointers?
(c) Consider the following structure declaration of a doubly linked list:
struct dlink
{
int nodeid;
dlink *next;
dlink *prev;
} dlink_t;
A pointer of the head of the linked list is maintained as a global variable, whose definition is
dlink_t *head;
The function remove_element (dlink_t *rp) defined below needs to remove the node pointed to rp and adjust the head. The first node’s prev and the last node’s next are NULL.
remove_element (dlink_t *rp)
{
rp->prev->next = = === rp->next;
rp->next->prev = = === rp->prev;
if (head == r p == r p ==rp==\mathrm{rp}==rp )
head = = === rp->next;
}
Explain whether the function remove_element () works properly or not.
7. (a) Write a C program which reads a line of text from keyboard, and writes the line to a file with lower case letters converted to upper case and vice-versa.
(b) Write the inorder, preorder and postorder traversals of the following binary search tree.
original image

(c) Define a structure of type hms containing three integer members, called hour, minute and second, respectively. Then define a union containing two members, each a structure of type hms. Call the union members local and home, respectively. Declare a pointer variable called time that points to this union.
8. Write a function that evaluates an expression in RPN that is given as a string.
9. (a) Explain the meaning of the terms garbage collection, fragmentation, relocation and compaction.
(b) What do you understand by file organisation? Explain the methods of file organisation.
\(a^2=b^2+c^2-2bc\:Cos\left(A\right)\)

MMT-001 Sample Solution 2024

mmt-001-solved-assignment-2024-ss-8e24e610-06c9-4b43-84f6-a5bf6ef5ab5c

mmt-001-solved-assignment-2024-ss-8e24e610-06c9-4b43-84f6-a5bf6ef5ab5c

MMT-001 Solved Assignment 2024 SS
  1. Write the output of the following C C C\mathrm{C}C codes, with proper justification for each.
    i)
    main()
    {
    int a = 2 , b = 4 , c = 5 a = 2 , b = 4 , c = 5 a=2,b=4,c=5\mathrm{a}=2, \mathrm{~b}=4, \mathrm{c}=5a=2, b=4,c=5;
    a = b + c a = b + c a=b+c\mathrm{a}=\mathrm{b}+\mathrm{c}a=b+c;
    b = a + c b = a + c b=a+c\mathrm{b}=\mathrm{a}+\mathrm{c}b=a+c;
    c = a b c = a b c=a-b\mathrm{c}=\mathrm{a}-\mathrm{b}c=ab;
    printf ("%d,%d,%d", a, b, c);
    }
Answer:
Let’s go through the code step by step:
  1. Initialization:
    • a = 2
    • b = 4
    • c = 5
  2. First Assignment:
    • a = b + c
    • a = 4 + 5
    • a = 9
  3. Second Assignment:
    • b = a + c
    • b = 9 + 5
    • b = 14
  4. Third Assignment:
    • c = a - b
    • c = 9 - 14
    • c = -5
  5. Output:
    • printf("%d,%d,%d", a, b, c);
    • The output will be: 9,14,-5
So, the output of the given C code is 9,14,-5.
ii)
main()
{
printf("%d", ‘C’ + ‘P’ + ‘r’ + ‘o’ + ‘g’ + ‘r’ + ‘a’ + ‘m’);
}
Answer:
In this C code, the printf function is adding the ASCII values of the characters ‘C’, ‘P’, ‘r’, ‘o’, ‘g’, ‘r’, ‘a’, and ‘m’, and then printing the sum as an integer.
Here are the ASCII values for each character:
  • ‘C’ = 67
  • ‘P’ = 80
  • ‘r’ = 114
  • ‘o’ = 111
  • ‘g’ = 103
  • ‘r’ = 114
  • ‘a’ = 97
  • ‘m’ = 109
Adding these values together:
67 + 80 + 114 + 111 + 103 + 114 + 97 + 109 = 795
So, the output of the given C code is 795.
iii)
main()
{
int i , j = 1 i , j = 1 i,j=1i, j=1i,j=1;
for ( i = 1 ; i <= 10 ; i = i + 2 ) i = 1 ; i <= 10 ; i = i + 2 ) i=1;i<=10;i=i+2)i=1 ; i<=10 ; i=i+2)i=1;i<=10;i=i+2)
{
j = i j j = i j j=i-jj=i-jj=ij;
while( j <= 2 j <= 2 j<=2j<=2j<=2 )
printf("%d ", i + j + + ) i + j + + ) i+j++)i+j++)i+j++);
}
}
Answer:
Let’s go through the code step by step:
  1. Initialization:
    • j = 1
  2. For Loop:
    • The loop runs for i = 1, 3, 5, 7, 9.
  3. Inside the For Loop:
    • For each iteration of the for loop, j is updated as j = i - j.
    • Then, a while loop runs as long as j <= 2, printing i + j and incrementing j by 1 each time.
Let’s break down each iteration of the for loop:
  • First Iteration (i = 1):
    • j = 1 - 1 = 0
    • While loop: j <= 2, so it prints 1 + 0 = 1, then j becomes 1 and prints 1 + 1 = 2, then j becomes 2 and prints 1 + 2 = 3, then j becomes 3 and the loop stops.
  • Second Iteration (i = 3):
    • j = 3 - 2 = 1
    • While loop: j <= 2, so it prints 3 + 1 = 4, then j becomes 2 and prints 3 + 2 = 5, then j becomes 3 and the loop stops.
  • Third Iteration (i = 5):
    • j = 5 - 1 = 4
    • While loop: j > 2, so it doesn’t print anything.
  • Fourth Iteration (i = 7):
    • j = 7 - 4 = 3
    • While loop: j > 2, so it doesn’t print anything.
  • Fifth Iteration (i = 9):
    • j = 9 - 3 = 6
    • While loop: j > 2, so it doesn’t print anything.
So, the output of the given C code is 1 2 3 4 5.
iv) main()
{
int a = 10 , b = 20 , c = 30 a = 10 , b = 20 , c = 30 a=10,b=20,c=30\mathrm{a}=10, \mathrm{~b}=20, \mathrm{c}=30a=10, b=20,c=30;
int p = 2 p = 2 **p=2* \mathrm{p}=2p=2;
a = c / p a = c / p a=c//**p\mathrm{a}=\mathrm{c} / * \mathrm{p}a=c/p;
b = c b = c b=c\mathrm{b}=\mathrm{c}b=c;
printf("a = % d , b = % d " , a , b ) % d , b = % d " , a , b ) %d,b=%d”,a,b)\% \mathrm{~d}, \mathrm{~b}=\% \mathrm{~d} “, \mathrm{a}, \mathrm{b})% d, b=% d,a,b);
}
Answer:
There’s an issue in this code. The line int *p = 2; is trying to assign an integer value to a pointer, which is not correct in C. Pointers should be assigned the address of a variable or memory allocated using functions like malloc.
If the intention was to make p a pointer to an integer with the value 2, it should be done like this:
int val = 2;
int *p = &val;
Or, if the intention was to use p as a normal integer variable (not a pointer) with the value 2, it should be declared as:
int p = 2;
Assuming the second case (that p is meant to be a normal integer variable), the corrected code would look like this:
main()
{
    int a = 10, b = 20, c = 30;
    int p = 2;
    a = c / p;
    b = c;
    printf("a = %d, b = %d", a, b);
}
In this corrected code:
  • a is assigned the value of c / p, which is 30 / 2 = 15.
  • b is assigned the value of c, which is 30.
So, the output of the corrected code would be:
a = 15, b = 30
v) func (int x x xxx )
{
static int a = 0 a = 0 a=0a=0a=0;
a + = x a + = x a+=x\mathrm{a}+=\mathrm{x}a+=x;
return(a);
}
main()
{
int p p ppp;
for ( p = 1 ; p <= 5 ; + + p ) ( p = 1 ; p <= 5 ; + + p ) (p=1;p<=5;++p)(p=1 ; p<=5 ;++p)(p=1;p<=5;++p)
printf("%d", fun(p));
}
Answer:
There’s a minor issue in the code: the function name in the printf statement is fun, but the function is defined as func. These names should match. Assuming the function name is intended to be fun, here’s the corrected code:
#include <stdio.h>

int fun(int x)
{
    static int a = 0;
    a += x;
    return a;
}

int main()
{
    int p;
    for (p = 1; p <= 5; ++p)
        printf("%d ", fun(p));
    return 0;
}
Let’s go through the code step by step:
  1. Function fun: This function takes an integer x as an argument and has a static integer variable a. The static variable a retains its value between function calls. In each call, x is added to a, and the updated value of a is returned.
  2. Main Function:
    • A for loop runs from p = 1 to p = 5.
    • In each iteration, the function fun is called with the current value of p, and the returned value is printed.
Here’s what happens in each iteration of the loop:
  • First Iteration (p = 1): a = 0 + 1 = 1, prints 1.
  • Second Iteration (p = 2): a = 1 + 2 = 3, prints 3.
  • Third Iteration (p = 3): a = 3 + 3 = 6, prints 6.
  • Fourth Iteration (p = 4): a = 6 + 4 = 10, prints 10.
  • Fifth Iteration (p = 5): a = 10 + 5 = 15, prints 15.
So, the output of the given C code is 1 3 6 10 15.
  1. (a) Explain the use of the functions getchar(), putchar(), gets() and puts() functions, with a suitable program.
Answer:
The functions getchar(), putchar(), gets(), and puts() are standard input/output functions in C used for character and string handling.
  1. getchar(): This function is used to read a single character from the standard input (usually the keyboard). It doesn’t take any arguments and returns the read character. If there’s an error or end of file is reached, it returns EOF.
  2. putchar(): This function is used to write a single character to the standard output (usually the console). It takes a character as an argument and returns the written character. If there’s an error, it returns EOF.
  3. gets(): This function is used to read a string from the standard input into a buffer until a newline character is encountered or end of file is reached. It’s considered unsafe because it can lead to buffer overflow, so it’s better to use fgets() instead.
  4. puts(): This function is used to write a string to the standard output followed by a newline character. It takes a string as an argument and returns a non-negative number if successful, or EOF if there’s an error.
Here’s a simple program demonstrating the use of these functions:
#include <stdio.h>

int main() {
    char c;
    char str[100];

    printf("Enter a character: ");
    c = getchar(); // Read a character

    printf("You entered: ");
    putchar(c); // Write the character
    printf("\n");

    printf("Enter a string: ");
    gets(str); // Read a string (unsafe, consider using fgets instead)

    printf("You entered: ");
    puts(str); // Write the string with a newline

    return 0;
}
In this program:
  • getchar() is used to read a single character from the user.
  • putchar() is used to display the entered character.
  • gets() is used to read a string from the user (though it’s unsafe and not recommended).
  • puts() is used to display the entered string with a newline at the end.
Note: In modern C programming, it’s recommended to use fgets() instead of gets() for reading strings to avoid buffer overflow issues.
(b) Arrange the following operators in descending order of their priority. If any two operators have the same priority, then specify their associativity.
+ = , % , + , , (unary), ! = , , + + + = , % , + , , (unary), ! = , , + + +=,quad%,quad+,quad**,quad**” (unary), “quad!=,quad-,quad+++=, \quad \%, \quad+, \quad *, \quad * \text { (unary), } \quad !=, \quad-, \quad+++=,%,+,, (unary), !=,,++
Answer:
In C, operators have a defined precedence (priority) and associativity. Here’s the list of the given operators in descending order of their priority, along with their associativity:
  1. * (unary): Unary operators have the highest precedence among the listed operators. Associativity: Right to left.
  2. ++ (unary): Unary increment operator has the same precedence as the unary * operator. Associativity: Right to left.
  3. * (binary): Binary multiplication operator. Associativity: Left to right.
  4. %: Remainder operator has the same precedence as the binary * operator. Associativity: Left to right.
  5. +: Binary addition operator. Associativity: Left to right.
  6. -: Binary subtraction operator has the same precedence as the binary + operator. Associativity: Left to right.
  7. !=: Inequality operator. Associativity: Left to right.
  8. +=: Addition assignment operator has the lowest precedence among the listed operators. Associativity: Right to left.
So, the descending order of priority with associativity is:
  • * (unary), ++ (unary) [Right to left]
  • * (binary), % [Left to right]
  • +, - (binary) [Left to right]
  • != [Left to right]
  • += [Right to left]
(c) Write a loop that examines each character in a character type array called text, and determines how many of the characters are letters, how many are digits, how many are whitespace characters, and how many are other characters.
Answer:
We can use a loop to iterate through each character in the array and use the functions isalpha(), isdigit(), and isspace() from the ctype.h header file to classify each character. Here’s an example in C:
#include <stdio.h>
#include <ctype.h>

int main() {
    char text[] = "Hello, World! 12345 \t\n";
    int letters = 0, digits = 0, whitespace = 0, others = 0;

    for (int i = 0; text[i] != '\0'; i++) {
        if (isalpha(text[i])) {
            letters++;
        } else if (isdigit(text[i])) {
            digits++;
        } else if (isspace(text[i])) {
            whitespace++;
        } else {
            others++;
        }
    }

    printf("Letters: %d\n", letters);
    printf("Digits: %d\n", digits);
    printf("Whitespace characters: %d\n", whitespace);
    printf("Other characters: %d\n", others);

    return 0;
}
In this program:
  • isalpha() checks if a character is an alphabetic letter.
  • isdigit() checks if a character is a digit.
  • isspace() checks if a character is a whitespace character (space, tab, newline, etc.).
  • The loop continues until it encounters the null terminator '\0' at the end of the string.
The counts of each type of character are printed at the end.

Frequently Asked Questions (FAQs)

You can access the Complete Solution through our app, which can be downloaded using this link:

App Link 

Simply click “Install” to download and install the app, and then follow the instructions to purchase the required assignment solution. Currently, the app is only available for Android devices. We are working on making the app available for iOS in the future, but it is not currently available for iOS devices.

Yes, It is Complete Solution, a comprehensive solution to the assignments for IGNOU. Valid from January 1, 2023 to December 31, 2023.

Yes, the Complete Solution is aligned with the IGNOU requirements and has been solved accordingly.

Yes, the Complete Solution is guaranteed to be error-free.The solutions are thoroughly researched and verified by subject matter experts to ensure their accuracy.

As of now, you have access to the Complete Solution for a period of 6 months after the date of purchase, which is sufficient to complete the assignment. However, we can extend the access period upon request. You can access the solution anytime through our app.

The app provides complete solutions for all assignment questions. If you still need help, you can contact the support team for assistance at Whatsapp +91-9958288900

No, access to the educational materials is limited to one device only, where you have first logged in. Logging in on multiple devices is not allowed and may result in the revocation of access to the educational materials.

Payments can be made through various secure online payment methods available in the app.Your payment information is protected with industry-standard security measures to ensure its confidentiality and safety. You will receive a receipt for your payment through email or within the app, depending on your preference.

The instructions for formatting your assignments are detailed in the Assignment Booklet, which includes details on paper size, margins, precision, and submission requirements. It is important to strictly follow these instructions to facilitate evaluation and avoid delays.

\(2\:cos\:\theta \:sin\:\phi =sin\:\left(\theta +\phi \right)-sin\:\left(\theta -\phi \right)\)

Terms and Conditions

  • The educational materials provided in the app are the sole property of the app owner and are protected by copyright laws.
  • Reproduction, distribution, or sale of the educational materials without prior written consent from the app owner is strictly prohibited and may result in legal consequences.
  • Any attempt to modify, alter, or use the educational materials for commercial purposes is strictly prohibited.
  • The app owner reserves the right to revoke access to the educational materials at any time without notice for any violation of these terms and conditions.
  • The app owner is not responsible for any damages or losses resulting from the use of the educational materials.
  • The app owner reserves the right to modify these terms and conditions at any time without notice.
  • By accessing and using the app, you agree to abide by these terms and conditions.
  • Access to the educational materials is limited to one device only. Logging in to the app on multiple devices is not allowed and may result in the revocation of access to the educational materials.

Our educational materials are solely available on our website and application only. Users and students can report the dealing or selling of the copied version of our educational materials by any third party at our email address (abstract4math@gmail.com) or mobile no. (+91-9958288900).

In return, such users/students can expect free our educational materials/assignments and other benefits as a bonafide gesture which will be completely dependent upon our discretion.

Scroll to Top
Scroll to Top