Programming in C
Test to check and improve basic skills of C programming.
Questions
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.
- a, c, d, e, f
- a, b, d, e, f
- a, d, e, f
- a, b, c, d, e
- All statements are true
Which of the following is a valid comparison?
- p=3;
- 3==p;
- p==3;
- both 1 and 2
- both 2 and 3
Which of the following is not stored in CPU memory?
- auto
- extern
- static
- register
- none of the above
Which of the following statements is/are incorrect about C array?
- Array is a collection of variables belongings to the same data type.
- Array may belong to any of the pre-defined data types.
- Array size may be a variable or constant value.
- Contiguous memory locations are used to store array elements in the memory.
- None of the above
____ and ____ are the format specifiers used to print integers.
- %c and %d
- %f and %d
- %i and %d
- %c and %f
- %c and %i
What is the range of unsigned long int?
- - 32768 to 32767
- - 2147483648 to 2147483647
- 0 to 255
- 0 to 65535
- 0 to 4294967295
Which of the following is an invalid array declaration?
- int a[ ];
- int a[5];
- int a[ ] = {4, 2, 5, 6, 7};
- int a[5] = {4, 2, 5, 6, 7};
- none of above
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.
- a and b
- b and c
- a and d
- b, c and d
- a, b and d
________ are used to compare the value of two variables.
- Arithmetic operators
- Assignment operators
- Relational operators
- Logical operators
- Conditional operators
Which of the following is/are correct about C structures and unions?
- A structure allocates one common storage space for all its members.
- A union allocates storage space for all its members separately.
- A structure occupies lower memory space than union.
- We can access only one member of union at a time.
- All of the above
Which of the following is a low level language?
- C
- C++
- Java
- Python
- Assembly language
Which of the following has error?
- // C is a very simple language.
- // C is a very simple language //.
- /* C is a very simple language */.
- /* C is a very simple language.
- // C is a very simple language */.
Which of the following is an invalid expression?
- a=b+c;
- a=b+5;
- 5=a;
- a=5;
- 5==a;
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
- a, c, g
- b, d, f
- a, e, g
- b, c, d
- e, f, g
In a structure oriented language a program is divided into small programs called ________.
- objects
- classes
- Union
- functions
- operators