CDS online Bits

1. The process of removing a bug is known as
(a) running
(b) executing
(c) debugging
(d) compilation
2. In C, comments are placed between
(a) *.....*
(b) //
(c) /*......*/
(d) *...... /*
3. Which of the following is a valid numeric constant
(a) 20,000
(b) 15 750
(c) $1000
(d) 65432
4. To convert a value of one data type to another data type in an expression which of the following is used
(a) user defined types
(b) type define
(c) automactic conversion
(d) casting
5. Which of the following statements is wrong
(a) mes = 123.56
(b) 3+a=b;
(c) con = ‘T’ * ‘A’ ;
(d) This = ‘T’ * 20 ;
6. Which of the following is shorthand operator for a=a%b
(a) a%=b
(b) a =%b
(c) a % b
(d) a%b=a
7. How many logical operators C provides?
(a) 2
(b) 3
(c) 1
(d) 4
8. The effect of shifting a variable to the left by one bit position is
(a) subtract it by 2
(b) multiply it by 2
(c) add it by 2
(d) divide it by 2
9. The expression, a = 30*1000+2768 evaluates to
(a) -32768
(b) 13040
(c) 302768
(d) 32768
10. Consider scanf(“%2d”, &n); and the input data is 3142 then n will be assigned
(a) 31
(b) 31.42
(c) 42
(d) error
11. main( )
{int a,b,c;
a=10,b=0;
if( b!=0);
c=a/b;
}What is the value of c executing the above sequence ?
(a) Undefined value
(b) Syntax error
(c) Compile time error
(d) Run time error divide by zero
12. Identify the unconditional control structure:
(a) switch-case
(b) goto
(c) if
(d) do-while
13. Array elements are stored in
(a) either in row major or column major order
(b) row major order
(c) column major order
(d) in diagonal order
14. # define six 2*3 main() { int x=12/six; print (“%d”,x); }
(a) 18
(b) 8
(c) 2
(d) 12
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) Prog
(c) Runtime error
(d) program
16. Preprocessing is typically done in
(a) after loading
(b) either before or at the beginning of compilation
(c) at the time of execution
(d) after compilation but before execution
17. What is the output of the following program?
main()
{int x , y;
x = 10; y = 100;
change (x,y)
printf (“%d, %d”, x,y);
}change (
int x, int y);
{int k;
k = a; a = b; b = k;
}
(a) 100, 100
(b) 10, 10
(c) 10, 100
(d) 100, 10
18. To find the second string in the first string which of the following string handling functions is used.
(a) str in str()
(b) str substr()
(c) str lwr()
(d) strstr()
19. The register class cannot used for all types of variables. This is because
(a) register variables usage decreases the system performance
(b) register variable precision in less
(c) register variables cannot support arithmetic operations
(d) number of bits in the register are less than the size of same variable types
20. The function sqrt() is part of header file.
(a) iostream.h
(b) conio.h
(c) stdio.h
(d) math.h
C C D D B A B B D A D B A A B B C D D D
1. The symbol with rounded ends is used to represent
(a) input/output
(b) decision making
(c) start/ stop
(d) equation processing
2. Every C Program Statement must be terminated with a
(a) ;
(b) !
(c) #
(d) .
3. What are the smallest individual units in a program
(a) record
(b) Structures
(c) Functions
(d) Tokens
4. The size of all the below datatypes is identical except the one. Identify the odd one
(a) double
(b) long
(c) unsigned long
(d) float
5. Which of the following statements is wrong
(a) This = ‘T’ * 20 ;
(b) 3+a=b;
(c) mes = 123.56
(d) con = ‘T’ * ‘A’ ;
6. Number of binary arithmetic operators in C is:
(a) 5
(b) 6
(c) 4
(d) 7
7. What is the result of 5 &&2 ?
(a) 0
(b) 2
(c) 1
(d) 5
8. In the following, which is bitwise operator?
(a) <
(b) |
(c) *
(d) >
9. In the expression b=6.6/a+(2*a+(3*c)/a*d)/(2/n); which operation will be performed first?
(a) 6.6/a
(b) 2*a
(c) 2/n
(d) 3*c
10. The output of the following program is
main( )
{int i=2;
printf(“%d %d %d”,i++,i,++i);
}
(a) 2 3 3
(b) 2 3 4
(c) 2 2 4
(d) 3 3 3
11. In switch (expression) statement, the expression should evaluate to
(a) a void
(b) a float
(c) an integer
(d) a character
12. count=0;
for ( I=0;I<=10; I++)
{if(I%2==0)
count++;
}printf(“%d”, count);
Pick out the correct value for count.
(a) 3
(b) 5
(c) 6
(d) 4
13. What will happen if you try to put so many values into an array during the initalization such that its size is
exceeded.
(a) Error message from the compiler
(b) Nothing
(c) Last element data may be overwritten
(d) Possible system malfunction
14. Two dimensional array elements are stored
(a) in column major order
(b) system dependent
(c) in row major order
(d) complier dependent
15. A string with spaces can be read using a function.
(a) getchar()
(b) gets()
(c) getsentences()
(d) getch()
16. The statement used to send back any value to the calling function is
(a) return
(b) break
(c) continue
(d) exit
17. When both called function and calling function are same, then the process is said to be
(a) recursion
(b) modularity
(c) synchronization
(d) Concurrency
18. What is wrong with the following program
main() { char m1[9]= “message1”; char m2[9]=“message2”; m2=m1;
printf(“msg is %s”,m2); }
(a) array cannot be initialized as above
(b) program compiles without error, but prints an unpredictable value
(c) array is not a left value and so cannot be assigned to
(d) char array cannot be printed directly using printf
19. What is the output of the following program
main()
{static int y;
printf (“%d\n”, y);
}
(a) compilation error
(b) 0
(c) undefined
(d) run-time error
20. Which of these complier directives access to the print function
(a) include stdio.h;
(b) #define print
(c) #include conio.h;
(d) #include
C A D A B A C B A D C C A D B A A C B D
1. The process of removing a bug is known as
(a) compilation
(b) executing
(c) running
(d) debugging
2. Every executable C program must contain a
(a) scanf function
(b) scanf, printf and main functions
(c) printf function
(d) main function
3. Predefined identifiers are called
(a) variables
(b) reserved words
(c) functions
(d) constants
4. What is the range of unsigned char data type
(a) 0 to 512
(b) 0 to 255
(c) -32, 768 to 32,767
(d) -128 to 127
5. Which of the following would you use to declare a character array called str large enough to fit the word HELLO
(a) string str;
(b) char str[6]
(c) char str[3]
(d) char str[5]
6. Addition of two numbers is performed using
(a) arithmetic operators
(b) conditional operators
(c) logical operators
(d) relational operators
7. When && operator is used with two conditions, conditions need to be satisfied for the expression to
be true.
(a) any one
(b) both
(c) neither
(d) only first
8. What is the value of !0?
(a) 0
(b) -1
(c) 00
(d) 1
9. In the expression b=6.6/a+(2*a+(3*c)/a*d)/(2/n); which operation will be performed first?
(a) 6.6/a
(b) 3*c
(c) 2*a
(d) 2/n
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) strcpy( str, “Hello” );
(c) str = “Hello”;
(d) printf( str, “Hello” );
11. In switch (expression) statement, the expression should evaluate to
(a) an integer
(b) a character
(c) a float
(d) a void
12. What will be the final values of x and y?
# include
void main()
{int x = 1, y = 1;
do while (x<=8)
{x + +; y ++;
} while (y<=5);
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. The value within the [] brackets in an array declaration specifies
(a) address value
(b) subscript value
(c) value of the array element
(d) size of an array
14. An array which contains two subscripts, to represent each element is called as
(a) multidimensional
(b) two dimensional
(c) three dimensional
(d) one dimensional
15. What is the control string for representing string
(a) %s
(b) %d
(c) %f
(d) %c
16. main() is
(a) member function
(b) friendly function
(c) library function
(d) user defined function
17. Recursive functions are executed in
(a) parallel fashion
(b) first in first out order
(c) distributed fashion
(d) last in first out order
18. What is the type that strlen() funtion will return
(a) int
(b) char
(c) float
(d) long int
19. Which of the following statement is wrong with respect to a storage class
(a) it specifies the defualt initial value
(b) it specifies the life of a variable
(c) by defualt a storage class is static
(d) if specifies where variable is stored
20. #define PI 3.14 is a kind of .
(a) Compiler directive
(b) Pre compiler directive
(c) Preprocessor directive
(d) Processor directive
D D B B B A B D A B A D D B A D D A C C
1. What symbol is used to represent the connector
(a) circle
(b) parellogram
(c) rectangle
(d) rectangle with rounded end
2. The constant ‘\00 is called as
(a) nill
(b) zero
(c) null
(d) full
3. Which of the following is an incorrect variable name.
(a) name
(b) string
(c) age
(d) else
4. Which of the following is an empty data type.
(a) Integer
(b) void
(c) character
(d) float
5. Which of the following statement is syntactically wrong
(a) double p=3.142,x;
(b) int m;count;
(c) int x;
(d) double p,x;
6. Which of the following statements will subtract a value of 2 from the variable ‘i’?
(a) i+=-2;
(b) i- = 2;
(c) i–;
(d) i= -2;
7. What is the result of 5 &&2 ?
(a) 2
(b) 1
(c) 5
(d) 0
8. Which of the following comments about the ++ operator is not correct
(a) The operand can come before the operator
(b) It can be applied to an expression
(c) It is unary operator
(d) The operand can come after the operater
9. Compute the result of the following expression in ‘C’. A=3*4/5+10/5+8-1+7/8
(a) 10
(b) 11
(c) 9
(d) 12
10. The statement printf(“%d”,7);
(a) results in syntax error
(b) prints 0
(c) prints the value 7
(d) runtime error
11. Identify the wrong statement:
(a) if a(b) if (a(c) if (a(d) if (a >b) {; ; }
12. Which of the following is not correct
(a) while loop is executed only if the condition is true
(b) do . while loop is executed at least once
(c) while loop is executed atleast once
(d) dowhile loop is ececuted only if the condition is true
13. The number of elements in array declaration
(a) assume default size as ‘0’
(b) does not require to be specified
(c) dynamically identifies based on largest index used in program
(d) requires to be specified
14. The following program
main( )
{static int a[ ] = { 7, 8, 9 };
printf(“%d”, a[2] = 2[a] + a[2]);
}
(a) will compile successfully
(b) runtime error
(c) result is buss error
(d) results in segmentation violation error
15. Find the output of the following program
main()
{ char name1 [4] = ‘R’, ‘A’, ‘V’, ‘I’;
char name2 [5] = ‘R’,‘A’,‘V’,‘I’;
printf (“%s”, name1);
printf (“%s”, name 2);
}
(a) RAVI
garbage value
(b) RAVI RAVI
(c) Garbage value
RAVI
(d) RAVI garbage value
RAVI
16. Which of the following statement is wrong with respect to functions
(a) function will provide reusability of the code
(b) A function will always return some value
(c) It facilitates the top-down modular programming
(d) Reduces the length of a program
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) 25
(c) 36
(d) 1 4 9 16 25
18. What will be the output of the following program
#include
main()
{int x;
x=‘d‘ *5 + 20;
printf(“%d”,x);
}
(a) 520
(b) runtime error
(c) compile time error
(d) 20
19. Which of the following is wrong for a register variable
(a) defualt initial value is 0
(b) Very few variables can be declared using register
(c) Variables are stored in processor registers
(d) Execution is fast
20. #include is a directive
(a) pre-compiler
(b) pre-processor
(c) processor
(d) complier
A C D B B B B B B C A C D A D B D A A B

0 comments:

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