Search Header Logo

5CSE1_T&P questions

Authored by Gouthami Velakanti

Other

University

Used 1+ times

5CSE1_T&P questions
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

30 sec • 2 pts

What will be the output of the following C function?

#include <stdio.h>

  1. enum birds {SPARROW, PEACOCK, PARROT};

  2. enum animals {TIGER = 8, LION, RABBIT, ZEBRA};

  3. int main()

  4. {

  5. enum birds m = TIGER;

  6. int k;

  7. k = m;

  8. printf("%d\n", k);

  9. return 0;

  10. }

0

Compile time error

1

8

2.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

What will be the final value of x in the following C code?

  1. #include <stdio.h>

  2. void main()

  3. {

  4. int x = 5 * 9 / 3 + 9;

  5. }

3.75

Depends on compiler

24

3

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following C code considering the size of a short int is 2, char is 1 and int is 4 bytes?

  1. #include <stdio.h>

  2. int main()

  3. {

  4. short int i = 20;

  5. char c = 97;

  6. printf("%d, %d, %d\n", sizeof(i), sizeof(c), sizeof(c + i));

  7. return 0;

  8. }

a) 2, 1, 2

b) 2, 1, 1

c) 2, 1, 4

d) 2, 2, 8

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the value of the following assignment expression?

(x = foo())!= 1 considering foo() returns 2

2

True

1

0

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Comment on the following C statement.

n = 1; printf("%d, %dn", 3*n, n++);

Output will be 3, 2

Output will be 3, 1

Output will be 6, 1

Output is compiler dependent

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the data type returned for the following C function?

  1. #include <stdio.h>

  2. int func()

  3. {

  4. return (double)(char)5.0;

  5. }

char

int

double

multiple type-casting in return is illegal

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of this C code?

  1. #include <stdio.h>

  2. int main()

  3. {

  4. float f = 0.1;

  5. if (f == 0.1)

  6. printf("True");

  7. else

  8. printf("False");

  9. }

True

False

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?