You are on page 1of 15

C Programming Language Bits

1. What type of errors are checked during compilation 2. The purpose of main function is
(a) logical errors (b) divide by zero error (a) to stop program execution
(c) run - time errors (b) to stop algorithm
(d) syntax errors (c) to start algorithm
(d) to start program execution

3. What is the valid identifier in the following 4. What is range of char data value?
(a) 1fdasgf (b) @hgd12 (a) -64 to 64 (b) -128 to 127
(c) fahs%* (d) q1234 (c) 0 to 255 (d) -127 to 128
5. The minimum number of temporary variable needed 6. What is output of following program ?
to swap the contents of two variable is main( ) {
(a) 3 int x;
(b) 1 x= 4 + 2 % 8;
(c) 0 printf(“%d”,x); }
(d) 2 (a) 6 (b) 4.25 (c) 4 (d) -6
7. When && operator is used with two conditions, 8. Bitwise operators cannot be performed on
conditions need to be satisfied for the expression to be (a) float
true. (b) long int
(a) neither (b) only first (c) int
(c) any one (d) both (d) char
9. In the expression b=6.6/a+(2*a+(3*c)/a*d)/(2/n); 10.What is the output of printf(“%d”,printf(“VSM”));
which operation will be performed first? (a) garbage (b) results in a syntax error
(a) 2*a (b) 2/n (c) 3*c (d) 6.6/a (c) printf VSM and terminates abruptly
(d) VSM3
11. What is output of the following program? 12. Identify the loop construct:
main( ){ (a) if-else
int x=15,y; (b) goto
y=(x >5)? 3 : 4; (c) while
printf(“%d”,y);} (d) switch-case
(a) 2 (b) 4 (c) 3 (d) 1

13. The index or subscript value for an array of size ‘n’ 14. If we don’t initialize a static array, what will be the elements
ranges from set to:
(a) 1 to n-1 (b) 0 to n-1 (a) 0 (b) a floating point number
(c) 1 to n (d) 0 to n (c) an undetermined value (d) character constant
15. A string is an array of 16. int calcum(int a, int b);
(a) integers In the above, int at the beginning indicates
(b) floating point numbers (a) name of function
(c) characters (b) both function arguments are integer
(d) Boolean values (c) return type of function
(d) received type of function
17. When a function is recursively called, all automatic 18. What is wrong with the following program
variables are main() { char m1[9]= “VSM1”;
(a) stored in a stack char m2[9]=“VSM2”; m2=m1;
(b) stored in a list printf(“Message is %s”,m2); }
(c) stored in queue (a) array cannot be initialized as above
(d) stored in an array (b) array is not a left value and so cannot be assigned to
(c) char array cannot be printed directly using printf
(d) program compiles without error, but prints an unpredictable
value
19. Which of the following is not a storage class 20. Which of the following is a correct way of defining a
(a) external symbolic constant pie in C
(b) automatic (a) # define pie = 22/7
(c) register (b) #define pie 22/7
(d) define (c) #define pie= 3.142
(d) # Define pie 22/7
1D 2D 3D 4B 5C 6A 7D 8A 9D 10D 11C 12C 13B 14A
15C 16C 17A 18B 19D 20B
C Programming Language Bits

1. What symbol is used to represent the connector 2. The ANSI C standard recognizes maximum length of a
(a)  parallelogram variable up to
(b) rectangle with rounded end (a) 8 characters (b) unlimited characters
(c) circle (d) rectangle (c) 31 characters (d) 15 characters
3. Which of the following is an incorrect variable name. 4. What is the size of long double variable
(a) else (b) name (c) string (d) age (a) 10 bytes (b) 8 bytes (c) 4 bytes (d) 16 bytes
5. Variables are initialized in C, using 6. If a is float variable, a=5/2 will return a value
(a) := (b) > (c) = (d) = = (a) 2.5 (b) 2 (c) 2.0 (d) 3
7. int a=13,b=7,c; 8. In the following, which is bitwise operator?
c=a&b what is the value of c (a) >
(a) 0000 0000 0000 0101 (b) *
(b) 0000 0000 0000 0100 (c) |
(c) 0000 0000 0000 0110 (d) <
(d) 0000 0000 0001 0101
9. If y is of integer type variable then the two 10. What is output of the following program?
expressions. 3*(y-8)/9 and (y-8)/9*3 yield the same value main() {
if int a; float b;
(a) y-8 is an integer multiple of 3 a=1/2;
(b) y is an odd number b=1.0/2.0;
(c) y is an even number printf(“ a=%d b=%f”, a , b); }
(d) y-8 is an integer multiple of 9 (a) a=0.0 b=0. 5 (b) a=0 b=0. 5
(c) a=0.0 b= 5 (d) a=0.5 b=0. 5
11. In switch (expression) statement, the expression 12. The minimum number of times the for loop is executed is
should evaluate to (a) 0 (b) cannot be predicted (c) 1 (d) 2
(a) an integer (b) a void (c) a float
(d) a character
13.The array is declared as float a[5];and the memory 14. Two dimensional array elements are stored
address of a[0] is 4056.What is the address of a[3]. (a) system dependent (b) in row major order
(a) 4056 (b) 4056 (c) 4059 (d) 4068 (c) complier dependent (d) in column major order
15. char x[10]=“VSMRCPM”; 16. How many values a function can return at a time
char *y=“VSMRCPM”; (a) only one
Pick the correct answer (b) depends on the system
(a) The output of puts(x) and puts(y) will be different (c) infinite values
(b) The output of puts(x) and puts(y) will be same (d) 2
(c) The output of puts(y) is implementation dependant
(d) The output of puts(x) and puts(y) compiler dependant
17. When compared to call by value, the call by reference 18. The strcat( ) function is used for
is in execution (a) Concatenation
(a) equal (b) Multiplication
(b) fast (c) Joining
(c) slow (d) Addition
(d) neither slow nor fast

