Skip to content
ExamHope Logo

examhope

Primary Menu
  • Digital Logic
    • Arithmetic Operations
    • Asynchronous/Ripple Counters
    • Basic Gates
    • Boolean Algebraic Theorems
    • Codes
  • Data Structures
    • Binary Heaps
    • Binary Search
    • Binary Search Trees
    • Binary Tree
    • Binary Tree Sort
    • Bipartite Graphs
    • Complete Graph
  • Theory of Computation
    • Finite Automata
    • Finite Automaton First Example
  • Current Affairs
    • Sports News
    • Tech News
    • Bollywood News
    • Daily News
  • Database
  • Computer Network
  • Computer Organization and Architecture
  • C Language
  • Operating Systems
  • Software Engineering
  • Theory of Computation
  • About us
  • Contact Us
  • Privacy Policy
  • DMCA Policy
  • Terms and Conditions
  • Home
  • IT
  • Function Prototypes and Parameters(pass by value, pass by reference) MCQs in C Language
  • IT
  • C Language
  • Function Prototypes and Parameters

Function Prototypes and Parameters(pass by value, pass by reference) MCQs in C Language

examhopeinfo@gmail.com October 24, 2025 20 minutes read
Function Prototypes and Parameters(pass by value, pass by reference) MCQs in C Language

Function Prototypes and Parameters(pass by value, pass by reference) MCQs in C Language


Function Prototypes and Parameters(pass by value, pass by reference) MCQs in C Language


1.

What is the output?

#include <stdio.h>
void fun(int a) {
    a = a + 5;
    printf("%d", a);
}
int main() {
    int x = 10;
    fun(x);
    printf("%d", x);
}

A) 15 10
B) 10 15
C) 15 15
D) 10 10

โœ… Answer: A
Explanation:
x is passed by value โ†’ a inside function is a copy โ†’ modified โ†’ prints 15. Original x remains 10 โ†’ prints 10.


2.

Which of the following is a correct function prototype?

A) int add(int,int);
B) add int(int,int);
C) void int add(int,int);
D) int() add;

โœ… Answer: A
Explanation:
Function prototype syntax โ†’ return_type function_name(parameter_types);.


3.

Output:

#include <stdio.h>
void swap(int *a,int *b) {
    int t = *a; *a = *b; *b = t;
}
int main() {
    int x = 2, y = 3;
    swap(&x,&y);
    printf("%d %d", x, y);
}

A) 2 3
B) 3 2
C) 5 5
D) Compiler error

โœ… Answer: B
Explanation:
Passing pointers โ†’ function modifies original variables โ†’ swapped โ†’ prints 3 2.


4.

Which statement is TRUE for pass by value?

A) Function can modify original variable
B) Function receives a copy โ†’ original unchanged
C) Requires pointers
D) Always faster

โœ… Answer: B
Explanation:
Call by value passes a copy โ†’ original variable remains unaffected.


5.

Output:

#include <stdio.h>
void increment(int *p) {
    (*p)++;
}
int main() {
    int x = 5;
    increment(&x);
    printf("%d", x);
}

A) 5
B) 6
C) Compiler error
D) 0

โœ… Answer: B
Explanation:
Passing pointer โ†’ increments original โ†’ prints 6.


6.

Output:

#include <stdio.h>
void fun(int a, int b) {
    a = a + 1; b = b + 1;
}
int main() {
    int x = 2, y = 3;
    fun(x,y);
    printf("%d %d", x,y);
}

A) 3 4
B) 2 3
C) 3 3
D) 2 4

โœ… Answer: B
Explanation:
Call by value โ†’ function modifies copies โ†’ original x,y unchanged โ†’ prints 2 3.


7.

Which is correct function prototype?

A) void swap(int a,int b);
B) void swap(int *a,int *b);
C) Both A & B
D) void swap(a,b);

โœ… Answer: C
Explanation:
Both are valid prototypes depending on pass by value or pass by reference via pointers.


8.

Output:

#include <stdio.h>
void display(int n) {
    printf("%d", n);
}
int main() {
    int x = 5;
    display(x+3);
}

A) 5
B) 8
C) 53
D) Compiler error

โœ… Answer: B
Explanation:
x+3 = 8 โ†’ passed by value โ†’ prints 8.


9.

Which of the following cannot be passed by reference?

A) Variable
B) Array
C) Pointer
D) Literal value

โœ… Answer: D
Explanation:
C cannot pass literals by reference โ†’ only variables or arrays.


10.

Output:

#include <stdio.h>
void add(int *a, int *b) {
    *a = *a + *b;
}
int main() {
    int x = 2, y = 3;
    add(&x,&y);
    printf("%d", x);
}

A) 2
B) 3
C) 5
D) Compiler error

โœ… Answer: C
Explanation:
Passing pointers โ†’ modifies original โ†’ x=2+3=5 โ†’ prints 5.


11.

Output:

#include <stdio.h>
void increment(int a) {
    a++;
}
int main() {
    int x = 10;
    increment(x);
    printf("%d", x);
}

A) 10
B) 11
C) Compiler error
D) 0

โœ… Answer: A
Explanation:
Call by value โ†’ function modifies copy โ†’ original x remains 10.


12.

Which of the following statements is TRUE about pass by reference?

A) Uses pointers
B) Original variable modified
C) Function can return void
D) All of the above

โœ… Answer: D
Explanation:
All statements are correct for pass by reference in C.


13.

Output:

#include <stdio.h>
void swap(int a,int b) {
    int t=a; a=b; b=t;
}
int main() {
    int x=2,y=3;
    swap(x,y);
    printf("%d %d", x,y);
}

