c and Ds online bits

1. C language has been developed by

(a) Peter Norton

(b) Martin Richards

(c) Ken Thompson

(d) Dennis Ritchie

2. The constant ‘\b0 is used for

(a) tab

(b) backspace

(c) bell

(d) vertical blank

3. In the following which one is not a C keyword?

(a) case

(b) choice

(c) volatile

(d) for

4. The size of operator returns the size of an operand

(a) in bits

(b) in words

(c) in bytes

(d) in float

5. The declaration of a variable should be done

(a) only in the calling program

(b) after using it

(c) at the time of using

(d) before using it

6. The value of 2%5 is

(a) 3

(b) 10

(c) 0

(d) 2

7. && and || are which kind of operators.

(a) Relational

(b) Logical

(c) Arithmetic

(d) Conditional

8. main ( ) { int m,y;

m = 5;

y = ++m;

printf(”%d %d”,m,y);

} consider the above code and find the output

(a) 6,6

(b) 5,6

(c) 5,5

(d) 6,5

9. int C;

C=25/2; What is the value of C

(a) 12.000000

(b) 12

(c) 12.500000

(d) 0.5

10. The single character input/output functions are

(a) scanf and putchar

(b) getchar and printf

(c) scanf and printf

(d) getchar and putchar

11. If a = 20 b=30 value of k in the expression k=(a>b)?a:b; is

(a) 30

(b) 0

(c) garbage

(d) 20

12. The number of loop constructs in C is

(a) 4

(b) 5

(c) 2

(d) 3

13. The index or subscript value for an array of size ‘n’ ranges from

(a) 0 to n

(b) 1 to n-1

(c) 1 to n

(d) 0 to n-1

14. Consider the statement

int val[2][4]={1,2,3,4,5,6,7,8 }; 4 will be the value of

(a) val[1][4]

(b) val [0] [3]

(c) val[1][1]

(d) val[0][4]

15. The following program fragment

int m,n,b; char wer[80]; m=n=b=8;

sprintf(wer,“%d%d%d”,m,n,b);

puts(wer);

(a) prints 888 888 888

(b) prints the string 8 8 8

(c) prints the null string

(d) prints the string 888

16. The library function exit() causes an exit from

(a) the block in which it occurs

(b) the function in which it occurs

(c) main program

(d) the loop in which it occurs

17. What is the output of the following program:

main()

{int x,y;

x = 40; y = 80;

change (&x, &y);

printf (“%d %d”, x,y);

}change (

int *

a, int *

b)

{int *k;

* k = *a;

*a = *b;

*b = *k;

}

(a) 80 40

(b) 80 80

(c) 40 80

(d) 40 80

18. Which of the following would compute the square of x in ‘C’

(a) power(x,2)

(b) pow(x,2)

(c) pow(2,x)

(d) x**2

19. External variables are active

(a) only within some functions

(b) throughout the program

(c) only with in main functions and functions with in main functions

(d) only within the function where it is declared using the qualifier extern

20. Which of the following is a correct way of defining a symbolic constant pie in C

(a) #define pie= 3.142

(b) # Define pie 22/7

(c) # define pie = 22/7

(d) #define pie 22/7

D B B C D D B A B D A D D B D C A B B D

1. The error in a program is called

(a) flow

(b) bug

(c) virus

(d) vaccine

2. The ANSI C standard recognizes maximum length of a variable up to

(a) 31 characters

(b) unlimited characters

(c) 8 characters

(d) 15 characters

3. The names of a variables, functions, arrays are known as

(a) keywords

(b) identifiers

(c) names

(d) elements

4. A short integer occupies normally of memory

(a) two bytes

(b) four bytes

(c) three bytes

(d) single bytes

5. The declaration of a variable should be done

(a) after using it

(b) only in the calling program

(c) before using it

(d) at the time of using

6. Associativity of arithmetic operators is from

(a) right to left

(b) left to right

(c) middle to right

(d) middle to left

7. Which of the following is used in ‘C’ to indicate logical OR

(a) ||

(b) U

(c) V

(d) |

8. what is the result of the following statements

int x = 10;

int y ;

y = + + x;

(a) y = 10, x = 10

(b) y = 10, x = 11

(c) y = 11, x = 11

(d) y =11, x =10

