Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

1.

1 Assignments
1.1.1 Answer the following questions. Use the space below each question for your calculations and notes.
1. Which primitive type would be best to represent the number of employees in a medium sized organization? A) int B) float C) double D) char

2. Which primitive type would be best to represent Indias population? A) int B) char C) double D) long

3. Which of the following is a valid variable name? A) Total_mark B) 3totalmark C) total mark D) int

4. What will be the value of z in the below code snippet?


int x = 7, y = 5; float z; z = x/y;

A) B) C) D)

1.0 1.4 0 Compilation Error

5. For the below C code, what will be the output?


int a = 5, b = 3, c = 4; printf("a = %d, b = %d\n", a, b, c);

A) B) C) D)

a = 5, b = 3 a = 5, b = 3, c = 0 a = 5, b = 3, 0 Compilation error

6. What will be the value of x after the expression given below is executed?
x = (a = 10, a * a)

A) B) C) D)

Invalid expression 0 10 100

7. If abc is the input, what is the output of the following C program?


char x, y, z; printf("%d", scanf("%c %c %c", &x, &y, &z));

A) B) C) D)

3 abc 1 Compilation error

8. What does the below declaration mean?


int x : 4;

A) B) C) D)

x is a four digit integer x cannot be greater than a four digit integer x is a four bit integer None of these

9. For the below C code, what will be the output?


int a = 4, b = 6; printf("%d", a = b);

A) B) C) D)

4 0 1 6

10. For the below C code, what will be the output?


main(){ double x = 1 / 2.0 - 1 / 2; printf("x = %.2f \n", x); }

A) B) C) D)

x = 0.00 x = 0.25 x = 0.50 x = 1.00

11. For the below C code, what will be the output?


main() { const int count = 5; printf("%d", count--); }

A) B) C) D)

5 4 Compilation error Garbage value

12. For the below C code, what will be the output?


main() { printf("%d", out); } int out = 100;

A) B) C) D)

Compilation error 100 0 Garbage value

You might also like