cds bits

1. Pick up the wrong sequence
(a) Program coding, Debugging, Data analysis
(b) Data analysis, Development of algorithm, Program coding
(c) Problem identification, Task analysis, Data analysis
(d) Problem coding, Testing, Debugging
2. A machine language program consists of instructions written in
(a) keywords
(b) english like words
(c) mnemonics
(d) 0’s and 1’s
3. What is the valid identifier in the following
(a) @hgd12
(b) fahs%*
(c) q1234
(d) 1fdasgf
4. Which of the following is a derived data type in ‘C’
(a) Float
(b) Char
(c) Array
(d) Int
5. A character constant is assigned within
(a) paranthers
(b) double quotes
(c) no quotes
(d) single quotes
6. Which of the following arithmetic expression is invalid
(a) 2 + + + + + 3
(b) 7.5 % 3
(c) 2 + 3/5
(d) 2/3 + 4
7. Which of the following is the ternary operator in C
(a) ::
(b) ?;
(c) ?:
(d) ??
8. Which of the following comments about the ++ operator is not correct
(a) The operand can come before the operator
(b) It is unary operator
(c) The operand can come after the operater
(d) It can be applied to an expression
9. x = 9 - ((12 / 3 ) + 3 * 2 ) - 1 what is the value of x.
(a) 10
(b) 2
(c) -2
(d) 8
10. The single character input/output functions are
(a) scanf and putchar
(b) getchar and putchar
(c) scanf and printf
(d) getchar and printf
11. Which one of the following is not a loop control structure.
(a) do-while
(b) for
(c) if
(d) while
12. Assume all variable are declared What is the output of the following code.
count = 0;
while (count != 100);
{ count = 1;
sum = sum + x;
count = count + 1;
}
(a) Error
(b) It will give count as 10
(c) it will give the sum of 1st10 natural numbers
(d) It is in infinite loop
13. A character array always ends with a
(a) null (\0) character
(b) fullstop ()
(c) semicolon (;)
(d) question mark (?)
14. The total number of elements in array a[n][m]
(a) n+m
(b) n*m
(c) (n+1) * (m+1)
(d) (n-1)*(m-1)
15. A string with spaces can be read using a function.
(a) getsentences()
(b) gets()
(c) getch()
(d) getchar()
16. main() is
(a) friendly function
(b) user defined function
(c) library function
(d) member function
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) 40 80
(b) 40 80
(c) 80 40
(d) 80 80
18. How many arguments that the strcmp() function can take
(a) one
(b) three
(c) four
(d) two
19. Register variables can hold ———– values
(a) int
(b) double
(c) complex
(d) float
20. Which of the following is a correct way of defining a symbolic constant pie in C
(a) # Define pie 22/7
(b) # define pie = 22/7
(c) #define pie= 3.142
(d) #define pie 22/7