9. The expression, a = 30*1000+2768 evaluates to

(a) 32768

(b) -32768

(c) 302768

(d) 13040

10. What is output of the following program?

main()

{int a;

float b;

a=1/2;

b=1.0/2.0;

printf(“ a=%d b=%f”,a,b);

}

(a) a=0.5 b=0. 5

(b) a=0.0 b=0. 5

(c) a=0.0 b= 5

(d) a=0 b=0. 5

11. In switch statement

(a) default case, if used, can be placed anywhere

(b) default case must be present

(c) default case, if used, should be the last case

(d) more than one default allowesd

12. while(++I <=n);

what is the value of I when the loop completes, if the initial value of I is 1.

(a) n+1

(b) n

(c) n+2

(d) n-1

13. Elements of a string are accessed by a number called as

(a) label

(b) coordinate

(c) pointer

(d) index

14. If we don’t initialize a static array, what will be the elements set to:

(a) character constant

(b) an undetermined value

(c) 0

(d) a floating point number

15. Output of the following program

#include<>

main()

{char address[15];

scanf(“%s”,address);

printf(“%s”,address);

}if we enter ”string name” then output of the program is

(a) string name

(b) runtime error

(c) string

(d) name

16. The values of actual arguments are assigned to the formal arguments on a basis

(a) many to many

(b) one to one

(c) one to many

(d) many to one

17. Which of the following statements is correct when an array is passed to a called function

(a) function-name ( array-name , size )

(b) not possible

(c) function-name ( array-name[size])

(d) function-name ( array-name [ ] )

18. What will be the output of the following program?

void main()

{char txt[ ]

=

ABC\0DEF”;

printf(“%s %d”, txt, sizeof (txt));

}

(a) ABC\0DEF 7

(b) ABC 4

(c) ABC 8

(d) ABCDEF 8

19. In case both external and autovariables are declared with the same name in a program, the priority is given to

which of the variables

(a) complier dependent

(b) auto variable

(c) depends on logic

(d) external variable

20. The header file that must be included at the beginning of a C program to use a library function cos is

(a) math.h

(b) stdlib.h

(c) conio.h

(d) dos.h

B A B A C B A C A D A A D C C B A C B A

1. C was primarily developed as a

(a) Platform independent language

(b) Data processing language

(c) System programming language

(d) General purpose language

2. In C, comments are placed between

(a) /*......*/

(b) //

(c) *.....*