A) 3 2
B) 2 3
C) 5 5
D) Compiler error

โœ… Answer: B
Explanation:
Call by value โ†’ only copies swapped โ†’ original unchanged โ†’ prints 2 3.


14.

Which is correct function pointer declaration?

A) int (*ptr)(int,int);
B) int ptr(*int,int);
C) (*int) ptr(int,int);
D) int *ptr(int,int);

โœ… Answer: A
Explanation:
ptr points to a function taking (int,int) and returning int.


15.

Output:

#include <stdio.h>
void fun(int *a) {
    (*a) += 10;
}
int main() {
    int x=5;
    fun(&x);
    printf("%d", x);
}

A) 5
B) 10
C) 15
D) Compiler error

โœ… Answer: C
Explanation:
Pointer allows modification โ†’ x = 5+10 = 15.


16.

Output:

#include <stdio.h>
int sum(int a,int b) {
    return a+b;
}
int main() {
    int (*ptr)(int,int)=sum;
    printf("%d", ptr(2,3));
}

A) Compiler error
B) 23
C) 5
D) 6

โœ… Answer: C
Explanation:
Function pointer calls sum(2,3) โ†’ returns 5 โ†’ printed.


17.

Output:

#include <stdio.h>
void add(int *a,int *b) {
    *a = *a + *b;
}
int main() {
    int x=2, y=3;
    add(&x,&y);
    printf("%d", x);
}

A) 2
B) 3
C) 5
D) Compiler error

โœ… Answer: C
Explanation:
Passing pointers โ†’ modifies x โ†’ prints 5.


18.

Which is incorrect call for void fun(int,int);?

A) fun(2,3);
B) fun(1,1);
C) fun(5);
D) fun(0,0);

โœ… Answer: C
Explanation:
Function expects 2 parameters โ†’ passing 1 โ†’ compiler error.


19.

Output:

#include <stdio.h>
void increment(int *p) {
    *p = *p + 1;
}
int main() {
    int a=7;
    increment(&a);
    printf("%d", a);
}

A) 7
B) 8
C) 0
D) Compiler error

โœ… Answer: B
Explanation:
Pointer modifies original โ†’ 7+1=8 โ†’ printed.


20.

Output:

#include <stdio.h>
void fun(int x) {
    x = x*2;
}
int main() {
    int a=5;
    fun(a);
    printf("%d", a);
}

A) 5
B) 10
C) Compiler error
D) 0

โœ… Answer: A
Explanation:
Call by value โ†’ a unchanged โ†’ prints 5.

21.

Output:

#include <stdio.h>
void fun(int arr[]) {
    arr[0] = 100;
}
int main() {
    int a[3] = {1,2,3};
    fun(a);
    printf("%d", a[0]);
}

A) 1
B) 100
C) 0
D) Compiler error

โœ… Answer: B
Explanation:
Arrays decay to pointers โ†’ arr[0] modifies original array โ†’ prints 100.


22.

Output:

#include <stdio.h>
void fun(int *x) {
    *x += 10;
}
int main() {
    int a=5;
    fun(&a);
    printf("%d", a);
}

A) 5
B) 10
C) 15
D) Compiler error

โœ… Answer: C
Explanation:
Pointer allows modification โ†’ a = 5+10 = 15 โ†’ printed.


23.

Which of the following is correct call by reference?

A) fun(a); where void fun(int *p)
B) fun(&a); where void fun(int *p)
C) fun(*a); where void fun(int *p)
D) fun(a*2); where void fun(int *p)

โœ… Answer: B
Explanation:
Function expects pointer โ†’ pass address of variable using &a.


24.

Output:

#include <stdio.h>
void swap(int *a,int *b) {
    int t=*a; *a=*b; *b=t;
}
int main() {
    int x=3,y=7;
    swap(&x,&y);
    printf("%d %d", x,y);
}

A) 3 7
B) 7 3
C) 10 10
D) Compiler error

โœ… Answer: B
Explanation:
Pass by reference via pointer โ†’ original variables swapped โ†’ 7 3.


25.

Output:

#include <stdio.h>
void fun(int x) {
    x = x*2;
}
int main() {
    int a=4;
    fun(a);
    printf("%d", a);
}

A) 4
B) 8
C) Compiler error
D) 0

โœ… Answer: A
Explanation:
Call by value โ†’ original variable a unchanged โ†’ prints 4.


26.

Output:

#include <stdio.h>
void add(int *a,int *b) {
    *a += *b;
    *b = *a - *b;
}
int main() {
    int x=2,y=3;
    add(&x,&y);
    printf("%d %d", x,y);
}

A) 5 2
B) 2 3
C) 5 3
D) 5 5

โœ… Answer: A
Explanation:
x=2+3=5, y=5-3=2 โ†’ prints 5 2.


27.

Which is true about passing arrays to functions?

A) Arrays always passed by value
B) Arrays always passed by reference (decay to pointer)
C) Arrays cannot be passed
D) Arrays are copied internally

โœ… Answer: B
Explanation:
Arrays decay to pointers โ†’ function can modify original array elements.


28.

Output:

#include <stdio.h>
void fun(int a[]) {
    a[1] = a[1] + 5;
}
int main() {
    int arr[3] = {1,2,3};
    fun(arr);
    printf("%d", arr[1]);
}

A) 2
B) 7
C) 5
D) Compiler error

โœ… Answer: B
Explanation:
arr decays to pointer โ†’ arr[1] modified โ†’ prints 7.


29.

Output:

#include <stdio.h>
void increment(int *p) {
    (*p)++;
}
int main() {
    int x=10;
    increment(&x);
    increment(&x);
    printf("%d", x);
}

A) 10
B) 11
C) 12
D) 13

โœ… Answer: C
Explanation:
Two increments โ†’ 10+1+1=12 โ†’ printed.


30.

Which is TRUE about function prototypes in C?

A) Parameter names are mandatory
B) Parameter types are mandatory
C) Function must be defined immediately
D) Return type can be omitted

โœ… Answer: B
Explanation:
Parameter types are mandatory in prototype; names optional.


31.

Output:

#include <stdio.h>
void fun(int a,int b) {
    a += b;
    b += a;
}
int main() {
    int x=1,y=2;
    fun(x,y);
    printf("%d %d", x,y);
}

A) 1 2
B) 3 5
C) 3 3
D) 1 5

โœ… Answer: A
Explanation:
Call by value โ†’ modifications inside fun() do not affect original variables.


32.

Output:

#include <stdio.h>
void modify(int *p) {
    *p *= 2;
}
int main() {
    int a=7;
    modify(&a);
    printf("%d", a);
}

A) 7
B) 14
C) 0
D) Compiler error

โœ… Answer: B
Explanation:
Pointer modifies original variable โ†’ 7*2=14 โ†’ printed.


33.

Which statement is TRUE?

A) Passing literal to a function requiring pointer is valid
B) Function prototype allows only return type
C) Pass by value cannot modify original variable
D) Function cannot return pointer

โœ… Answer: C
Explanation:
Call by value โ†’ function modifies copy only โ†’ original variable unaffected.


34.

Output:

#include <stdio.h>
void swap(int *a,int *b) {
    int t=*a; *a=*b; *b=t;
}
int main() {
    int x=5,y=10;
    swap(&x,&y);
    printf("%d %d", x,y);
}

A) 5 10
B) 10 5
C) 15 5
D) 5 15

โœ… Answer: B
Explanation:
Pass by reference swaps original values โ†’ prints 10 5.


35.

Output:

#include <stdio.h>
void fun(int n) {
    if(n==0) return;
    printf("%d", n);
    fun(n-1);
}
int main() {
    fun(3);
}

A) 123
B) 321
C) 3
D) Compiler error

โœ… Answer: B
Explanation:
Recursion prints n down โ†’ 3 2 1 โ†’ B.


36.

Output:

#include <stdio.h>
void fun(int *a,int *b) {
    *a = *a + *b;
}
int main() {
    int x=2,y=3;
    fun(&x,&y);
    printf("%d", x);
}

A) 2
B) 3
C) 5
D) Compiler error

โœ… Answer: C
Explanation:
x modified via pointer โ†’ prints 5.


37.

Output:

#include <stdio.h>
void increment(int a[]) {
    a[0]++;
}
int main() {
    int arr[2]={1,2};
    increment(arr);
    printf("%d", arr[0]);
}

A) 1
B) 2
C) 3
D) Compiler error

โœ… Answer: B
Explanation:
Array passed by reference โ†’ arr[0]=1+1=2 โ†’ printed.


38.

Which is FALSE about pass by reference using pointers?

A) Function can modify original variable
B) Can pass array
C) Can pass pointer
D) Can pass literal value

โœ… Answer: D
Explanation:
Cannot pass literal โ†’ no address to reference.


39.

Output:

#include <stdio.h>
void fun(int *p) {
    *p += 5;
}
int main() {
    int a=10;
    fun(&a);
    printf("%d", a);
}

A) 10
B) 5
C) 15
D) Compiler error

โœ… Answer: C
Explanation:
Pointer modifies original variable โ†’ 10+5=15 โ†’ printed.


40.

Output:

#include <stdio.h>
void fun(int a) {
    a += 10;
}
int main() {
    int x=5;
    fun(x);
    printf("%d", x);
}

A) 5
B) 15
C) Compiler error
D) 0

โœ… Answer: A
Explanation:
Call by value โ†’ original x unchanged โ†’ prints 5.

41.

Output:

#include <stdio.h>
void fun(int *p) {
    *p += 2;
}
int main() {
    int a=3;
    fun(&a);
    fun(&a);
    printf("%d", a);
}

A) 3
B) 4
C) 5
D) 7

โœ… Answer: D
Explanation:
Two increments via pointer โ†’ 3+2=5, 5+2=7 โ†’ printed 7.


42.

Which is correct function prototype for a function returning a pointer to int?

A) int* fun(int a);
B) int fun*(int a);
C) *int fun(int a);
D) int fun(int a*);

โœ… Answer: A
Explanation:
Correct syntax โ†’ return type int*, function name fun, parameter int a.


43.

Output:

#include <stdio.h>
void fun(int a[]) {
    a[0] = a[0] + 5;
}
int main() {
    int arr[2]={2,3};
    fun(arr);
    printf("%d", arr[0]);
}

A) 2
B) 5
C) 7
D) Compiler error

โœ… Answer: C
Explanation:
Array passed by reference โ†’ arr[0] modified โ†’ 2+5=7.


44.

Output:

#include <stdio.h>
void add(int *a,int *b) {
    *a = *a + *b;
    *b = *a - *b;
}
int main() {
    int x=3,y=4;
    add(&x,&y);
    printf("%d %d", x,y);
}

A) 3 4
B) 7 3
C) 7 4
D) Compiler error

โœ… Answer: B
Explanation:
x = x+y = 7, y = 7-4 =3 โ†’ prints 7 3.


45.

Which is TRUE for pass by value?