A D C C D B C D C B C D A B B B C D A D
1. The error in a program is called
(a) bug
(b) virus
(c) vaccine
(d) flow
2. C is a
(a) Low level language
(b) High level language
(c) High level language with some low level features
(d) Machine language
3. Which of the following is not a keyword
(a) enum
(b) storage
(c) signed
(d) register
4. What is the size of long double variable
(a) 8 bytes
(b) 10 bytes
(c) 16 bytes
(d) 4 bytes
5. Which is an invalid variable name:
(a) Xx
(b) floating
(c) Int
(d) net-salary
6. main( )
{ float a;
int x = 6; y = 4;
a = x/y;
print (“%f”,a)
}what is the output
(a) 1.00
(b) 1.5
(c) error
(d) 0.5
7. The operators *, || ,<,= if arranged in the ascending order of precedence reads
(a) = ,||, <, *
(b) *, || , =
(c) <, || ,= , *
(d) = ,< , || , *
8. a=30; a<<2 =?
(a) 10
(b) 150
(c) 180
(d) 120
9. int C;
C=25/2; What is the value of C
(a) 12
(b) 12.500000
(c) 12.000000
(d) 0.5
10. The single character input/output functions are
(a) scanf and printf
(b) getchar and printf
(c) scanf and putchar
(d) getchar and putchar
11. Identify the wrong statement:
(a) if (a >b) {; ; }
(b) if (a(c) if (a(d) if a12. Which command is used to skip the rest of a loop and carry on from the top of the loop again?
(a) continue;
(b) switch;
(c) resume;
(d) break;
13. Array is used to represent the following
(a) A list of data items of real data type
(b) A list of data items of same data type
(c) A list of data items of integer data type
(d) A list of data items of different data type
14. Identify the incorrect declaration of arrays from the following
(a) int a[50];
(b) float values[10][20];
(c) int score[10,15];
(d) double a[50];
15. A string in the ‘C’ language is represented by enclosing a sequence of characters in
(a) parenthesis
(b) flower brackets
(c) double quotes
(d) single quotes
16. A function is one that returns no value.
(a) float
(b) Integer
(c) recursive
(d) void
17. Recursion means
(a) Function calling a function
(b) Function calling a same function
(c) Passing a function to a function
(d) Function without a return value
18. If the character type variable sym is assigned a value ‘y’ and the string variable str is assigned a value LEARN.
What is the value in str after execution of the following statement strset(str,sym)
(a) yyyyy
(b) LEARNY
(c) Y
(d) LEARY
19. Which of the following statement is wrong with respect to a storage class
(a) it specifies the defualt initial value
(b) by defualt a storage class is static
(c) it specifies the life of a variable
(d) if specifies where variable is stored
20. The header file that must be included at the beginning of a C program to use a library function cos is
(a) conio.h
(b) dos.h
(c) math.h
(d) stdlib.h

A C B B D A A D A D D A B C C D B A B C
1. The symbol with rounded ends is used to represent
(a) decision making
(b) start/ stop
(c) equation processing
(d) input/output
2. The character which is used as a statement terminator in a ‘C’ program is
(a) ,
(b) :
(c) .
(d) ;
3. What are the smallest individual units in a program
(a) Structures
(b) record
(c) Functions
(d) Tokens
4. What is size of double variable?
(a) 10 Bytes
(b) 4 Bytes
(c) 1 byte
(d) 8 Bytes
5. Variables are initialized in C, using
(a) = =
(b) =
(c) >
(d) : =
6. Associativity of arithmetic operators is from
(a) middle to left
(b) left to right
(c) right to left
(d) middle to right
7. The equality relational operator is represent by
(a) ==
(b) :=
(c) .EQ.
(d) =
8. The symbol for right shift operator is
(a) >
(b) − >
(c) <=
(d) >>
9. float c,
c=25/2; What is the value of c
(a) 12.500000
(b) 12
(c) 12.0
(d) 12.000000
10. The single character input/output functions are
(a) scanf and printf
(b) scanf and putchar
(c) getchar and printf
(d) getchar and putchar
11. What is output of the following program?
main( )
{int x=15,y;
y=(x >5)? 3 : 4;
printf(“%d”,y);
}
(a) 3
(b) 2
(c) 1
(d) 4
12. Output of the following statement is
for (I=0;I<5;I++);
printf(“%d”,I);
(a) 5
(b) 1 2 3 4 5
(c) 1 2 3 4
(d) 0 1 2 3 4
13. All the elements in the array must be
(a) defined
(b) neither initialized nor defined
(c) initialized and defined
(d) initialized
14. How many bytes will be allotted for the declaration int num[4] [3]
(a) 6 bytes
(b) 24 bytes
(c) 12 bytes
(d) 48 bytes
15. Consider the following program fragment.
char c=‘a’;
while(c++<=‘z’)
putchar(xxx);
if the required output is the alphabet sequence from a to z (abc.xyz) the xxx should be
(a) ++c
(b) -c
(c) c
(d) c-1
16. If actual arguments are more than the formal arguments then
(a) a compilation error
(b) extra actual arguments are initialized to zero
(c) extra actual arguments are discarded
(d) extra actual arguments are initialized to garbage values
17. output of the following program is
#include< stdio.h>
main()
{int a,count;
int funct( int count);
for( count=1;count<=5;++count)
{a=funct1(count);
printf(“%d”,a);
}}
int funct1(int x)
{int y;
y= x*x;
return(y);
}
(a) 25 9 16
(b) 36
(c) 1 4 9 16 25
(d) 25
18. In the following C-statement, what is the datatype of d and st respectively.
Printf {“\t%.s\n”, d, st);
(a) character, string
(b) digit, character
(c) string, string
(d) digit, string
19. main()
{} int a;
fun1( ) {} fun2( ) {} To which of the above functions, int a is available to
(a) available to neither of the functions
(b) all functions
(c) only fun1( )
(d) both fun1( ) and fun2 ( )
20. Which of the following is a correct way of defining a symbolic constant pie in C
(a) #define pie 22/7
(b) # define pie = 22/7
(c) # Define pie 22/7
(d) #define pie= 3.142
B D D D B B A D D D A A A B D A C D D A
1. What type of errors are checked during compilation
(a) syntax errors
(b) run - time errors
(c) divide by zero error
(d) logical errors
2. A machine language program consists of instructions written in
(a) keywords
(b) 0’s and 1’s
(c) mnemonics
(d) english like words
3. Which of the following cannot be used as an identifier.
(a) alphabet followed by digit
(b) Library function name
(c) alphabet
(d) Keywords
4. The qualifier that may precede float is
(a) signed
(b) unsigned
(c) Nothing to precede
(d) long
5. If you declare array without the keyword static the elements will be set to
(a) ones
(b) zero
(c) garbage value
(d) null value
6. main( )
{ int a=5; float b=10,c;
c=b%a;
printf(“%f”,c);
}output is——————–
(a) 0.000000
(b) 0.00
(c) gives an error
(d) 2.0
7. In an expression involving ||
||
operator the evaluation
(a) takes place from right to left
(b) takes place from left to right
(c) will be stopped if one of its components evaluates to false
(d) will be stopped if one of its components evaluates to true
8. What is the value of !0?
(a) 1
(b) 00
(c) 0
(d) -1
9. x = 9 - ((12 / 3 ) + 3 * 2 ) - 1 what is the value of x.
(a) 10
(b) 8
(c) -2
(d) 2
10. What is the output for the following program
main( )
{ int m=5,y;
y=++m;
printf(“%d,%d”m,y);
}
(a) 5,5
(b) 5,6
(c) 7,5
(d) 6,6
11. In switch statement
(a) default case, if used, can be placed anywhere
(b) default case must be present
(c) more than one default allowesd
(d) default case, if used, should be the last case
12. What is the output of the following program
main()
{ int a=123;
int r, rev=1;
while (a > 0)
{a=a%10;
rev=rev*10+a;
a=a/10;
}printf(“%d”,rev);
}
(a) 123
(b) 3
(c) 321
(d) 3 0 2 0 1
13. One dimensional array is known as
(a) vector
(b) set
(c) matrix
(d) table
14. An example application for a two dimensional array is
(a) a matrix
(b) an array with 2 elements
(c) an array with 10 elements
(d) two integer variable
15. The NULL character \0 in a string indicates
(a) invalid string
(b) the beginning of string
(c) the end of string
(d) the middle of string
16. Find the C library function from the following
(a) mul()
(b) main()
(c) brazil()
(d) printf()
17. Find the error in the following recursive function, if exists;
fact (m)
{int f =1;
f = m*fact (m-1);
return(f);
}
(a) it results in stack underflow
(b) no error
(c) logic is correct but consumes more CPU time
(d) no termination condition
18. The function is used to find the length of the string
(a) strrsa()
(b) strlen()
(c) strrev()
(d) strcat()
19. The following program
main()
{inc(); inc(); inc();
}inc()
{static int x;
pritnf(“%d”, ++x);
}
(a) Prints three consecutive unpredictable numbers
(b) Prints 0 1 2
(c) Prints 1 2 3
(d) Prints 1 1 1
20. Which of the following is a correct way of defining a symbolic constant pie in C
(a) # Define pie 22/7
(b) #define pie= 3.142
(c) #define pie 22/7
(d) # define pie = 22/7

A B D C C C D A C D A C A A C D D B C C
1. C language has been developed by
(a) Martin Richards
(b) Ken Thompson
(c) Peter Norton
(d) Dennis Ritchie
2. Every executable C program must contain a
(a) main function
(b) printf function
(c) scanf function
(d) scanf, printf and main functions
3. The names of a variables, functions, arrays are known as
(a) identifiers
(b) names
(c) elements
(d) keywords
4. The keyword is used to define a new data type.
(a) union
(b) typedef
(c) array
(d) Structure
5. In C every variable has
(a) a type and size
(b) a type, name, value and size
(c) a name and type
(d) a size and value
6. What is the remainder of 8%10?
(a) 0
(b) 8
(c) 2
(d) 1
7. The operator with lowest priority in the list && , + , | | , < is
(a) | |
(b) +
(c) &&
(d) <
8. main( )
{ int a=0; if(a) printf(“%d”,++a); else printf(“%d”, a+=2) ; } the output is
(a) 1
(b) 0
(c) 3
(d) 2
9. In the expression b=6.6/a+(2*a+(3*c)/a*d)/(2/n); which operation will be performed first?
(a) 3*c
(b) 2*a
(c) 2/n
(d) 6.6/a
10. How would you copy the name “Hello” to a character array (i.e. string) declared as char str[10];
(a) strcat(str,“Hello”);
(b) printf( str, “Hello” );
(c) strcpy( str, “Hello” );
(d) str = “Hello”;
11. In switch (expression) statement, the expression should evaluate to
(a) a character
(b) an integer
(c) a void
(d) a float
12. Which of the following is not correct
(a) while loop is executed atleast once
(b) do . while loop is executed at least once
(c) while loop is executed only if the condition is true
(d) dowhile loop is ececuted only if the condition is true
13. The number of elements in array declaration
(a) dynamically identifies based on largest index used in program
(b) does not require to be specified
(c) assume default size as ‘0’
(d) requires to be specified
14. An array which contains two subscripts, to represent each element is called as
(a) three dimensional
(b) one dimensional
(c) two dimensional
(d) multidimensional
15. printf (“\ “ well done\” ”); what will be the output of this statement
(a) \“well done \”
(b) well done
(c) “ well done”
(d) \ well done \
16. A function can be called in a program
(a) Only three times
(b) Any number of times
(c) Only two times
(d) Only once
17. What is the output of the following program
void main()
{int x = 2;
sqr(x);
printf(“%d”, x);
}sqr(x)
{int y;
y = x * x;
printf (“%d”, y);
}
(a) 4 2
(b) 2 2
(c) 4 4
(d) 2 4
18. What is the use of strcmp( ) function
(a) string comparison
(b) copies one string into another
(c) finds the length of the string
(d) string concatenation
19. What is the output of the following program
main()
{static int y;
printf (“%d\n”, y);
}
(a) 0
(b) run-time error
(c) undefined
(d) compilation error
20. Which of the following is the symbol for preprocessor
(a) $
(b) *
(c) <>
(d) #

D A A B B B A D D C B A D C C B A A A D
1. Representing various steps in a flow diagram is called as
(a) paint
(b) flow chart
(c) program
(d) diagram
2. A machine language program consists of instructions written in
(a) mnemonics
(b) 0’s and 1’s
(c) english like words
(d) keywords
3. The only allowed special character in a variable name is
(a) (under scrore)
(b) :
(c) ,
(d) ;
4. When a variable of data type double is converted into float
(a) truncation takes place
(b) rounding takes place
(c) the higher order bits are dropped
(d) the lower order bits are dropped
5. If you declare array without the keyword static the elements will be set to
(a) garbage value
(b) zero
(c) null value
(d) ones
6. Integer division results in
(a) truncation
(b) overflow
(c) underflow
(d) rounding
7. What is output of following Program?
main( )
{int x=10,y=5,p,q ;
p= x> 9 ;
q= x > 3 && y != 3 ;
printf( “p=%d q=%d ” ,p,q) ;
}
(a) p = 1 q = 1
(b) p =0 q = 0
(c) p = 0 q = 1
(d) p = 1 q= 0
8. The effect of shifting a variable to the left by one bit position is
(a) add it by 2
(b) multiply it by 2
(c) divide it by 2
(d) subtract it by 2
9. The expression, a = 30*1000+2768 evaluates to
(a) 32768
(b) 302768
(c) 13040
(d) -32768
10. Which of the following statements is used to print value of the third element of an integer array called totals
(a) printf (“ % d\n ”, & totals[3] );
(b) printf (“% c\n”, totals[2] );
(c) printf (“% d\n”, totals[3] );
(d) printf (“% d\n”, totals[2] );
11. The switch statement is used to
(a) switch from one variable to other
(b) switch between functions in a program
(c) manipulate switching variables
(d) choose from multiple possibilities
12. Break statement in a loop is used for
(a) de-allocating memory
(b) terminating the program
(c) terminating the loop
(d) terminating the function
13. Data type array-name[size];in the above statement “ size” should be of data type
(a) char
(b) float
(c) int
(d) double
14. An example application for a two dimensional array is
(a) two integer variable
(b) an array with 2 elements
(c) an array with 10 elements
(d) a matrix
15. The input function scanf() can be used with the following format specification to read a string
(a) %c
(b) %f
(c) %d
(d) %s
16. A function can be called in a program
(a) Only three times
(b) Only two times
(c) Any number of times
(d) Only once
17. Consider the program
main()
{int a = 4;
change(a);
printf(“%d”, a);
}change(a){ int a;
printf (“%d” ,++ a);
}The output is
(a) 5 4
(b) 4 4
(c) 4 5
(d) 5 5
18. The string handling function strcmp( ) returns if strings are the same
(a) 1
(b) 0
(c) WRONG
(d) TRUE
19. The register class cannot used for all types of variables. This is because
(a) register variables cannot support arithmetic operations
(b) register variables usage decreases the system performance
(c) number of bits in the register are less than the size of same variable types
(d) register variable precision in less
20. The header file that must be included at the beginning of a C program to use a library function cos is
(a) conio.h
(b) dos.h
(c) stdlib.h
(d) math.h
B B A B A A A B A D D C C D D C A B C D
1. Pseudo code is
(a) language independent code
(b) refined version of program
(c) outcome of compilation process
(d) code developed using the syntax of a specific language
2. In C, comments are placed between
(a) *...... /*
(b) /*......*/
(c) *.....*
(d) //
3. Which of the following is a valid numeric constant
(a) 65432
(b) 20,000
(c) $1000
(d) 15 750
4. The size of operator returns the size of an operand
(a) in float
(b) in bits
(c) in words
(d) in bytes
5. Which of the following is the assignment operator in C
(a) : =
(b) = =
(c) =
(d) !=
6. Which of the following statements will subtract a value of 2 from the variable ‘i’?
(a) i= -2;
(b) i–;
(c) i+=-2;
(d) i- = 2;
7. Which is used in ‘C’ to indicate logical AND
(a) ^
(b) and
(c) &&
(d) &
8. Which of the following comments about the ++ operator is not correct
(a) It can be applied to an expression
(b) The operand can come after the operater
(c) The operand can come before the operator
(d) It is unary operator
9. What is the output of the following statement
int x,y =2,z,a;
x=(y*=2)+(z=a=y);
printf(“%d”,x);
(a) 7
(b) is syntactically wrong
(c) 8
(d) 6
10. Which of the following statements would read a single character from the keyboard and place the result in a character
variable ‘ch’ defined as: char ch;
(a) getkeyb ( ch );
(b) while(!kbhit)
(c) ch = getch( );
(d) printf( “%c”, ch );
11. The keyword ‘else” can be used with
(a) for statement
(b) if statement
(c) do.. while ( ) statement
(d) switch ( ) statement
12. Which of the following statements is false
(a) The expression in the condition part of a for statement can be empty
(b) The initialization part of a for statement cannot have more than one initialization
(c) The body of do-while statement can be empty
(d) The initialization and increment parts of a for statement can be empty
13. Choose the incorrect statements.
(a) The array elements need not be of the same storage class
(b) The number of subscripts determines the dimension of the array
(c) All the elements of the array should be of the same data type and storage class
(d) In an array definition, the subscript can be any expression yielding a non-zero integer value
14. An example application for a two dimensional array is
(a) a matrix
(b) an array with 10 elements
(c) an array with 2 elements
(d) two integer variable
15. main()
{char name[5];
scanf(“%s”,name);
printf(“%s”, name);
}if Program is the given as input, what will be the o/p of the program;
(a) Progr
(b) Runtime error
(c) Prog
(d) program
16. void funct (void)
The above function declaration indicates
(a) it returns a value and had arguments
(b) it returns nothing and had arguments
(c) it returns a value and no arguments
(d) it returns nothing and no arguments
17. How many instance auto variable (f) are created in the execution of the following program. if m = 5.
fact(m)
{int f = 1;
if (m = = 1) return(1);
else
f = m * fact (m-1);
return(f);}
(a) 4
(b) 5
(c) 6
(d) 1
18. Give the output for the following:
# include
main( )
{char arr[10];
int ctr =0;
printf(“Enter a Sting:”);.
gets(arr);
while(arr[ctr]!=\‘0’)
{ctr + + ;
}printf(“%d”,ctr);
}
(a) length of the string only when it is less than 9 characters length
(b) length of the string only when its length is 10 characters
(c) String length
(d) String
19. Give the output of the following program
main()
{int a=10,b=20;
swap(a,b);
printf(“\na=%d b=%d”,a,b);
}swap(int x,int y)
{int t;

t=x;
x=y;
y=t;
printf(“\nx=%d y=%d”,x,y);
}
(a) x=20 y=10
a=10 b=20
(b) x = 20, y = 10
a = 20 b = 10
(c) x=10 y=20
a=20 b=10
(d) x=10 y=10
a=20 b=20
20. The header file that must be included at the beginning of a C program to use a library function cos is
(a) conio.h
(b) stdlib.h
(c) dos.h
(d) math.h

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

0 comments:

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