19. Which of the following statement is wrong with 20. Symbolic constants are defined as
respect to a storage class (a) #define s1 s2;
(a) it specifies the defualt initial value (b) #define s1=s2
(b) it specifies the life of a variable (c) #define s1 s2
(c) by defualt a storage class is static (d) #define s1=s2;
(d) if specifies where variable is stored

1C 2C 3A 4A 5C 6C 7A 8C 9D 10B 11A 12A 13D 14C


15B 16A 17B 18A 19C 20C

1. Representing various steps in a flow diagram is called as 2. C language is a


(a) diagram (b) flow chart (a) Machine language (b) High level language
C Programming Language Bits

(c) program (d) paint (c) High level language with some low level features
(d) Low level language
3. What are the smallest individual units in a program 4. Which of the following is an empty data type.
(a) Structures (b) Functions (c) record (d) Tokens (a) Integer (b) float (c) character (d) void
5. Array elements are stored in 6. The operator ++ is called as operator
(a) Sequential memory locations (a) special increment
(b) Scattered memory locations (b) increment
(c) Direct memory locations (c) double addition
(d) Random memory location (d) decrement
7. Which of the following is not a relational operator 8. main ( ) { int m,y;
(a) < = m = 5; y = ++m;
(b) & & printf(”%d %d”,m,y);
(c) != } consider the above code and find the output
(d) > (a) 5,5 (b) 5,6 (c) 6,6 (d) 6,5
9. int C; C=25/2; What is the value of C? 10. Consider scanf(“%2d”, &n); and the input data is 3142
(a) 0.5 (b) 12.500000 then n will be assigned
(c) 12.000000 (d) 12 (a) error (b) 31 (c) 42 (d) 31.42
11. In switch case statement 12. How many while statements are possible in do.... While
(a) more than one default allowed loop?
(b) default case, if used, should be the last case (a) 2 (b) 3
(c) default case, if used, can be placed anywhere (c) any number (d) 1
(d) default case must be present
13. The number of elements in array declaration 14. The following program
(a) does not require to be specified main( ) {
(b) dynamically identifies based on largest index used in static int a[ ] = { 7, 8, 9 };
program printf(“%d”, a[2] = 2[a] + a[2]); }
(c) assume default size as ‘0’ (a) results in segmentation violation error
(d) requires to be specified (b) runtime error (c) will compile successfully
(d) result is buss error
15. Find the output of the following program 16. The purpose of return statement is
main() (a) To return control back to the calling function
{ char name1[4] = ‘V’, ‘S’, ‘M’, ‘R’; (b) To return control and value to calling function
char name2 [5] = ‘V’,‘S’,‘M’,‘R’; (c) To return void
printf (“%s”, name1); (d) To return value to the calling function
printf (“%s”, name2);
}
(a) VSMR VSMR (b) Garbage value VSMR
(c) VSMR garbage value (d) VSMR garbag evalue
VSMR
17. Which of the following statements is correct when an 18. If the character type variable sym is assigned a value
array is passed to a called function ‘Y’ and the string variable str is assigned a value LEARN.
(a) function-name ( array-name [ ] ) What is the value in str after execution of the following
(b) function-name ( array-name , size ) statement strset(str,sym)
(c) not possible (a) LEARNY (b) YYYYY
(d) function-name ( array-name[size]) (c) Y (d) LEARY

19. The storage area for register variables 20. Which of the following is the symbol for preprocessor
(a) cache (a) *
(b) memory (b) #
(c) processor registers (c) <>
(d) virtual memory (d) $

1B 2C 3D 4D 5A 6B 7B 8C 9D 10B 11C 12C 13D 14C


15D 16B 17B 18B 19C 20B

1. Pseudo code is 2. A block is enclosed with pair of


(a) language independent code (a) ( )
(b) refined version of program (b) { }
(c) code developed using the syntax of a specific language (c) <>
C Programming Language Bits

(d) outcome of compilation process (d) [ ]

3. Which of the following cannot be used as an identifier. 4. sizeof (double) returns———


(a) alphabet followed by digit (b) alphabet (a) 4 (b) 8
(c) Keywords (d) Library function name (c) 10 (d) 2

5. Which of the following statements is wrong 6. main( )


(a) con = ‘T’ * ‘A’ ; { int a=5; float b=10,c;
(b) This = ‘T’ * 20 ; c=b%a;
(c) 3+a=b; printf(“%f”,c);
(d) mes = 123.56; } output is——————–
(a) gives an error (b) 2.0 (c) 0.00 (d) 0.000000
8. int x=1,y=5;
7. int a=13,b=7,c; x= ++x + –y;
c=a&b what is the value of c what is the value of x
(a) 0000 0000 0000 0101 (a) 8
(b) 0000 0000 0001 0101 (b) 6
(c) 0000 0000 0000 0100 (c) 5
(d) 0000 0000 0000 0110 (d) 7
9. In the expression b=6.6/a+(2*a+(3*c)/a*d)/(2/n); which 10. Consider the segment
operation will be performed first? If(1) printf(“yes”);
(a) 2*a (b) 2/n else printf(“no”);
(c) 3*c (d) 6.6/a what will be the output
(a) no (b) Unpredictable (c) yes (d) Error
11. In switch (expression) statement, the expression should 12. Which of the following statements is false
evaluate to (a) The initialization and increment parts of a for statement
(a) a character can be empty
(b) a void (b) The body of do-while statement can be empty
(c) an integer (c) The expression in the condition part of a for statement
(d) a float can be empty
(d) The initialization part of a for statement cannot have
more than one initialization
13. One dimensional array is known as 14. If we don’t initialize a static array, what will be the
(a) set (b) vector elements set to:
(c) matrix (d) table (a) an undetermined value (b) 0
(c) a floating point number (d) character constant
15. What is the control string for representing string 16. How many values a function can return at a time
(a) %c (b) %s (a) only one (b) infinite values
(c) %f (d) %d (c) depends on the system (d) 2

