Programming in C

Test to check and improve basic skills of C programming.

15 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following are true about C functions?
a. C functions are used to avoid rewriting same code again and again in a program.
b. There is no limit in calling C functions.
c. We can call a function from any other function in a program.
d. A large C program can easily be tracked when it is divided into functions.
e. The core concept of C functions is reusability.
f. A function can call itself.

  1. a, c, d, e, f
  2. a, b, d, e, f
  3. a, d, e, f
  4. a, b, c, d, e
  5. All statements are true
Question 2 Multiple Choice (Single Answer)

Which of the following is a valid comparison?

  1. p=3;
  2. 3==p;
  3. p==3;
  4. both 1 and 2
  5. both 2 and 3
Question 3 Multiple Choice (Single Answer)

Which of the following is not stored in CPU memory?

  1. auto
  2. extern
  3. static
  4. register
  5. none of the above
Question 4 Multiple Choice (Single Answer)

Which of the following statements is/are incorrect about C array?

  1. Array is a collection of variables belongings to the same data type.
  2. Array may belong to any of the pre-defined data types.
  3. Array size may be a variable or constant value.
  4. Contiguous memory locations are used to store array elements in the memory.
  5. None of the above
Question 5 Multiple Choice (Single Answer)

____ and ____ are the format specifiers used to print integers.

  1. %c and %d
  2. %f and %d
  3. %i and %d
  4. %c and %f
  5. %c and %i
Question 6 Multiple Choice (Single Answer)

What is the range of unsigned long int?

  1. - 32768 to 32767
  2. - 2147483648 to 2147483647
  3. 0 to 255
  4. 0 to 65535
  5. 0 to 4294967295
Question 7 Multiple Choice (Single Answer)

Which of the following is an invalid array declaration?

  1. int a[ ];
  2. int a[5];
  3. int a[ ] = {4, 2, 5, 6, 7};
  4. int a[5] = {4, 2, 5, 6, 7};
  5. none of above
Question 8 Multiple Choice (Single Answer)

Which of the following is/are incorrect about C language?
a. C language was developed at Bell Laboratories in 1980 by Dennis Ritchie.
b. C language features were derived from earlier language called B.
c. C language was invented for implementing UNIX operating system.
d. C language is a object oriented programming language.

  1. a and b
  2. b and c
  3. a and d
  4. b, c and d
  5. a, b and d
Question 9 Multiple Choice (Single Answer)

________ are used to compare the value of two variables.

  1. Arithmetic operators
  2. Assignment operators
  3. Relational operators
  4. Logical operators
  5. Conditional operators
Question 10 Multiple Choice (Single Answer)

Which of the following is/are correct about C structures and unions?

  1. A structure allocates one common storage space for all its members.
  2. A union allocates storage space for all its members separately.
  3. A structure occupies lower memory space than union.
  4. We can access only one member of union at a time.
  5. All of the above
Question 11 Multiple Choice (Single Answer)

Which of the following is a low level language?

  1. C
  2. C++
  3. Java
  4. Python
  5. Assembly language
Question 12 Multiple Choice (Single Answer)

Which of the following has error?

  1. // C is a very simple language.
  2. // C is a very simple language //.
  3. /* C is a very simple language */.
  4. /* C is a very simple language.
  5. // C is a very simple language */.
Question 13 Multiple Choice (Single Answer)

Which of the following is an invalid expression?

  1. a=b+c;
  2. a=b+5;
  3. 5=a;
  4. a=5;
  5. 5==a;
Question 14 Multiple Choice (Single Answer)

Which of the following are valid identifiers in C?
a. empsal101
b. emp.sal101
c. 101emp_sal
d. emp sal 101
e. emp_sal101
f. 101empsal
g. emp101sal

  1. a, c, g
  2. b, d, f
  3. a, e, g
  4. b, c, d
  5. e, f, g
Question 15 Multiple Choice (Single Answer)

In a structure oriented language a program is divided into small programs called ________.

  1. objects
  2. classes
  3. Union
  4. functions
  5. operators