A) Function can modify original variable
B) Function cannot modify original variable
C) Always faster than pass by reference
D) Cannot pass arrays

โœ… Answer: B
Explanation:
Function receives a copy โ†’ original variable remains unchanged.


46.

Output:

#include <stdio.h>
void fun(int *a,int b) {
    *a = *a + b;
}
int main() {
    int x=2,y=3;
    fun(&x,y);
    printf("%d", x);
}

A) 2
B) 3
C) 5
D) Compiler error

โœ… Answer: C
Explanation:
Pointer allows modification of x โ†’ x = 2+3=5.


47.

Which is correct function declaration?

A) int sum(int,int);
B) int sum(a,b); int a,b;
C) int sum(int a,int b) { return a+b; }
D) All of the above

โœ… Answer: D
Explanation:
All are valid C declarations/definitions.


48.

Output:

#include <stdio.h>
void fun(int *a,int *b) {
    int t=*a; *a=*b; *b=t;
}
int main() {
    int x=5,y=8;
    fun(&x,&y);
    printf("%d %d", x,y);
}

A) 5 8
B) 8 5
C) 13 8
D) 5 13

โœ… Answer: B
Explanation:
Pointers allow swapping โ†’ prints 8 5.


49.

Output:

#include <stdio.h>
void increment(int arr[], int n) {
    for(int i=0;i<n;i++) arr[i]++;
}
int main() {
    int a[3]={1,2,3};
    increment(a,3);
    printf("%d", a[2]);
}

A) 3
B) 4
C) 5
D) Compiler error

โœ… Answer: B
Explanation:
arr[2]=3 โ†’ incremented by 1 โ†’ 4 โ†’ printed.


50.

Which is FALSE about pass by reference using pointers?

A) Original variable can be modified
B) Arrays can be passed
C) Pointers can be passed
D) Literal values can be passed

โœ… Answer: D
Explanation:
Cannot pass literal โ†’ no memory address.


51.

Output:

#include <stdio.h>
void fun(int *p) {
    (*p) += 5;
}
int main() {
    int a=7;
    fun(&a);
    fun(&a);
    printf("%d", a);
}

A) 7
B) 12
C) 17
D) Compiler error

โœ… Answer: C
Explanation:
Two increments: 7+5=12, 12+5=17 โ†’ printed 17.


52.

Output:

#include <stdio.h>
void fun(int x) {
    x = x*2;
}
int main() {
    int a=4;
    fun(a);
    printf("%d", a);
}

A) 4
B) 8
C) Compiler error
D) 0

โœ… Answer: A
Explanation:
Call by value โ†’ original variable unchanged โ†’ prints 4.


53.

Which is TRUE about array parameter in C?

A) Arrays are passed by value
B) Arrays decay to pointers โ†’ pass by reference
C) Array elements cannot be modified inside function
D) Function cannot accept array

โœ… Answer: B
Explanation:
Arrays decay to pointers โ†’ modifications inside function affect original array.


54.

Output:

#include <stdio.h>
void add(int *a,int *b) {
    *a = *a + *b;
    *b = *a - *b;
}
int main() {
    int x=3,y=5;
    add(&x,&y);
    printf("%d %d", x,y);
}

A) 3 5
B) 8 3
C) 8 5
D) Compiler error

โœ… Answer: B
Explanation:
x=3+5=8, y=8-5=3 โ†’ prints 8 3.


55.

Output:

#include <stdio.h>
void fun(int a) {
    a++;
}
int main() {
    int x=10;
    fun(x);
    printf("%d", x);
}

A) 10
B) 11
C) Compiler error
D) 0

โœ… Answer: A
Explanation:
Call by value โ†’ original x unchanged โ†’ prints 10.


56.

Which is correct function pointer syntax?

A) void (*fp)(int);
B) int (*fp)();
C) char (*fp)(char);
D) All of the above

โœ… Answer: D
Explanation:
All are correct function pointer declarations.


57.

Output:

#include <stdio.h>
void fun(int *p) {
    *p = *p*2;
}
int main() {
    int x=5;
    fun(&x);
    printf("%d", x);
}

A) 5
B) 10
C) 0
D) Compiler error

โœ… Answer: B
Explanation:
Pointer modifies x โ†’ x=5*2=10 โ†’ printed.


58.

Which is TRUE for function prototype?

A) Must specify return type
B) Parameter types mandatory
C) Parameter names optional
D) All of the above

โœ… Answer: D
Explanation:
All statements are correct.


59.

Output:

#include <stdio.h>
void fun(int arr[2]) {
    arr[1] += 5;
}
int main() {
    int a[2]={1,2};
    fun(a);
    printf("%d", a[1]);
}

A) 2
B) 5
C) 7
D) Compiler error

โœ… Answer: C
Explanation:
Array passed by reference โ†’ arr[1]=2+5=7 โ†’ printed.


60.

Output:

#include <stdio.h>
void swap(int *x,int *y) {
    int t=*x; *x=*y; *y=t;
}
int main() {
    int a=3,b=6;
    swap(&a,&b);
    printf("%d %d", a,b);
}

A) 3 6
B) 6 3
C) 9 6
D) 3 9

โœ… Answer: B
Explanation:
Pointers swap values โ†’ prints 6 3.


61.

Output:

#include <stdio.h>
void multiply(int *a,int b) {
    *a = *a * b;
}
int main() {
    int x=3;
    multiply(&x,4);
    printf("%d", x);
}

A) 3
B) 4
C) 12
D) Compiler error