17. What is the output of the following program 18. The function is used to reverse a string
void main(){ (a) strrsa()
int x = 2; sqr(x); (b) strrev()
printf(“%d”, x);} (c) strcmp()
sqr(x) /* sqr function */ (d) strcat()
{ int y; y = x * x; printf (“%d”, y); }
(a) 4 2 (b) 2 2 (c) 2 4 (d) 4 4
19. The storage area for register variables 20. The function sqrt() is part of header file.
(a) processor registers (b) cache (a) iostream.h (b) conio.h
(c) virtual memory (d) memory (c) math.h (d) stdio.h

1A 2B 3C 4B 5C 6A 7A 8B 9D 10C 11C 12D 13B 14B


15B 16A 17A 18B 19A 20C

1. The process of repeating a group of statements in an 2. Every executable C program must contain a
algorithm is known as (a) printf function
(a) sequence (b) iteration (b) scanf, printf and main functions
(c) flow (d) selection (c) main function (d) scanf function
C Programming Language Bits

3. The individual units of a C program is known as 4. The keyword is used to define enumerated data type
(a) records (b) tokens (c) units (d) program (a) array (b) enum (c) typedef (d) struct

5. How many variables of the same type can be initialized 6. Integer division results in
at a time with the same value (a) rounding (b) underflow
(a) Three (b) One (c) Two (c) overflow (d) truncation
(d) any number of variables

7. The operator with lowest priority in the list && , + , | | , 8. int x=1,y=5;
< is x=++x + –y; what is the value of x
(a) + (b) | | (c) && (d) < (a) 8 (b) 7 (c) 5 (d) 6

9. Which of the following shows the correct hierarchy of 10. The statement printf(“%d”,7);
arithmetic operations in C (a) prints 0
(a) ( ), / or *, - or + (b) runtime error
(b) ( ), &&, *,/,+,- (c) prints the value 7
(c) ( ), &&, / , *, +, - (d) results in syntax error
(d) ( ),&&,*or / + or -;

11. The keyword ‘else” can be used with 12. Give the output of the following program:
(a) for statement #include < stdio.h >
(b) if statement main()
(c) switch ( ) statement {
(d) do.. while ( ) statement int i=1;
while (i < 5)
{
printf(“%d”, i);
}
} /* End of Main */
(a) Warning for no return type for main ( )
(b) Print the value of i as 1 (c) Infinite loop
(d) Prints the value of i as 11111
13. Array is used to represent the following 14. Dynamic memory allocation in array results in
(a) A list of data items of different data type (a) allocation of memory at compile time
(b) A list of data items of real data type (b) allocation of memory at file saving time
(c) A list of data items of same data type (c) allocation of memory at runtime
(d) A list of data items of integer data type (d) allocation of memory at debugging time

15. putchar() and getchar() are both 16. How many values a function can return at a time
(a) control statement (a) only one
(b) type declaration statements (b) 2
(c) assignment statements (c) infinite values
(d) input and output statements (d) depends on the system

17. Arrays are passed as arguments to a function by 18. The function strrev( ) the actual string in the array
(a) reference (b) both value and reference (a) will not reverse (b) may not reverse
(c) context (d) value (c) will reverse (d) may reverse

19. register variables are active 20. The function sqrt() is part of header file.
(a) outside the function (a) math.h
(b) throughout the program (b) iostream.h
(c) only in the function where it is defined (c) conio.h
(d) Surrounding of that function. (d) stdio.h

1B 2C 3B 4B 5D 6D 7B 8D 9A 10C 11B 12C 13C 14C


15D 16A 17A 18C 19C 20A

1. The process of removing a bug is known as 2. Every C Program Statement must be terminated with a
C Programming Language Bits

(a) debugging (b) compilation (a) . (b) # (c) ; (d) !


(c) executing (d) running
3. In the following which one is not a C keyword? 4. What is the range of unsigned char data type
(a) choice (b) case (c) for (d) volatile (a) 0 to 512 (b) 0 to 255
(c) -128 to 127 (d) -32, 768 to 32,767
5. C variable cannot start with 6. Which of the following is allowed in a C arithmetic
(a) a lower case (b) an underscore statement
(c) a number (d) an upper case letter (a) ( ) (b) [ ] (c) { } (d) / /
7. What is the result of 5 && 2 ? 8. ++i is a operator.
(a) 0 (b) 2 (a) Pre-decrement (b) Pre-increment
(c) 1 (d) 5 (c) Post increment (d) Post decrement
9. Which of the following shows the correct hierarchy of 10. The output of the following program is
arithmetic operations in C main( )
(a) ( ), &&, *,/,+,- { int i=2;
(b) ( ), &&, / , *, +, - printf(“%d %d %d”, i++, i, ++i);
(c) ( ),&&,*or / + or -; }
(d) ( ), / or *, - or + (a) 2 2 4 (b) 2 3 3 (c) 3 3 3 (d) 2 3 4
11. In switch (expression) statement, the expression should 12. How many while statements are possible in do.... While
evaluate to loop?
(a) a void (b) an integer (c) a character (d) a float (a) any number (b) 2 (c) 3 (d) 1
13. What is the output of the following program 14. In a multidimensional array with initialization
main() { (a) no dimension must be omitted
int a1[5] ={1}; (b) the left most dimension may be omitted
int b = 0, k = 0; (c) both leftmost and right most may be omitted
for (b=0; b<=4; b++) (d) the right most dimension may be omitted
printf (“%d” , ++ a1[0]);
}
(a) 11111 (b) 23456 (c) 12345 (d) 12222
15. The statements that prints out the character set from A- 16. The statement used to send back any value to the calling
Z is, where a is an integer variable function is
(a) for(a=‘a’; a<=‘z’, a++) printf(“%c”; a); (a) exit
(b) for(a=‘A’; a<=‘z’, a++) printf(“%c”; a); (b) return
(c) for(a=’A’ a<=‘Z’, a++) printf(“%c”; a); (c) break
(d) for(a=‘A’; a<=‘z’, a++) printf(“%c”; a); (d) continue
17. What is the output of 18. If the first string and the second string both are
main() { identical, then strcmp() function returns
int x, change (int); (a) a value of 0
x = 20; (b) either 1 or 0
change (x); (c) a value of 1
printf (“%d”, x); (d) any positive integer
}
change (int x)
{
x = 10;
printf (“%d”. x);
}
(a) 10 30 (b) 10 20 (c) 10 10 (d) 20 20
19. A static variable is one 20. How would you declare a constant of 5 called
(a) which can’t be initialized “MYCONST”?
(b) which is same as an automatic variable but it is placed (a) var int MYCONST=5
at the head of the program (b) int myconst = 5;
(c) which is initialized once and can’t be changed at run (c) constant MYCONST = 5;
time (d) #define MYCONST 5
(d) which retains its value throughout the life of the
program

