IGNOU MMT-001 Solved Assignment 2024 | M.Sc. MACS
₹365.00
Access via our Android App Only
Please read the following points before ordering :
Share with your Friends
IGNOU MMT-001 Assignment Question Paper 2024
mmt-001-solved-assignment-2024-qp-616f3128-f04e-4648-b29f-9a2564256269
- Write the output of the following
C \mathrm{C} codes, with proper justification for each.
i)
main()
{
inta=2,b=4,c=5 \mathrm{a}=2, \mathrm{~b}=4, \mathrm{c}=5 ;
a=b+c \mathrm{a}=\mathrm{b}+\mathrm{c} ;
b=a+c \mathrm{b}=\mathrm{a}+\mathrm{c} ;
c=a-b \mathrm{c}=\mathrm{a}-\mathrm{b} ;
printf ("%d,%d,%d", a, b, c);
}
ii) main()
{
}
iii)
main()
{
inti,j=1 i, j=1 ;
for (i=1;i<=10;i=i+2) i=1 ; i<=10 ; i=i+2)
{
j=i-j j=i-j ;
while(j<=2 j<=2 )
printf("%d ",i+j++) i+j++) ;
}
}
iv) main()
{
inta=10,b=20,c=30 \mathrm{a}=10, \mathrm{~b}=20, \mathrm{c}=30 ;
int**p=2 * \mathrm{p}=2 ;
a=c//**p \mathrm{a}=\mathrm{c} / * \mathrm{p} ;
b=c \mathrm{b}=\mathrm{c} ;
printf("a =%d,b=%d”,a,b) \% \mathrm{~d}, \mathrm{~b}=\% \mathrm{~d} “, \mathrm{a}, \mathrm{b}) ;
}
v) func (intx x )
{
static inta=0 a=0 ;
a+=x \mathrm{a}+=\mathrm{x} ;
return(a);
}
main()
{
intp p ;
for(p=1;p<=5;++p) (p=1 ; p<=5 ;++p)
printf("%d", fun(p));
} - (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.
3. (a) Explain how will you read a three-dimensional array using for loops.
(b) Suppose you wish to solve the equation
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:
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
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
int some_fun(int
{
if
return 2;
int
for
if
return d;
return
}
(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->prev
if (head
head
}
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.
(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.
MMT-001 Sample Solution 2024
mmt-001-solved-assignment-2024-ss-8e24e610-06c9-4b43-84f6-a5bf6ef5ab5c
- Write the output of the following
C \mathrm{C} codes, with proper justification for each.
i)
main()
{
inta=2,b=4,c=5 \mathrm{a}=2, \mathrm{~b}=4, \mathrm{c}=5 ;
a=b+c \mathrm{a}=\mathrm{b}+\mathrm{c} ;
b=a+c \mathrm{b}=\mathrm{a}+\mathrm{c} ;
c=a-b \mathrm{c}=\mathrm{a}-\mathrm{b} ;
printf ("%d,%d,%d", a, b, c);
}
-
Initialization:
a = 2
b = 4
c = 5
-
First Assignment:
a = b + c
a = 4 + 5
a = 9
-
Second Assignment:
b = a + c
b = 9 + 5
b = 14
-
Third Assignment:
c = a - b
c = 9 - 14
c = -5
-
Output:
printf("%d,%d,%d", a, b, c);
- The output will be:
9,14,-5
9,14,-5
.{
printf("%d", ‘C’ + ‘P’ + ‘r’ + ‘o’ + ‘g’ + ‘r’ + ‘a’ + ‘m’);
}
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.- ‘C’ = 67
- ‘P’ = 80
- ‘r’ = 114
- ‘o’ = 111
- ‘g’ = 103
- ‘r’ = 114
- ‘a’ = 97
- ‘m’ = 109
795
.main()
{
int
for (
{
while(
printf("%d ",
}
}
-
Initialization:
j = 1
-
For Loop:
- The loop runs for
i = 1, 3, 5, 7, 9
.
- The loop runs for
-
Inside the For Loop:
- For each iteration of the for loop,
j
is updated asj = i - j
. - Then, a while loop runs as long as
j <= 2
, printingi + j
and incrementingj
by 1 each time.
- For each iteration of the for loop,
-
First Iteration (i = 1):
j = 1 - 1 = 0
- While loop:
j <= 2
, so it prints1 + 0 = 1
, thenj
becomes 1 and prints1 + 1 = 2
, thenj
becomes 2 and prints1 + 2 = 3
, thenj
becomes 3 and the loop stops.
-
Second Iteration (i = 3):
j = 3 - 2 = 1
- While loop:
j <= 2
, so it prints3 + 1 = 4
, thenj
becomes 2 and prints3 + 2 = 5
, thenj
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.
1 2 3 4 5
.{
int
int
printf("a =
}
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
.p
a pointer to an integer with the value 2, it should be done like this:int val = 2;
int *p = &val;
p
as a normal integer variable (not a pointer) with the value 2, it should be declared as:int p = 2;
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);
}
a
is assigned the value ofc / p
, which is30 / 2 = 15
.b
is assigned the value ofc
, which is30
.
a = 15, b = 30
{
static int
return(a);
}
main()
{
int
for
printf("%d", fun(p));
}
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;
}
-
Function
fun
: This function takes an integerx
as an argument and has a static integer variablea
. The static variablea
retains its value between function calls. In each call,x
is added toa
, and the updated value ofa
is returned. -
Main Function:
- A for loop runs from
p = 1
top = 5
. - In each iteration, the function
fun
is called with the current value ofp
, and the returned value is printed.
- A for loop runs from
- First Iteration (
p = 1
):a = 0 + 1 = 1
, prints1
. - Second Iteration (
p = 2
):a = 1 + 2 = 3
, prints3
. - Third Iteration (
p = 3
):a = 3 + 3 = 6
, prints6
. - Fourth Iteration (
p = 4
):a = 6 + 4 = 10
, prints10
. - Fifth Iteration (
p = 5
):a = 10 + 5 = 15
, prints15
.
1 3 6 10 15
.- (a) Explain the use of the functions getchar(), putchar(), gets() and puts() functions, with a suitable program.
getchar()
, putchar()
, gets()
, and puts()
are standard input/output functions in C used for character and string handling.-
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 returnsEOF
. -
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 returnsEOF
. -
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 usefgets()
instead. -
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, orEOF
if there’s an error.
#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;
}
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.
fgets()
instead of gets()
for reading strings to avoid buffer overflow issues.*
(unary): Unary operators have the highest precedence among the listed operators. Associativity: Right to left.++
(unary): Unary increment operator has the same precedence as the unary*
operator. Associativity: Right to left.*
(binary): Binary multiplication operator. Associativity: Left to right.%
: Remainder operator has the same precedence as the binary*
operator. Associativity: Left to right.+
: Binary addition operator. Associativity: Left to right.-
: Binary subtraction operator has the same precedence as the binary+
operator. Associativity: Left to right.!=
: Inequality operator. Associativity: Left to right.+=
: Addition assignment operator has the lowest precedence among the listed operators. Associativity: Right to left.
*
(unary),++
(unary) [Right to left]*
(binary),%
[Left to right]+
,-
(binary) [Left to right]!=
[Left to right]+=
[Right to left]
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;
}
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.
Frequently Asked Questions (FAQs)
You can access the Complete Solution through our app, which can be downloaded using this 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.
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.
Related products
-
IGNOU Assignment Solution
IGNOU MEG-12 Solved Assignment 2022-2023 | MEG | A Survey Course in 20th Century Canadian Literature
₹101.00 Go to the App -
IGNOU Assignment Solution
IGNOU MEG-07 Solved Assignment 2022-2023 | MEG | INDIAN ENGLISH LITERATURE
₹101.00 Go to the App -
IGNOU Assignment Solution
IGNOU MEG-03 Solved Assignment 2022-2023 | MEG | British Novel
₹101.00 Go to the App -
IGNOU Assignment Solution
IGNOU MEG-01 Solved Assignment 2022-2023 | MEG | British Poetry
₹101.00 Go to the App