โœ… Answer: C
Explanation:
Pointer modifies original variable โ†’ 3*4=12 โ†’ printed.


62.

Which is correct function prototype for a function taking an array of integers?

A) void fun(int arr[]);
B) void fun(int *arr);
C) Both A & B
D) void fun(int arr);

โœ… Answer: C
Explanation:
Array decays to pointer โ†’ both are valid prototypes.


63.

Output:

#include <stdio.h>
void fun(int *p) {
    (*p)++;
}
int main() {
    int a=7;
    fun(&a);
    fun(&a);
    printf("%d", a);
}

A) 7
B) 8
C) 9
D) 10

โœ… Answer: C
Explanation:
Two increments: 7+1+1=9 โ†’ printed.


64.

Which is FALSE about function pointers?

A) Can store address of a function
B) Can call a function indirectly
C) Can point to variables
D) Can be passed as arguments

โœ… Answer: C
Explanation:
Function pointers point to functions, not variables.


65.

Output:

#include <stdio.h>
void swap(int *a,int *b) {
    int t=*a; *a=*b; *b=t;
}
int main() {
    int x=8,y=5;
    swap(&x,&y);
    printf("%d %d", x,y);
}

A) 8 5
B) 5 8
C) 13 5
D) 8 13

โœ… Answer: B
Explanation:
Pointers swap original values โ†’ prints 5 8.


66.

Output:

#include <stdio.h>
void fun(int *arr,int n) {
    for(int i=0;i<n;i++) arr[i] += 2;
}
int main() {
    int a[3]={1,2,3};
    fun(a,3);
    printf("%d", a[2]);
}

A) 3
B) 4
C) 5
D) Compiler error

โœ… Answer: C
Explanation:
a[2]=3 โ†’ incremented by 2 โ†’ 5 โ†’ printed.


67.

Which is TRUE about pass by reference using pointers?

A) Function can modify original variable
B) Can pass array or pointer
C) Literal cannot be passed
D) All of the above

โœ… Answer: D
Explanation:
All statements are correct.


68.

Output:

#include <stdio.h>
void increment(int *x,int *y) {
    (*x)++; (*y)++;
}
int main() {
    int a=1,b=2;
    increment(&a,&b);
    printf("%d %d", a,b);
}

A) 1 2
B) 2 3
C) 1 3
D) 2 2

โœ… Answer: B
Explanation:
Pointers modify original variables โ†’ a=2, b=3 โ†’ printed.


69.

Output:

#include <stdio.h>
void fun(int x) {
    x *= 2;
}
int main() {
    int a=5;
    fun(a);
    printf("%d", a);
}

A) 5
B) 10
C) Compiler error
D) 0

โœ… Answer: A
Explanation:
Call by value โ†’ original variable unchanged โ†’ prints 5.


70.

Output:

#include <stdio.h>
int sum(int *arr,int n) {
    int s=0;
    for(int i=0;i<n;i++) s += arr[i];
    return s;
}
int main() {
    int a[3]={1,2,3};
    printf("%d", sum(a,3));
}

A) 3
B) 6
C) 1
D) Compiler error

โœ… Answer: B
Explanation:
Sum = 1+2+3 = 6 โ†’ printed.


71.

Output:

#include <stdio.h>
void fun(int *x) {
    *x += 5;
}
int main() {
    int a=10;
    fun(&a);
    printf("%d", a);
}

A) 10
B) 5
C) 15
D) Compiler error

โœ… Answer: C
Explanation:
Pointer modifies original โ†’ 10+5=15 โ†’ printed.


72.

Which is FALSE about function prototype in C?

A) Return type must be specified
B) Parameter types mandatory
C) Parameter names are mandatory
D) Function must be defined after prototype

โœ… Answer: C
Explanation:
Parameter names are optional in prototype.


73.

Output:

#include <stdio.h>
void swap(int *a,int *b) {
    int t=*a; *a=*b; *b=t;
}
int main() {
    int x=4,y=9;
    swap(&x,&y);
    printf("%d %d", x,y);
}

A) 4 9
B) 9 4
C) 13 9
D) 4 13

โœ… Answer: B
Explanation:
Pointers swap original โ†’ prints 9 4.


74.

Output:

#include <stdio.h>
void modify(int arr[]) {
    arr[0] = arr[0]*2;
}
int main() {
    int a[2]={3,5};
    modify(a);
    printf("%d", a[0]);
}

A) 3
B) 6
C) 5
D) Compiler error

โœ… Answer: B
Explanation:
Array passed by reference โ†’ a[0]=3*2=6 โ†’ printed.


75.

Which is TRUE about arrays as function parameters?

A) Passed by value
B) Passed by reference (decay to pointer)
C) Cannot be modified in function
D) Cannot be passed

โœ… Answer: B
Explanation:
Arrays decay to pointer โ†’ modifications inside function affect original array.


76.

Output:

#include <stdio.h>
void fun(int *p,int n) {
    for(int i=0;i<n;i++) p[i]+=1;
}
int main() {
    int a[3]={1,2,3};
    fun(a,3);
    printf("%d", a[1]);
}

A) 2
B) 3
C) 4
D) Compiler error

โœ… Answer: B
Explanation:
a[1]=2 โ†’ incremented by 1 โ†’ 3 โ†’ printed.


77.

Output:

#include <stdio.h>
void fun(int *x,int *y) {
    *x = *x + *y;
}
int main() {
    int a=2,b=3;
    fun(&a,&b);
    printf("%d", a);
}

A) 2
B) 3
C) 5
D) Compiler error

โœ… Answer: C
Explanation:
a modified via pointer โ†’ 2+3=5 โ†’ printed.