1A 2C 3A 4B 5C 6A 7C 8B 9D 10C 11B 12A 13B 14B


15C 16B 17B 18A 19D 20D

1. What type of errors are checked during compilation 2. The constant ‘\b’ is used for
C Programming Language Bits

(a) divide by zero error (b) logical errors (a) tab (b) vertical blank
(c) run - time errors (d) syntax errors (c) bell (d) backspace

3. Which of the following is a valid numeric constant 4. What is range of char data value?
(a) 20,000 (b) 15 750 (c) $1000 (d) 65432 (a) -128 to 127 (b) -64 to 64 (c) 0 to 255(d)-127to128

5.Which of the following is assignment operator in C 6. What is output of following program ?


(a) != main( ){
(b) = = int x;
(c) = x= 4 + 2 % 8;
(d) : = printf(“%d”,x);
}
(a) 4 (b) -6 (c) 6 (d) 4.25
7. The equality relational operator is represent by 8. main( )
(a) := { int a=0;
(b) == if(a) printf(“%d”,++a);
(c) .EQ. else printf(“%d”, a+=2) ;
(d) = } the output is
(a) 3 (b) 1 (c) 2 (d) 0
9. x=9-12/3+3*2-1, what is the value of x 10. The function echoes the character typed on the screen
(a) -10 (b) 10 (c) 4 (d) 2 (a) getchar() (b) gets() (c) getche() (d) getchr()

11. Which of the following statement is not true about the 12. while(++i <=n);
switch statement what is the value of i when the loop completes, if the initial
(a) Character constants are automatically converted into value of i is 1.
integer (a) n-1
(b) In switch() case statement nested if can be used (b) n+2
(c) The switch() can evaluate relational or logical (c) n+1
expressions (d) n
(d) No two case statements have identical constants in the
same switch
13. C does no automatic array bound checking. This is 14. The following program
(a) Disadvantage of C main( ) {
(b) false static int a[ ] = { 7, 8, 9 };
(c) Neither advantage nor disadvantage printf(“%d”, a[2] = 2[a] + a[2]); }
(d) Advantage of C (a) will compile successfully
(b) results in segmentation violation error
(c) result is buss error (d) runtime error
15. What is the output of the following program? 16. The library function sqrt operates on a double
void main() precession argument and i is an integer variable, which one
{ of the
char name[4] = {‘V’, ‘S’, ‘M’ ‘R’ }; following calls would compute sqrt(i)?
printf (“%s”, name); (a) sqrt((double)i);
} (b) (double) (sqrt(i));
(a) VSMR followed by a garbage value (c) sqrt(i);
(b) VSMR (c) VSMR (d) only garbage value (d) (double) sqrt(i);
17. main() 18. What will be the output of the following program?
{ void main()
printf(“welcome to c programming\n”); {
main(); char x[ ] = {‘s’, ‘a’, NULL };
} printf (“\n %d”, sizeof (x));
output of the program code }
(a) Infinite loop (b) Runtime error (a) 2 (b) 3 (c) 0 (d) 1
(c) welcome to c programming (d) compile time error
19. The variables which are declared outside the program 20. #include is a directive
are called (a) processor (b) complier
(a) global variables (b) formal variables (c) pre-compiler (d) pre-processor
(c) local variables (d) register variable
1D 2D 3D 4A 5C 6C 7B 8C 9B 10C 11D 12C 13A 14A
15A 16A 17A 18B 19A 20D
C Programming Language Bits

1. The process of removing a bug is known as 2. The constant ‘\0’ is called as


(a) running (b) executing (a) full (b) null
(c) debugging (d) compilation (c) zero (d) nill
3. How many keywords are there in C 4. sizeof (double) returns———
(a) 34 (b) 30 (a) 8 (b) 2
(c) 31 (d) 32 (c) 4 (d) 10
5. The declaration of a variable should be done 6. Which of the following is allowed in a C arithmetic
(a) before using it (b) after using it statement
(c) at the time of using (d) only in the calling program (a) { } (b) [ ] (c) / / (d) ( )
7. Identify the relational operator in C 8. The symbol for right shift operator is
(a) || (b) && (a) − > (b) >
(c) ! (d) < (c) <= (d) >>
9. In the expression b=6.6/a+(2*a+(3*c)/a*d)/(2/n); which 10. What function is appropriate for accepting a string?
operation will be performed first? (a) getch ( ) (b) gets( )
(a) 6.6/a (b) 2/n (c) getche ( ) (d) scanf ( )
(c) 2*a (d) 3*c
11. Which of the following statement is not true about the 12. Which of the following is not correct
switch case statement (a) while loop is executed at least once.
(a) Character constants are automatically converted into (b) do . while loop is executed at least once.
integer (c) while loop is executed only if the condition is true.
(b) The switch() can evaluate relational or logical (d) do while loop is executed only if the condition is true.
expressions
(c) No two case statements have identical constants in the
same switch
(d) In switch() case statement, nested if can be used
13.C does no automatic array bound checking .This is 14. In a multidimensional array with initialization
(a) false (a) both leftmost and right most may be omitted
(b) Disadvantage of C (b) the right most dimension may be omitted
(c) Neither advantage nor disadvantage (c) no dimension must be omitted
(d) Advantage of C (d) the left most dimension may be omitted
15. Literal means 16. ‘void’ means
(a) A string constant (a) 1
(b) An alphabet (b) nothing
(c) A character (c) something not known
(d) A string (d) 0

