0% found this document useful (0 votes)
3 views

C Question Bank

The document contains a series of multiple-choice questions (MCQs) related to C programming concepts, including variable declarations, memory allocation, data types, and operators. It also includes questions on differentiating programming concepts, answering theoretical questions about arrays and recursion, and programming tasks such as counting characters in a string and checking for prime numbers. Additionally, it covers conversion between number systems and provides a list of programming tasks for practical implementation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

C Question Bank

The document contains a series of multiple-choice questions (MCQs) related to C programming concepts, including variable declarations, memory allocation, data types, and operators. It also includes questions on differentiating programming concepts, answering theoretical questions about arrays and recursion, and programming tasks such as counting characters in a string and checking for prime numbers. Additionally, it covers conversion between number systems and provides a list of programming tasks for practical implementation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

MCQ

1. A C variable cannot start with


a) a number
b) a special symbol other than underscore
c) both of these
d) none of these

2. The extended ASCII character set uses


a) 7 bits
b) 8 bits
c) 16 bits
d) None of these

3. What will be the output of the following code?


int main()
{
int x = 10;
{
x = 0;
printf("%d",x);
}
printf(" %d",x);
return 0;
}
a) 10 0
b) 0 0
c) 0 10
d) Compilation Error
4. Static memory allocation allocates memory during
a) compile time
b) run time
c) load time
d) link time
5. C programs are converted into machine language with the help of
a) editor
b) interpreter
c) compiler
d) Operating System
6. Which of the following are themselves a collection of different data types?
a) str
b) struct
c) char
d) All of these
7. If the two strings are identical, then strcmp() function returns
a) 0
b) 1
c) YES
d) None of these
8. Which of the following cannot be checked in a switch-case statement?
a) char
b) int
c) float
d) long
9. If a variable is declared before the main then
a) it is a logical error
b) it is a syntax error
c) it is a local variable
d) it is a global variable
10. Which statement interrupts the flow of control?
a) switch
b) goto
c) continue
d) break
11. The number of character can be stored in a string declared as: char a[20];
a) 19
b) 20
c) 21
d) None of these
12. When the logical operator OR (||) combine two expressions exp1 and exp2 then the result will be
false only
a) when both exp1 and exp2 are true
b) when both exp1 and exp2 are false
c) when exp1 is true and exp2 is false
d) when exp1 is false and exp2 is true
13. What is the default storage class of variables in C language?
a) auto
b) extern
c) local
d) global
14. Pointer is
a) a variable that can hold the address of another variable
b) a variable that can store a value
c) a memory location
d) none of these
15. Operating System is
a) Application Software
b) System Software
c) System to protect computer from viruses
d) None of these
16. char str[100]=“Hello World!”; How many bytes are allocated by the above declaration?
a) 100
b) 101
c) 13
d) 12
17. ‘void’ is a
a) return type
b) null
c) function
d) none
18. Resolution of externally defined symbols is performed by
a) linker
b) loader
c) compiler
d) assembler
19. If p is an integer pointer with a value 1000 in a 32-bit system, then what will the value of p + 5 be?
a) 1005
b) 1010
c) 1004
d) None of these
20. In C, if you pass an array as an argument to a function, what actually gets passed?
a) Value of elements in array
b) First element of the array
c) Starting address of the first element of array
d) Starting address of the last element of array
21. What will be the output of the following code?
main()
{
int i,j;
for(i=0,j=5; i<j; i++,j++)
printf(“%d %d”,i,j);
return 0;
}
a) 051423
b) Error
c) Infinite loop
d) No Output
22. char **argv can be read as
a) Pointer to Pointer
b) Pointer to Char
c) Pointer to Pointer to Char
d) None of these
23. The declaration float *a[5]; is
a) a normal pointer
b) an ordinary array
c) an array of pointer
d) a pointer to an array
24. If a variable is a pointer to a structure, then which of the following operator is used to access data
members of the structure through the pointer variable?
a) .
b) &
c) *
d) −>
25. Which of the following operator(s) in C Programming Language can be considered as unary operator?
a) +
b) –
c) ~
d) All of the above
Differentiate between:

1. break() and continue()


2. Auto and Static storage class
3. Call-by-value and Call-by-reference
4. Pre-increment and Post-increment
5. break() and continue()
6. calloc() and malloc()
7. while and do-while/ entry controlled loop and exit controlled loop
8. actual argument and formal argument
9. Array of pointers and pointers to an array
10. Local and global variable
11. Iteration and recursion
12. Binary and text file
13. Compiler and Interpreter
14. Extern storage class and global variables

Answer the following:

1. What do you mean by ‘array’? Explain advantages and disadvantages of array.


2. Passing the base address of an array than an entire array is advantageous- Explain.
3. Explain ‘row-major’ and ‘column-major’ concepts in context of 2D array.
4. How a local variable of a function can be modified from the body of a different function – Explain.
5. What is recursion? Are recursive methods always better than iterative methods? –Explain.
6. How to return more than one value to a function? Explain.
7. Conversion and arithmetic related:
i) Decimal 36 to octal
ii) Octal 7148 to decimal
iii) Decimal 32.625 to binary
iv) Binary 11010111.110 to binary
v) Hexadecimal 2AB to decimal
vi) Hexadecimal 2AC5.D to binary
vii) Binary 10110.001 to octal
viii) Hexadecimal BEF2.09E to octal
ix) What are 2’s complement numbers? What is signed magnitude number representation? What is
its disadvantage?
x) viii) Add (-14) and 9 using 2’s complement method

Explain the concept/ Write short note on:

1. ‘void’ keyword.
2. Storage class
3. Garbage values
4. r’s complement
5. Header files
6. flowchart and algorithm
7. Type casting
8. Different operators
9. Universal logic gates
10. String special functions
11. Binary file and text file
13. Bitwise operator
14. Macro
15. Array of structure pointer

Program types:

1. Print the total count of vowels, consonants, blank spaces and other special characters of a user given
string without using string.h header file.
2. Prime Number check and within range
3. Print the average of some user given numbers.
4. Sum of rows and sum of diagonals of a matrix.
5. Print if a user given year is Leap year or not using user defined function where input and output to be
take place at main().
6. String Palindrome
7. Factorial using recursion
8. Xn using user defined function
9. Maximum and minimum element of a matrix
10. Average of n numbers

You might also like