78.

Which is TRUE about passing struct to function by reference?

A) Use pointer to struct
B) Can modify original struct
C) Saves memory for large structs
D) All of the above

โœ… Answer: D
Explanation:
All statements correct โ†’ pointer allows pass by reference.


79.

Output:

#include <stdio.h>
void fun(int *x) {
    *x *= 2;
}
int main() {
    int a=6;
    fun(&a);
    printf("%d", a);
}

A) 6
B) 12
C) 0
D) Compiler error

โœ… Answer: B
Explanation:
Pointer modifies a โ†’ 6*2=12 โ†’ printed.


80.

Output:

#include <stdio.h>
void fun(int x) {
    x += 10;
}
int main() {
    int a=5;
    fun(a);
    printf("%d", a);
}

A) 5
B) 15
C) Compiler error
D) 0

โœ… Answer: A
Explanation:
Call by value โ†’ original variable unchanged โ†’ prints 5.

81.

Output:

#include <stdio.h>
void fun(int *p) {
    (*p)++;
}
int main() {
    int x=1;
    fun(&x);
    fun(&x);
    fun(&x);
    printf("%d", x);
}

A) 1
B) 2
C) 3
D) 4

โœ… Answer: D
Explanation:
Three increments via pointer: 1+1+1+1=4 โ†’ printed.


82.

Output:

#include <stdio.h>
void fun(int *x,int *y) {
    *x = *x + *y;
}
int main() {
    int a=3,b=5;
    fun(&a,&b);
    printf("%d %d", a,b);
}

A) 3 5
B) 8 5
C) 8 3
D) Compiler error

โœ… Answer: B
Explanation:
a modified via pointer โ†’ 3+5=8, b unchanged โ†’ prints 8 5.


83.

Output:

#include <stdio.h>
void fun(int *arr,int n) {
    for(int i=0;i<n;i++) arr[i] *= 2;
}
int main() {
    int a[3]={1,2,3};
    fun(a,3);
    printf("%d", a[2]);
}

A) 3
B) 6
C) 4
D) Compiler error

โœ… Answer: B
Explanation:
a[2]=3 โ†’ multiplied by 2 โ†’ 6 โ†’ printed.


84.

Which is FALSE about pass by value?

A) Original variable remains unchanged
B) Function receives a copy
C) Can modify original variable
D) Faster than pass by reference (usually)

โœ… Answer: C
Explanation:
Call by value cannot modify original variable.


85.

Output:

#include <stdio.h>
void fun(int *p) {
    *p = *p*3;
}
int main() {
    int x=2;
    fun(&x);
    printf("%d", x);
}

A) 2
B) 6
C) 0
D) Compiler error

โœ… Answer: B
Explanation:
Pointer multiplies original โ†’ 2*3=6 โ†’ printed.


86.

Output:

#include <stdio.h>
void fun(int x[]) {
    x[0] += 10;
}
int main() {
    int a[2]={5,7};
    fun(a);
    printf("%d", a[0]);
}

A) 5
B) 7
C) 15
D) Compiler error

โœ… Answer: C
Explanation:
Array decays to pointer โ†’ a[0]=5+10=15 โ†’ printed.


87.

Output:

#include <stdio.h>
void modify(int *a,int *b) {
    int temp=*a;
    *a=*b; *b=temp;
}
int main() {
    int x=4,y=9;
    modify(&x,&y);
    printf("%d %d", x,y);
}

A) 4 9
B) 9 4
C) 13 9
D) 4 13

โœ… Answer: B
Explanation:
Pointers swap values โ†’ prints 9 4.


88.

Output:

#include <stdio.h>
void increment(int x) {
    x += 10;
}
int main() {
    int a=7;
    increment(a);
    printf("%d", a);
}

A) 7
B) 17
C) Compiler error
D) 0

โœ… Answer: A
Explanation:
Call by value โ†’ original variable unchanged โ†’ prints 7.


89.

Output:

#include <stdio.h>
void sum(int *arr,int n,int *res) {
    *res=0;
    for(int i=0;i<n;i++) *res += arr[i];
}
int main() {
    int a[3]={1,2,3}, s;
    sum(a,3,&s);
    printf("%d", s);
}

A) 3
B) 6
C) 1
D) Compiler error

โœ… Answer: B
Explanation:
Sum of array =1+2+3=6 โ†’ printed.


90.

Output:

#include <stdio.h>
void fun(int *x,int n) {
    for(int i=0;i<n;i++) (*x)++;
}
int main() {
    int a=3;
    fun(&a,4);
    printf("%d", a);
}

A) 3
B) 4
C) 7
D) 8

โœ… Answer: D
Explanation:
4 increments via pointer โ†’ 3+4=7 โ†’ wait, let’s recalc carefully.

  • Initial a=3
  • fun increments *x 4 times: 3โ†’4โ†’5โ†’6โ†’7 โœ… Correct
    So correct printed value is 7, not 8.

โœ… Answer: C
Explanation:
Pointer increments 4 times โ†’ 3+4=7 โ†’ printed.


91.

Output:

#include <stdio.h>
void fun(int *p) {
    *p += 10;
}
int main() {
    int a=5;
    fun(&a);
    fun(&a);
    printf("%d", a);
}

A) 5
B) 10
C) 25
D) 15

โœ… Answer: D
Explanation:
Two increments: 5+10=15, 15+10=25 โœ… Wait recalc

  • First fun: 5+10=15
  • Second fun: 15+10=25 โœ… Correct

