Search Header Logo

C Programming Lab

Authored by karthick k

Computers

Professional Development

Used 1+ times

C Programming Lab
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the scope of an external variable?

Whole source file in which it is defined

From the point of declaration to the end of the file in which it is defined

Any source file in a program

From the point of declaration to the end of the file being compiled

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of this C code?

#include <stdio.h>

void main()

{

int x = 97;

int y = sizeof(x++);

printf("x is %d", x);

}

x is 97

x is 98

x is 99

Run time error

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the below c code?

#include <stdio.h>

void main()

{

char *s = "hello";

char *p = s;

printf("%p\t%p", p, s);

}

Different address is printed

Same address is printed

Run time error

Nothing

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of this C code?

#include <stdio.h>

struct student

{

char a[5];

};

void main()

{

struct student s[] = {"hi", "hey"};

printf("%c", s[0].a[1]);

}

h

i

e

y

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of this C code?

#include <stdio.h>

#define foo(m, n) m * n = 10

int main()

{

printf("in main\n");

}

In main

Compilation error as lvalue is required for the expression m*n=10

Preprocessor error as lvalue is required for the expression m*n=10

None of the mentioned

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of this C code?

void main ()

{

int a=2;

if(a==2)

{

a=~a+2<<1;

printf("%d",a);

}

else

{

a=~a;

}

}

6

-2

0

None of above

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Predict the output of the following C snippets

int main()

{

int main = 56;

printf("%d", main);

return 0;

}

Compiler Error

Depends on the compiler

56

none of above

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?