Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations

AMU MCA Previous Year Questions (PYQs)

AMU MCA C Programming Language PYQ


AMU MCA PYQ
Output of the following C-code
main()
{
    printf("Hello");
    main();
}






Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2020 PYQ

Solution

Recursive call without stopping condition → infinite printing until stack overflow.


AMU MCA PYQ
Predict the output of the following program:
int main()
{
    int arr[5];
    // Assume base address of arr is 2000 and size of integer is 32 bit
    arr++;
    printf("%u", arr);
    return 0;
}






Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2020 PYQ

Solution

Array name arr represents base address.

Size of int = 32 bit = 4 bytes.

Base address = 2000.

After arr++, pointer moves by one integer = 4 bytes.

New address = 2000 + 4 = 2004.


AMU MCA PYQ
What is the similarity between a structure, union and enumeration?





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2025 PYQ

Solution

struct, union and enum are all user-defined data types in C.

AMU MCA PYQ
In the following program, how many times “for” loop will be executed?
#include <stdio.h>
int main()
{
    int i = 59, j = 10;
    for( ; j ; i )
        printf("%d", i);
}





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2022 PYQ

Solution

Loop condition is j, which is non-zero and never changes. Hence the loop runs infinitely.

AMU MCA PYQ
A pointer is





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2022 PYQ

Solution

A pointer is defined as a variable that stores the address of another variable.

AMU MCA PYQ
In the following program, how many times ‘for’ loop will be executed?
#include <stdio.h>
void main()
{
    int i = 5;
    for (;;)
        printf("%d", i);
}





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2025 PYQ

Solution

The loop condition is for(;;) which has no condition and no termination statement. Hence the loop never stops.

AMU MCA PYQ
What is the output for the program given below?
#include <stdio.h>
void main()
{
    int i = 5;
    for (; i < 12; i++);
    printf("%d", i);
}





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2025 PYQ

Solution

The semicolon ; after the for loop makes it an empty loop. The loop increments i until $i = 12$. After the loop ends, printf prints the final value of i.

AMU MCA PYQ
What is the output of the program given below?
#include <stdio.h>
void main()
{
    int i = 500, j = 1000, k = 100;
    if (j == 1000 && i > 400)
        k = (j == 1000 && i > 499);
    printf("k=%d", k);
    else
        printf("k=%d", k);
}





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2022 PYQ

Solution

Condition j==1000 && i>400 is true, so if part executes. Inside: (j==1000 && i>499) → both true → value 1 assigned to k. Output is k=1.

AMU MCA PYQ
What is the output of the following program? #include int main() { int i = 100, j = 300, k; j = i ^ j; i = i ^ j; j = i ^ j; printf("The values of i and j are %d, %d", i, j); return 0; }





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2022 PYQ

Solution

This is the XOR swap technique. After execution, values of i and j are swapped. So output is 300, 100.

AMU MCA PYQ
Suppose that in a C program snippet, following statements are used:
i) sizeof(int)
ii) sizeof(int*)
iii) sizeof(int**)
Assuming size of pointer is 4 bytes and size of int is also 4 bytes, pick the most correct answer.





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2025 PYQ

Solution

Given that size of int = 4 bytes and size of pointer = 4 bytes, sizeof(int) = sizeof(int*) = sizeof(int**) = 4 bytes.

AMU MCA PYQ
What is the purpose of the following C-function?
void str_function(char *s1)
{
    char *p1, *p2, t1;
    p1 = s1;
    p2 = s1;
    while (*p2 != '\0')
        p2++;
    p2--;
    while (p1 < p2)
    {
        t1 = *p1;
        *p1 = *p2;
        *p2 = t1;
        p1++;
        p2--;
    }
}





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2022 PYQ

Solution

Pointers move from start and end and swap characters until they meet ⇒ string is reversed.

AMU MCA PYQ
What will be the output of the following code fragment? (Assume that i, j and k are int variables)

i = j = k = 1;
(j + 2) % k / (i + 1);






Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2022 PYQ

Solution

$j=1,\ k=1,\ i=1$ $(j+2)%k = 3%1 = 0$ $0/(i+1)=0/2=0$

AMU MCA PYQ
What does ‘BREAK’ keyword do in C programming language?





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2025 PYQ

Solution

break immediately terminates the loop or switch statement.

AMU MCA PYQ
What will be the output of the following program?
int main()
{
    int *p, a = 12;
    p = &a;
    *p += 1;
    printf("12,");
    --*p;
    printf("%d, %d\n", *p, a);
    return 0;
}






Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2022 PYQ

Solution

a=12 → *p+=1 makes a=13. Then --*p makes a=12. Printed output becomes 12,12,12.

AMU MCA PYQ
Consider the array definition
int num[10] = {3, 3, 3};

Pick the correct answer:





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2025 PYQ

Solution

Array size is 10, so valid indices are 0 to 9. Hence num[9] is the last element. Uninitialized elements are set to 0.

AMU MCA PYQ
What is output for the program given below?
#include <stdio.h>
void main()
{
    int i = 500, j = 1000, k;
    k = (i > 500 && j == 1000);
    printf("k = %d", k);
}





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2025 PYQ

Solution

Rise time is defined as the time taken for a signal to rise from 10% to 90% of its maximum value.

AMU MCA PYQ
What is output for the program given below?
#include <stdio.h>
void main()
{
    int i = 7;
    for (; i < 12; i++);
    printf("%d", i);
}






Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2025 PYQ

Solution

The semicolon after for makes it an empty loop. Loop ends when i = 12, which gets printed.

AMU MCA PYQ
When the following code is executed, what will be the value of $x$ and $y$?
int x = 1, y = 0;
y = x++;





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2025 PYQ

Solution

Post-increment assigns old value of $x$ to $y$, then increments $x$. So $y = 1$, $x = 2$.

AMU MCA PYQ
What is the output for the program given below?
#include <stdio.h>
int main()
{
    char i = 2;
    switch(i)
    {
        case '1':
            printf("Black\n");
        case '2':
            printf("White\n");
        default:
            printf("Red\n");
    }
    printf("Blue");
    return 0;
}





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2022 PYQ

Solution

Solution:

i = 2 (numeric), but case '2' is character constant with ASCII value 50

No case matches, so default executes → prints Red

After switch, printf("Blue") always runs

AMU MCA PYQ
What is the output of this C code?
#include <stdio.h>
int main()
{
printf("Hello World! %d \n", x);
return 0;
}





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2021 PYQ

Solution

Variable x is not declared. Compiler error will occur.

AMU MCA PYQ
In C++, the declaration
int x; int &p = x;

is same as the declaration
int x, *p; p = &x;

This remark is





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2021 PYQ

Solution

Reference (&) is not same as pointer (*). Reference cannot be reseated, pointer can.

AMU MCA PYQ
Assume rand() returns an integer between 0 and 10000 (both inclusive). To simulate throwing a die:





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2021 PYQ

Solution

Dice values = 1 to 6 rand() % 6 gives 0–5 Add 1 → 1–6

AMU MCA PYQ
In C++, a variable defined within a block is visible





Go to Discussion

AMU MCA Previous Year PYQ AMU MCA AMU MCA 2021 PYQ

Solution

Block scope variable is visible only inside that block from its declaration onward.


AMU MCA


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

AMU MCA


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Limited Seats
× Aspire MCA Promotion

Game Changer NIMCET Test Series 2026

Boost your preparation with mock tests, analysis and rank-focused practice.

JOIN NOW
Ask Your Question or Put Your Review.

loading...