โœ… Answer: C
Explanation:
Pointer modifies original variable twice โ†’ 25 โ†’ printed.


92.

Which is TRUE about static local variables with function calls?

A) Value persists across calls
B) Resets on every call
C) Cannot be used with pointers
D) Only global variables persist

โœ… Answer: A
Explanation:
Static local variable retains value between function calls.


93.

Output:

#include <stdio.h>
void fun(int *x,int *y) {
    *x = *x + *y;
    *y = *x - *y;
}
int main() {
    int a=2,b=3;
    fun(&a,&b);
    printf("%d %d", a,b);
}

A) 2 3
B) 5 2
C) 5 3
D) Compiler error

โœ… Answer: B
Explanation:
a=2+3=5, b=5-3=2 โ†’ prints 5 2.


94.

Output:

#include <stdio.h>
void increment(int *p) {
    (*p)++;
}
int main() {
    int x=0;
    increment(&x);
    increment(&x);
    increment(&x);
    printf("%d", x);
}

A) 0
B) 1
C) 2
D) 3

โœ… Answer: D
Explanation:
Three increments via pointer โ†’ 0+1+1+1=3 โ†’ printed.


95.

Output:

#include <stdio.h>
void fun(int a,int *b) {
    a = a+2; *b = *b+2;
}
int main() {
    int x=2,y=3;
    fun(x,&y);
    printf("%d %d", x,y);
}

A) 2 3
B) 4 5
C) 4 3
D) 2 5

โœ… Answer: D
Explanation:
x passed by value โ†’ unchanged, y passed by reference โ†’ y=3+2=5 โ†’ prints 2 5.


96.

Output:

#include <stdio.h>
void swap(int *a,int *b) {
    int t=*a; *a=*b; *b=t;
}
int main() {
    int x=1,y=2;
    swap(&x,&y);
    printf("%d %d", x,y);
}

A) 1 2
B) 2 1
C) 3 2
D) 1 3

โœ… Answer: B
Explanation:
Pointers swap values โ†’ prints 2 1.


97.

Output:

#include <stdio.h>
void doubleValue(int *x) {
    *x *= 2;
}
int main() {
    int a=5;
    doubleValue(&a);
    printf("%d", a);
}

A) 5
B) 10
C) 0
D) Compiler error

โœ… Answer: B
Explanation:
Pointer multiplies a โ†’ 5*2=10 โ†’ printed.


98.

Output:

#include <stdio.h>
void fun(int a[]) {
    a[1] += 3;
}
int main() {
    int arr[2]={2,5};
    fun(arr);
    printf("%d", arr[1]);
}

A) 2
B) 5
C) 8
D) Compiler error

โœ… Answer: C
Explanation:
Array passed by reference โ†’ arr[1]=5+3=8 โ†’ printed.


99.

Output:

#include <stdio.h>
void fun(int *a,int *b) {
    *a = *a+*b;
    *b = *a-*b;
}
int main() {
    int x=1,y=2;
    fun(&x,&y);
    printf("%d %d", x,y);
}

A) 1 2
B) 3 1
C) 3 2
D) Compiler error

โœ… Answer: B
Explanation:
x=1+2=3, y=3-2=1 โ†’ prints 3 1.


100.

Output:

#include <stdio.h>
void fun(int a) {
    a++;
}
int main() {
    int x=7;
    fun(x);
    printf("%d", x);
}

A) 7
B) 8
C) Compiler error
D) 0

โœ… Answer: A
Explanation:
Call by value โ†’ original variable unchanged โ†’ prints 7.

About the Author

examhopeinfo@gmail.com

Administrator

Visit Website View All Posts

Post navigation

Previous: Defining and Calling Functions MCQs in C Language
Next: Recursion MCQs in C Language

Related News

Vivo X200 Price Drop
  • IT
  • Current Affairs
  • Tech News

Vivo X200: เคœเคพเคจเฅ‡ เค•เคฟเคคเคจเฅ€ เค•เคฎ เค•เฅ€เคฎเคค เคชเคฐ เคฎเคฟเคฒ เคฐเคนเคพ เคฏเฅ‡ 9400 เคฎเคฟเคกเคฟเคฏเคพ เคŸเฅ‡เค• เคชเฅเคฐเฅ‹เคธเฅ‡เคธเคฐ เคตเคพเคฒเคพ เคธเฅเคฎเคพเคฐเฅเคŸเคซเฅ‹เคจ

examhopeinfo@gmail.com December 23, 2025 0
Samsung Galaxy S25 Plus
  • IT
  • Current Affairs
  • Tech News

Samsung Galaxy S25 Plus เคชเคฐ เคฎเคฟเคฒ เคฐเคนเฅ€ เคญเคพเคฐเฅ€ เค›เฅ‚เคŸ ,เคœเคพเคจเฅ‡ เคธเฅ‡เคฒ เคชเฅเคฐเคพเค‡เคธ

examhopeinfo@gmail.com December 22, 2025 0
Electricity bill saving Smart Plug
  • IT
  • Current Affairs
  • Tech News

AI เค•เฅ‡ เค‡เคธ เฅ›เคฎเคพเคจเฅ‡ เคฎเฅ‡เค‚ เค•เฅˆเคธเฅ‡ เคฌเคฟเคœเคฒเฅ€ เคฌเคšเคพ เคฐเคนเฅ‡ เคนเฅˆเค‚ เคฏเคน เคธเฅเคฎเคพเคฐเฅเคŸ เคชเฅเคฒเค—?

examhopeinfo@gmail.com December 21, 2025 0