17. The parameter passing mechanism for an array is 18. What is the use of the strlen( ) function
(a) Call by value (a) finds the length of the string
(b) Call by value-result (b) string comparison
(c) call by name (c) string concatenation
(d) Call by reference (d) copies one string into another

19. What kind of variable is suitable to count how many 20. How would you declare a constant of 5 called
times a function is called “MYCONST”?
(a) register (a) #define MYCONST 5
(b) extern (b) var int MYCONST=5
(c) auto (c) int myconst = 5;
(d) static (d) constant MYCONST = 5;

1C 2B 3D 4A 5A 6D 7D 8D 9A 10B 11C 12A 13B 14D


15A 16B 17D 18A 19D 20A

1. What symbol is used to represent input/output operations 2. A block is enclosed with pair of
C Programming Language Bits

in a flow chart. (a) { } (b) ( )


(a) Rectangles (b) Parallelograms (c) <> (d) [ ]
(c) circles (d) Rectangle with rounded end
3. Which of the following is not a key word of C? 4. The keyword is used to define a new data type.
(a) main (b) void (a) array (b) Structure
(c) const (d) sizeof (c) typedef (d) union
5. The purpose of the following fragment 6. main( )
B=S+B { float a;
S=B-S; int x = 6; y = 4;
B=B-S; a = x/y;
Where S,B are two integers is to print (“%f”,a)
(a) negate the contents of S and B }
(b) swap the contents of S and B what is the output
(c) transfer the contents of S to B (a) error (b) 1.5 (c) 0.5 (d) 1.00
(d) transfer the contents of B to S
7. What is output of following Program? 8. Hierarchy decides which operator
main( ) (a) consumes more CPU time
{ (b) operates on large number
int x=10,y=5,p,q ; (c) is used first
p= x> 9 ; (d) is most important
q= x > 3 && y != 3 ;
printf( “p=%d q=%d ” ,p,q) ;
}
(a) p =0 q = 0 (b) p = 0 q = 1
(c) p = 1 q= 0 (d) p = 1 q = 1
9. float c, 10. Format specifier for the string is
c=25/2; What is the value of c (a) %u (b) %d
(a) 12 (b) 12.000000 (c) %c (d) %s
(c) 12.0 (d) 12.500000
11. The conditional operators “ ? :” is similar to 12. Which of the following statements cannot be used to
(a) nested if transfer the control unconditionally to a different statement
(b) if-then-else in a ‘C’ program
(c) while (a) continue (b) for (c) break (d) goto
(d) do-while
13. An array can have dimension(s). 14. If we don’t initialize a static array, what will be the
(a) single (b) multiple elements set to:
(c) three (d) double (a) character constant (b) a floating point number
(c) 0 (d) an undetermined value
15. The following function is used to count and return the 16. main() is
number of characters in a given string (a) user defined function (b) friendly function
(a) strcat() (b) strrev() (c) library function (d) member function
(c) strcmp() (d) strlen()
17. If the value of the formal argument is changed in the 18. Consider the following program
called function; the corresponding change in the calling main()
function, if it is call by value { char str[10]; scanf(“%s”,str); printf(“%s”,str); }
(a) machine dependent The error in the above program is
(b) does not reflects (a) the format control for the string variable is not %s
(c) unpredictable (b) no error in the program
(d) reflects (c) memory has not been allocated for the variable str
(d) the parameter str to scanf is passed by value, it should
be a address

19. Which of the following statement is wrong with respect 20. The header file to use a library function cos() is
to a storage class (a) dos.h
(a) if specifies where variable is stored (b) stdlib.h
(b) it specifies the default initial value (c) math.h
(c) it specifies the life of a variable (d) conio.h
(d) by default a storage class is static
1B 2A 3A 4C 5B 6D 7D 8C 9B 10D 11B 12B 13B 14C
15D 16A 17B 18B 19D 20C
C Programming Language Bits

1. C language has been developed by 2. Which function returns single character


(a) Martin Richards (b) Ken Thompson (a) printf (b) putchar
(c) Peter Norton (d) Dennis Ritchie (c) scanf (d) getchar
3. Which of the following cannot be used as an identifier. 4. Which of the following is a primary data type?
(a) alphabet followed by digit (b) Keywords (a) int (b) enum
(c) alphabet (d) Library function name (c) array (d) typedef

