C- arrays , pointers and functions and macros  MCQs

C- arrays , pointers and functions and macros MCQs

University

20 Qs

quiz-placeholder

Similar activities

Exploring C# Arrays and For Statements

Exploring C# Arrays and For Statements

University

15 Qs

C Operators

C Operators

University - Professional Development

15 Qs

OOP Midterm

OOP Midterm

University

15 Qs

C-technical Quiz 1

C-technical Quiz 1

University

15 Qs

Linguagem_C

Linguagem_C

University

20 Qs

C Programming - Viva

C Programming - Viva

University

25 Qs

OCP 1Z0-819 - Chapter4

OCP 1Z0-819 - Chapter4

University

20 Qs

Model Exam #1

Model Exam #1

University

15 Qs

C- arrays , pointers and functions and macros  MCQs

C- arrays , pointers and functions and macros MCQs

Assessment

Quiz

Professional Development

University

Hard

Created by

Shaik Imam

Used 11+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Predict the output of below program:Assume that base address of arr is 2000 and size of integer

is 32 bit

#include <stdio.h>

int main()

{

int arr[5];

arr++;

printf("%u", arr);

return 0;

}

2002

2004

2020

lvalue required

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output for a 64-bit Compiler?

# include <stdio.h>

void print(int arr[])

{

int n = sizeof(arr)/sizeof(arr[0]);

int i;

for (i = 0; i < n; i++)

printf("%d ", arr[i]);

}

int main()

{

int arr[] = {1, 2, 3, 4, 5, 6, 7, 8};

print(arr);

return 0;

}

1, 2, 3, 4, 5, 6, 7, 8

Compiler Error

1 2

Run Time Error

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Predict the output of the below program:

#include <stdio.h>

#define SIZE(arr) sizeof(arr) / sizeof(*arr)

void fun(int* arr, int n)

{

    int i;

*arr += *(arr + n - 1) += 10;

}

void printArr(int* arr, int n)

{

    int i;

    for(i = 0; i < n; ++i)

        printf("%d ", arr[i]);

}

int main()

{

    int arr[] = {10, 20, 30};

    int size = SIZE(arr);

    fun(arr, size);

    printArr(arr, size);

    return 0;

}

20 30 40

20 20 40

50 20 40

Compile-time error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Predict output of following program

int main()

{

    int i;

    int arr[5] = {1};

    for (i = 0; i < 5; i++)

        printf("%d ", arr[i]);

    return 0;

}

1 followed by four garbage values

1 0 0 0 0

1 1 1 1 1

0 0 0 0 0

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following C code?

    #include <stdio.h>

    int main()

    {

        int one = 1, two = 2;

        #ifdef next

        one = 2;

        two = 1;

        #endif

        printf("%d, %d", one, two);

    }

2, 1

1, 2

1, 1

2, 2

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following C code?

#include<stdio.h>

void main(){

    #ifndef max

    printf("hello");

    #endif

    printf("hi");}

hellohi

hello

hi

error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

. What will be the output of the following C code?

#include<stdio.h>

#define max 100

void main(){

    #if(max%10)

    printf("Bye");

    #endif

    printf("Hi");}

error

Bye

Hi

ByeHi

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?