Recent Posts

  • Vivo X200: เคœเคพเคจเฅ‡ เค•เคฟเคคเคจเฅ€ เค•เคฎ เค•เฅ€เคฎเคค เคชเคฐ เคฎเคฟเคฒ เคฐเคนเคพ เคฏเฅ‡ 9400 เคฎเคฟเคกเคฟเคฏเคพ เคŸเฅ‡เค• เคชเฅเคฐเฅ‹เคธเฅ‡เคธเคฐ เคตเคพเคฒเคพ เคธเฅเคฎเคพเคฐเฅเคŸเคซเฅ‹เคจ
  • Samsung Galaxy S25 Plus เคชเคฐ เคฎเคฟเคฒ เคฐเคนเฅ€ เคญเคพเคฐเฅ€ เค›เฅ‚เคŸ ,เคœเคพเคจเฅ‡ เคธเฅ‡เคฒ เคชเฅเคฐเคพเค‡เคธ
  • AI เค•เฅ‡ เค‡เคธ เฅ›เคฎเคพเคจเฅ‡ เคฎเฅ‡เค‚ เค•เฅˆเคธเฅ‡ เคฌเคฟเคœเคฒเฅ€ เคฌเคšเคพ เคฐเคนเฅ‡ เคนเฅˆเค‚ เคฏเคน เคธเฅเคฎเคพเคฐเฅเคŸ เคชเฅเคฒเค—?
  • เค•เฅเคฏเคพ เคนเฅˆ เคฏเคน GhostPairing Scam เค”เคฐ เคฌเคฟเคจเคพ เคชเคพเคธเคตเคฐเฅเคก เค”เคฐ เคธเคฟเคฎ เค•เฅ‡ เค•เฅเคฏเฅ‹เค‚ เคนเฅ‹ เคฐเคนเคพ เคนเฅˆ เคตเฅเคนเคพเคŸเฅเคธเคชเฅเคช เค…เค•เคพเค‰เค‚เคŸ เคนเฅˆเค•
  • Leica เค•เฅˆเคฎเคฐเฅ‡ เค•เฅ‡ เคธเคพเคฅ เคœเคฒเฅเคฆ เคฒเฅ‰เคจเฅเคš เคนเฅ‹ เคธเค•เคคเคพ เคนเฅˆ Xiaomi Ultra 17

At ExamHope, we understand that preparing for exams can be challenging, overwhelming, and sometimes stressful. Thatโ€™s why we are dedicated to providing high-quality educational resources, tips, and guidance to help students and aspirants achieve their goals with confidence. Whether you are preparing for competitive exams, school tests, or professional certifications, ExamHope is here to make your learning journey smarter, easier, and more effective.

Quick links

  • About us
  • Contact Us
  • Privacy Policy
  • Terms and Conditions
  • Disclaimer
  • DMCA Policy

Category

  • Computer Network
  • Computer Organization and Architecture
  • Data Structures
  • C Language
  • Theory of Computation
  • Database

You may have missed

Vivo X200 Price Drop
  • IT
  • Current Affairs
  • Tech News

Vivo X200: เคœเคพเคจเฅ‡ เค•เคฟเคคเคจเฅ€ เค•เคฎ เค•เฅ€เคฎเคค เคชเคฐ เคฎเคฟเคฒ เคฐเคนเคพ เคฏเฅ‡ 9400 เคฎเคฟเคกเคฟเคฏเคพ เคŸเฅ‡เค• เคชเฅเคฐเฅ‹เคธเฅ‡เคธเคฐ เคตเคพเคฒเคพ เคธเฅเคฎเคพเคฐเฅเคŸเคซเฅ‹เคจ

examhopeinfo@gmail.com December 23, 2025 0
Samsung Galaxy S25 Plus
  • IT
  • Current Affairs
  • Tech News

Samsung Galaxy S25 Plus เคชเคฐ เคฎเคฟเคฒ เคฐเคนเฅ€ เคญเคพเคฐเฅ€ เค›เฅ‚เคŸ ,เคœเคพเคจเฅ‡ เคธเฅ‡เคฒ เคชเฅเคฐเคพเค‡เคธ

examhopeinfo@gmail.com December 22, 2025 0
Electricity bill saving Smart Plug
  • IT
  • Current Affairs
  • Tech News

AI เค•เฅ‡ เค‡เคธ เฅ›เคฎเคพเคจเฅ‡ เคฎเฅ‡เค‚ เค•เฅˆเคธเฅ‡ เคฌเคฟเคœเคฒเฅ€ เคฌเคšเคพ เคฐเคนเฅ‡ เคนเฅˆเค‚ เคฏเคน เคธเฅเคฎเคพเคฐเฅเคŸ เคชเฅเคฒเค—?

examhopeinfo@gmail.com December 21, 2025 0
Ghost Pairing Scam on Whatsapp
  • IT
  • Current Affairs
  • Tech News

เค•เฅเคฏเคพ เคนเฅˆ เคฏเคน GhostPairing Scam เค”เคฐ เคฌเคฟเคจเคพ เคชเคพเคธเคตเคฐเฅเคก เค”เคฐ เคธเคฟเคฎ เค•เฅ‡ เค•เฅเคฏเฅ‹เค‚ เคนเฅ‹ เคฐเคนเคพ เคนเฅˆ เคตเฅเคนเคพเคŸเฅเคธเคชเฅเคช เค…เค•เคพเค‰เค‚เคŸ เคนเฅˆเค•

examhopeinfo@gmail.com December 21, 2025 0
Copyright ยฉ All rights reserved for ExamHope. | MoreNews by AF themes.
Go to mobile version