5. Pick the operators that associates from right to left 6. What is output of following program ?
(a) % main( )
(b) - {
(c) = int x;
(d) + x= 4 + 2 % 8; printf(“%d”,x);
}
(a) 6 (b) 4 (c) -6 (d) 4.25
7. Among the following operators, whose associatively is 8. int x=1,y=5;
right to left x= ++x + –y; what is the value of x ?
(a) logical operators (b) arithmetic operators (a) 7 (b) 6 (c) 8 (d) 5
(c) conditional expression (d) bitwise operators
9. 10. What could be output of the following function
Main(0 main( )
{ {
int C; int x=2,y=6,z=6;
C=25 / 2; x=y=z;
} What is the value of C printf(“%d”,x);
(a) 12 (b) 12.000000 (c) 0.5 (d) 12.500000 }
(a) 2 (b) 1 (c) 0 (d) 6
11. switch(ch) 12. The minimum number of times the for loop is executed
{ is
case ‘a’: printf(“a”); (a) 1
case ‘b’: printf(“b”); (b) 0
default: printf(“error”); (c) cannot be predicted
} if ch is assigned to the character ‘a’ then the output will (d) 2
be
(a) a b (b) a b error (c) a (d) error
13. What is the difference between the 5’s in the below 14. Under which of the following conditions, the size of the
expressions. array need not be specified?
int num[5]; (a) when it is a formal parameter
num[5]=10; (b) when it is a declaration
(a) Both specify array size (c) when initialization is a part of definition
(b) First is array size, second is particular element (d) when the compiler is smart
(c) First is particular element , second is array size
(d) First is particular element , second is type
15. A character array is terminated internally with 16. The program execution starts from
(a) 0 (b) ; (c) (space) (d) ‘\0’ (a) the function which is last defined
(b) the function other than main( )
(c) the function which is first defined
(d) main( ) function
17. When compared to call by value, the call by reference is 18. The function strrev( ) the actual string in the array
in execution (a) may not reverse (b) will not reverse
(a) fast (b) neither slow nor fast (c) may reverse (d) will reverse
(c) slow (d) equal

19. Automatic variable are active 20.Which of the following is the symbol for preprocessor
(a) outside the function (a) <> (b) $
(b) only in the function where it is defined (c) * (d) #
(c) surroundings of that function
(d) throughout the program
1D 2D 3B 4A 5C 6A 7C 8B 9A 10D 11B 12B 13B 14C
15D 16D 17A 18D 19B 20D
C Programming Language Bits

1. What symbol is used to represent input/output operations 2. The constant ‘\0’ is called as
in a flow chart. (a) nill (b) zero
(a) circles (b) Rectangles (c) full (d) null
(c) Parallelograms (d) Rectangle with rounded end
3. Identify the complete list of C token(s) from the 4. The size of all the below data types is identical except the
following one. Identify the odd one
(a) keywords and constants (a) double
(b) Keywords, constants and operators. (b) long
(c) operators and keywords (c) float
(d) constants and operators (d) unsigned long
5. In the following, which is not valid character constant ? 6. Output of printf(“%f”,3/4) is———
(a) “#” (b) ‘B’ (a) 0.00 (b) gives an error
(c) ‘#’ (d) ‘2’ (c) 0 (d) 0.75

7. int a=13,b=7,c; 8. when x=5 and y=6, z=x^y


c=a&b what is the value of c? then the value of z is
(a) 0000 0000 0000 0100 (a) 4
(b) 0000 0000 0001 0101 (b) 3
(c) 0000 0000 0000 0110 (c) 6
(d) 0000 0000 0000 0101 (d) 7
10. What could be output of the following function
9. In the expression b=6.6/a+(2*a+(3*c)/a*d)/(2/n); which main( )
operation will be performed first? {
(a) 3*c int x=2,y=6,z=6;
(b) 6.6/a x=y=z;
(c) 2*a printf(“%d”,x);
(d) 2/n } (a) 1 (b) 0 (c) 2 (d) 6
11. In switch (expression) statement, the expression should 12. Consider the following program fragment .
evaluate to char c = ‘a’;
(a) a character while (c++ != ‘z’)
(b) an integer putchar(xxx);
(c) a float If the required output is a sequence of alphabets from a to z
(d) a void written in a row, then the value of the variable xxx should
be
(a) c (b) b (c) –c (d) c-1
13. The data items of an array are called as 14. int table [2][3] ={{0}, {0}} in this statement
(a) variables (a) only last row elements are initialized to zero
(b) elements (b) none of the element are initialized to zero
(c) constants (c) all the array elements are initialized to zero
(d) identifiers (d) only first row elements are initialized to zero
15. What is the control string for representing string 16. The statement used to send back any value to the calling
(a) %d (b) %s function is
(c) %c (d) %f (a) continue (b) exit
(c) break (d) return
17. Arrays are passed as arguments to a function by 18. What is the use of strcmp( ) function
(a) context (a) finds the length of the string
(b) reference (b) string comparison
(c) value (c) copies one string into another
(d) both value and reference (d) string concatenation

19. Which of the following is not a storage class 20. The function sqrt() is part of header file.
(a) define (a) math.h
(b) register (b) iostream.h
(c) automatic (c) stdio.h
(d) extern (d) conio.h

1C 2D 3B 4A 5A 6A 7D 8B 9B 10D 11B 12D 13B 14C


15B 16D 17B 18B 19A 20A
C Programming Language Bits

1. What symbol is used to represent input/output operations 2. The character which is used as a statement terminator in
in a flow chart. a ‘C’ program is
(a) circles (b) Parallelograms (a) : (b) ,
(c) Rectangles (d) Rectangle with rounded end (c) . (d) ;
3. The individual units of a C program is known as 4. To convert a value of one data type to another data type
(a) program (b) units in an expression which of the following is used
(c) tokens (d) records (a) user defined types (b) casting
(c) automatic conversion (d) type define
5. C variable cannot start with 6. The operator ++ is called as operator
(a) an underscore (b) a number (a) increment (b) special increment
(c) an upper case letter (d) a lower case (c) decrement (d) double addition
7. Among the following operators, whose associatively is 8. The symbol for left shift operator is:
right to left (a) <= (b) <<
(a) conditional expression (b) arithmetic operators (c) < (d) <<<
(c) logical operators (d) bitwise operators
9. Which operator has the highest priority 10. for( i = 1;i !=5; i++)
(a) + (b) * { printf(“%d”, i+2);} What is the output ?
(c) ( ) (d) % (a) 3 4 5 6 7 (b) 3 4 5
(c) 3 5 7 9 11 (d) 1 2 3 4 5
11 Which operator also referred as ternary operator. 12. A do-while loop is useful when we want that the
(a) Conditional (b) Addition statements within the loop must be executed.
(c) Exponential (d) Bit wise (a) none of the above (b) at least once
(c) more than once (d) exactly once
13. The amount of storage required for holding elements of 14. An array which contains two subscripts, to represent
the array depends on each element is called as
(a) run-time requirement (b) data type (a) two dimensional (b) multidimensional
(c) size (d) data type and size (c) three dimensional (d) one dimensional

15. main() { 16. The parameters of the called function are called
char name[5]; (a) casual parameters
scanf(“%s”,name); (b) actual parameters
printf(“%s”, name); (c) usual parameters
} if “Program” is the given as input, what will be the o/p (d) formal parameters
of the program;
(a) Progr (b) program
(c) Prog (d) Runtime error
17. output of the following program is 18. Give the output for the following:
main() { main( )
int a , count; {
int funct( int count); char arr[10];
for( count=1;count<=5;++count) int ctr =0;
{ printf(“Enter a Sting:”);.
a=funct1(count); gets(arr);
printf(“%d”, a); while(arr[ctr]!=’\0’)
} {
} ctr + + ;
int funct1(int x) }
{ printf(“%d”,ctr);
int y; }
y= x*x; (a) length of the string only when it is less than 9 characters
return(y); length
} (b) String (c) String length
(a) 1 4 9 16 25 (b) 36 (c) 25 (d) 25 9 16 (d) length of the string only when its length is 10 characters

19. register variables can hold ———– values 20. The header file, to use a library function cos() is
(a) float (b) int (c) complex (d) double (a) stdlib.h (b) math.h (c) conio.h (d) dos.h

1B 2D 3C 4B 5B 6A 7A 8B 9C 10A 11A 12B 13D 14A


15C 16D 17A 18C 19B 20B
C Programming Language Bits

1.Pictorial representation of an algorithms is known as 2. The function getchar( ) is used to read


(a) Graph chart (b) Diagram (a) a string (b) a word
(c) Flowchart (d) picture (c) a Boolean value (d) a character
3. What are the smallest individual units in a program 4. What is the size of long double variable
(a) Structures (b) record (a) 8 bytes (b) 10 bytes
(c) Functions (d) Tokens (c) 16 bytes (d) 4 bytes
5. In C, every variable has 6. Associativity of arithmetic operators is from
(a) a size and value (b) a type,name,value and size (a) left to right (b) middle to right
(c) a type and size (d) a name and type (c) middle to left (d) right to left
7. In an expression involving || (logical OR)operator the 8. What is the value of !0?
evaluation (a) 00
(a) takes place from right to left (b) 0
(b) will be stopped if one of its components evaluates to (c) -1
false (d) 1
(c) will be stopped if one of its components evaluates to
true
(d) takes place from left to right
9. Which of the following shows the correct hierarchy of 10. What is the output of the following program
arithmetic operations in C main()
(a) ( ), / or *, - or + (b) ( ), &&, / , *, +, - { int i; for( i=1; i<=5; i++) printf(“%d”,i); }
(c) ( ),&&,*or / + or -; (d) ( ), &&, *,/,+,- (a) 4 4 4 4 (b) 5 5 5 5
(c) 1 1 1 1 (d) 1 2 3 4 5
11. 12. What will be the final values of x and y?
switch(ch) void main()
{ {
case ‘a’: printf(“a”); int x = 1, y = 1;
case ‘b’: printf(“b”); do while (x<=8)
default: printf(“error”); {
} if ch is assigned to the character ‘a’ then the output will x + +; y ++;
be } while (y<=5);
(a) a b error (b) error (c) a b (d) a printf (“\n x= %d y = %d”, x,y);
}
(a) x = 6 y = 9 (b) x = 9 y = 6
(c) x = 6 y = 6 (d) x = 9 y = 9
13. For the array declaration int a[5]; What is the amount of 14. Dynamic memory allocation in array results in
storage required (a) allocation of memory at debugging time
(a) 20 bytes (b) 5 bytes (b) allocation of memory at runtime
(c) 10 bytes (d) 5 bits (c) allocation of memory at compile time
(d) allocation of memory at file saving time
15. The input function scanf() can be used with the 16. The default return type of a function is
following format specification to read a string (a) float (b) int (c) char (d) double
(a) %d (b) %c (c) %s (d) %f
17. What is the output of the following program 18. The function is used to reverse a string
void main() { (a) strcat()
int x = 2; (b) strlen()
sqr(x); (c) strrev()
printf(“%d”, x); (d) strcmp()
}
sqr(x){
int y; y = x * x; printf (“%d”, y);
}
(a) 2 2 (b) 4 4 (c) 4 2 (d) 2 4
19. What is the output of the following program 20. #include is a directive
main() { (a) complier
static int y; (b) processor
printf (“%d\n”, y); (c) pre-compiler
} (a) compilation error (b) run-time error (d) pre-processor
(c) 0 (d) undefined
1C 2D 3D 4B 5B 6A 7C 8D 9A 10D 11A 12D 13C 14B
15C 16B 17C 18C 19C 20D
C Programming Language Bits

1 Pictorial representation of an algorithms is known as 2. A block is enclosed with pair of


(a) Flowchart (b) Diagram (a) { } (b) [ ]
(c) Graphchart (d) picture (c) ( ) (d) <>
3. What are the smallest individual units in a program 4. A character variable can at a time store
(a) record (b) Structures (a) a string of 254 characters (b) 2 character
(c) Functions (d) Tokens (c) 1 character (d) 8 character
5. Array elements are stored in 6. Which of the following is shorthand operator for a=a%b
(a) Sequential memory locations (a) a%=b
(b) Direct memory locations (b) a =%b
(c) Random memory location (c) a % b (d) a%b=a
(d) Scattered memory locations
7. Which of the following is the ternary operator in C 8. The effect of shifting a variable to the left by one bit
(a) ?? (b) ?: position is
(c) :: (d) ?; (a) subtract it by 2 (b) add it by 2
(c) multiply it by 2 (d) divide it by 2
9. Which operator has the highest priority 10. Consider scanf(“%2d”, &n); and the input data is 3142
(a) + (b) * then n will be assigned
(c) ( ) (d) % (a) 42 (b) 31.42
(c) error (d) 31
11. x=(a> b)?a : b; is identical to 12. The while loop is terminated when the conditional
(a) if(a>b) x=a; expression returns
else x=b; (a) 3
(b) if(a> b) n=b; (b) 1
else x=a; (c) 2
(c) syntactically invalid statement (d) zero
(d) while(a>b) {x=a;x=b;}
13. Array elements are stored in 14. Under which of the following conditions, the size of the
(a) either in row major or column major order array need not be specified?
(b) in diagonal order (a) when it is a formal parameter
(c) row major order (b) when the compiler is smart
(d) column major order (c) when initialization is a part of definition
(d) when it is a declaration
15. Output of the following program 16. If actual arguments are more than the formal arguments
#include< stdio.h> then
main() (a) extra actual arguments are discarded
{ (b) a compilation error
char address[15]; (c) extra actual arguments are initialized to garbage values
scanf(“%s”,address); (d) extra actual arguments are initialized to zero
printf(“%s”,address);
} if we enter ”string name” then output is
(a) string (b) string name (c) name (d) runtime error
17. What is the output of the following program? 18. What is the objective of the string handling function
main() { strncmp().
int x , y; (a) Compares only last n characters in both argument
x = 10; y = 100; (b) Compares two string only if length of one string is
change (x,y); exactly n
printf (“%d, %d”, x,y);} (c) Similar to strcmp() function
change (int x, int y){ (d) Compares only first n characters in both argument
int k; k = a; a = b; b = k;}
(a) 10, 100 (b) 100, 100 (c) 10, 10 (d) 100, 10
19. An external variable definition can appear in 20. Which of these complier directives access to the print
(a) only two files function
(b) only three files (a) #include <stdio.h > (b) #define print
(c) only one file (c) include stdio.h; (d) #include conio.h;
(d) more than one file
1A 2A 3D 4C 5A 6A 7B 8C 9C 10D 11A 12D 13A 14C
15A 16B 17A 18D 19C 20A
C Programming Language Bits

1. The process of removing a bug is known as 2. The function getchar( ) is used to read
(a) running (b) executing (a) a boolean value (b) a character
(c) debugging (d) compilation (c) a string (d) a word
3. Which of the following is a valid numeric constant 4. Which of the following is a scalar data type used in ‘C’
(a) 15 750 (b) 65432 (a) double (b) union
(c) $1000 (d) 20,000 (c) structure (d) array

5. Pick the operators that associates from right to left 6. The operator % yields
(a) + (b) % (a) Fractional part (b)remainder after integer division
(c) = (d) - (c) quotient value (d) Percentage value
7. In an expression involving || operator the evaluation 8. If a=15 then b=a <<2 will results
(a) will be stopped if one of its components evaluates to (a) b=3
true (b) b=30
(b) takes place from left to right (c) b=7
(c) takes place from right to left (d) b=60
(d) will be stopped if one of its components evaluates to
false
9. In the expression b=6.6/a+(2*a+(3*c)/a*d)/(2/n); which 10. What is the output of the following program
operation will be performed first? main( )
(a) 6.6/a (b) 2*a { int a=5, i=1; while(i++ <a) { printf(“%d”,a); }
(c) 2/n (d) 3*c (a) 5,4,3,2,1 (b) 5 5 5 5 5
(c) 4,3,2,1 (d) 1 1 1 1 1
11. switch(ch) 12. What would be the final value of x after execution of
{ the following program?
case ‘a’: printf(“a”); void main()
case ‘b’: printf(“b”); { int x = 1;
default: printf(“error”); while (x<=10)
} if ch is assigned to the character ‘a’ then the output will do
be { x++;
(a) a b (b) a b error } while (x< = 5);
(c) a (d) error printf (“\n x = %d”, x); }
(a) x = 6 (b) x = 2 (c) 10 (d) x = 11
13. The number of elements in array declaration 14. Identify the incorrect declaration of arrays from the
(a) dynamically identifies based on largest index used in following
program (a) int a[50];
(b) assume default size as ‘0’ (b) float values[10][20];
(c) requires to be specified (c) double a[50];
(d) does not require to be specified (d) int score[10,15];

15. A string in the ‘C’ language is represented by enclosing 16. ‘void’ means
a sequence of characters in (a) something not known (b) 0
(a) flower brackets { } (b) double quotes “ “ (c) 1 (d) nothing
(c) parenthesis ( ) (d) single quotes ‘ ‘
17. What is the output of 18. The function strrev( ) the actual string in the array
main() { (a) will reverse
int x, change (int); (b) will not reverse
x = 20; (c) may not reverse
change (x); (d) may reverse
printf (“%d”, x);
}
change (int x) {x = 10; printf (“%d”. x); }
(a) 10 30 (b) 20 20 (c) 10 10 (d) 10 20

19. The storage area for register variables 20. Symbolic constants are defined as
(a) memory (b) processor registers (a) #define s1=s2; (b) #define s1 s2
(c) virtual memory (d) cache (c) #define s1 s2; (d) #define s1=s2
1C 2B 3B 4A 5C 6B 7A 8D 9A 10B 11B 12D 13C 14D
15B 16D 17D 18A 19B 20B

You might also like