(d) *...... /*

3. Which of the following is a valid ‘C’ variable name ?

(a) $comp

(b) 4compute

(c) 173comp

(d) none

4. The size of all the below datatypes is identical except the one. Identify the odd one

(a) unsigned long

(b) float

(c) long

(d) double

5. Which of the following is the assignment operator in C

(a) = =

(b) =

(c) : =

(d) !=

6. Which of the following is allowed in a C arithmetic statement

(a) / /

(b) [ ]

(c) { }

(d) ( )

7. Which of the following is not a relational operator

(a) & &

(b) < =

(c) >

(d) !=

8. what is the result of the following statements

int x = 10;

int y ;

y = + + x;

(a) y = 11, x = 11

(b) y = 10, x = 10

(c) y =11, x =10

(d) y = 10, x = 11

9. If y is of integer type variable then the two expressions.

3*(y-8)/9 and (y-8)/9*3 yield the same value if

(a) y-8 is an integer multiple of 3

(b) y is an even number

(c) y-8 is an integer multiple of 9

(d) y is an odd number

10. Consider scanf(“%2d”, &n); and the input data is 3142 then n will be assigned

(a) 42

(b) 31.42

(c) 31

(d) error

11. switch(ch)

{case ‘a’: printf(“a”);

case ‘b’: printf(“b”);

default: printf(“error”);

} if ch is assigned to the character ‘a’ then the output will be

(a) a

(b) a b error

(c) a b

(d) error

12. How many while statements are possible in do.... While loop?

(a) 3

(b) 1

(c) any number

(d) 2

13. Output of the below program

#include

main()

{int a,b=0;

int c[10]={1,2,3,4,5,6,7,8,9,0 };

for(a=0;a<10;++a)

b+=c[a];

printf(“%d”,b);

}

(a) 1 3 6 10 15 21 28 32 45 45

(b) 45

(c) 55

(d) 0

14. Two dimensional array elements are stored

(a) complier dependent

(b) in row major order

(c) system dependent

(d) in column major order

15. char x[10]=“whatisit”;

char *y=“whatisit”;

Pick the correct answer

(a) The outputs of pulse(x) and puls(y) compiler dependant

(b) The output of puts(x) and puts(y) will be different

(c) The output of puts(x) and puts(y) will be same

(d) The output of puts(y) is implementation dependant

16. Any program in C contains atleast

(a) three functions

(b) two functions

(c) one function

(d) zero functions

17. ‘C’ language by default allows

(a) call by value

(b) call by pointer

(c) call by name

(d) call by reference

18. String handling functions are kept in

(a) stdio.h

(b) stdlib.h

(c) string.h

(d) conio.h

19. Which of the following is not a storage class

(a) automatic

(b) register

(c) define

(d) external

20. #include is a directive

(a) complier

(b) pre-compiler

(c) pre-processor

(d) processor

C A D D B D A A C C B C B A C C A C C C

1. The process of repeating a group of statements in an algorithm is known as

(a) selection

(b) iteration

(c) flow

(d) sequence

2. The ANSI C standard recognizes maximum length of a variable up to

(a) 31 characters

(b) 15 characters

(c) unlimited characters

(d) 8 characters

3. The only allowed special character in a variable name is

(a) ;

(b) (under scrore)

(c) ,

(d) :

4. What is the size of long double variable

(a) 4 bytes

(b) 10 bytes

(c) 16 bytes

(d) 8 bytes

5. The declaration of a variable should be done

(a) at the time of using

(b) after using it

(c) before using it

(d) only in the calling program

6. main( )

{ float a;

int x = 6; y = 4;

a = x/y;

print (“%f”,a)

}what is the output

(a) 1.5

(b) 0.5

(c) 1.00

(d) error

7. int a=13,b=7,c;

c=a&b what is the value of c

(a) 0000 0000 0000 0110

(b) 0000 0000 0000 0100

(c) 0000 0000 0001 0101

(d) 0000 0000 0000 0101

8. Among the following operators which operators has the highest priority

(a) Bitwise XOR

(b) Logical OR

(c) Logical AND

(d) Bitwise OR

9. If y is of integer type variable then the two expressions.

3*(y-8)/9 and (y-8)/9*3 yield the same value if

(a) y-8 is an integer multiple of 9

(b) y-8 is an integer multiple of 3

(c) y is an odd number

(d) y is an even number

10. The values of a,b and c in the statement scanf(“%d%f%c”,&a,&b,&c); if the input stream is 15.75 23 x is

(a) 15 23 x

(b) 15 23.00 x

(c) 15 0.75 2

(d) 15 0.75 x

11. Which of the following statement is not true about the switch statement

(a) In switch() case statement nested if can be used

(b) Character constants are automatically converted into integer

(c) The switch() can evaluate relational or logical expressions

(d) No two case statements have identical constants in the same switch

12. The number of loop constructs in C is

(a) 3

(b) 4

(c) 5

(d) 2

13. An array can have dimension(s).

(a) three

(b) single

(c) multiple

(d) double

14. An array which contains two subscripts, to represent each element is called as

(a) three dimensional

(b) two dimensional

(c) multidimensional

(d) one dimensional

15. putchar() and getchar() are both

(a) control statement

(b) input and output statements

(c) type declaration statements

(d) assignment statements

16. A function is one that returns no value.

(a) float

(b) recursive

(c) void

(d) Integer

17. While passing an array as an actual argument the function call must have

(a) the array name alone

(b) the array name with its type

(c) the array name with empty brackets

(d) the array name with its size

18. The strcat( ) function is used for

(a) Multiplication

(b) Concatenation

(c) Joining

(d) Addition

19. The lifetime of external variables is

(a) only in main function

(b) throughout the program

(c) only within the function where it is declared

(d) only in some specified functions

20. #directive must be present

(a) before the main function

(b) any where in the program body

(c) after the main function

(d) at the end of the program

B A B B C C D A A C D A C B B C A B B A

0 comments:

Copyright © 2008 - JNTU Online Bits - is proudly powered by Blogger
JNTU