c and data structures online bits

1. What symbol is used to represent the connector
(a) circle
(b) rectangle
(c) rectangle with rounded end
(d) parellogram
2. Every C Program Statement must be terminated with a
(a) .
(b) !
(c) ;
(d) #
3. The individual units of a C program is known as
(a) units
(b) tokens
(c) records
(d) program
4. Identify the wrong datatype declaration
(a) unsigned long int a,b;
(b) long float f1;
(c) signed a;
(d) long double ld;
5. Array elements are stored in
(a) Random memory location
(b) Sequential memory locations
(c) Scattered memory locations
(d) Direct memory locations
6. If a is an integer variable, a=5/2; will assign a value
(a) 2
(b) 2.5
(c) 3
(d) 2.0
7. How many logical operators C provides?
(a) 2
(b) 3
(c) 4
(d) 1
8. Which of the following comments about the ++ operator is not correct
(a) It is unary operator
(b) The operand can come after the operater
(c) It can be applied to an expression
(d) The operand can come before the operator
9. Compute the result of the following expression in ‘C’. A=3*4/5+10/5+8-1+7/8
(a) 11
(b) 12
(c) 10
(d) 9
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. The case statement in switch ( ) is separated by
(a) exit
(b) break
(c) continue
(d) goto
12. Which of the following statements is false
(a) The initialization part of a for statement cannot have more than one initialization
(b) The body of do-while statement can be empty
(c) The initialization and increment parts of a for statement can be empty
(d) The expression in the condition part of a for statement can be empty
13. If the size of an integer array is ‘n’, the number of elements that can be stored in it is
(a) n-1
(b) n-2
(c) n+1
(d) n
14. Two dimensional array elements are stored
(a) system dependent
(b) in row major order
(c) complier dependent
(d) in column major order
15. What is the input function for reading a strings
(a) getche()
(b) getchar()
(c) gets()
(d) getch()
16. Actual and formal parameters must agree in
(a) names and data type
(b) number of argument and datatypes
(c) names and number of arguments
(d) data types
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 80
(b) 40 80
(c) 40 80
(d) 80 40
18. What will be the output of the following program
void main ()
{char txt[ ]
=

12345\0
abcdef”;
printf (“%s”, txt);
}
(a) 12345
(b) abcdef
(c) 12345 \ 0abcdef
(d) 12345 abcdef
19. The address operator cannot be applied to variable
(a) static
(b) auto
(c) global
(d) register
20. The header file that must be included at the beginning of a C program to use a library function cos is
(a) dos.h
(b) conio.h
(c) math.h
(d) stdlib.h
A C B C B A B C A B B A D C C B D A D C
1. What is the appropriate order of refinement in a problem solving.
(a) flow chart, pseudo code program
(b) program, flow chart, pseudo code
(c) pseudo code, flowchart, program
(d) flow chart, program, pseudo code
2. A machine language program consists of instructions written in
(a) mnemonics
(b) english like words
(c) 0’s and 1’s
(d) keywords
3. Among the following which is not a C token
(a) strings
(b) constants
(c) identifiers
(d) comment
4. Which of the following datatypes require maximum storage.
(a) double
(b) unsigned int
(c) unsigned long double
(d) long int
5. How many variables of the same type can be initialized at a time with the same value
(a) any number of variables
(b) Two
(c) Three
(d) One
6. The operator ++ is called as operator
(a) special increment
(b) increment
(c) double addition
(d) decrement
7. Identify the logical operator from the following:
(a) !
(b) = =
(c) !=
(d) _
8. Which of the following is unary operator
(a) +
(b) ^
(c) &
(d) _
9. Which operator has the lowest priority?
(a) conditional
(b) comma
(c) bit-wise operator
(d) Assignment
10. What format is used to print a character with the printf function
(a) %d
(b) %c
(c) %s
(d) %char
11. Identify the wrong statement:
(a) if (a(b) if (a(c) if (a >b) {; ; }
(d) if a12. Do-while loop is also called as
(a) prefix tested
(b) post tested
(c) infix tested
(d) pre-tested
13. All the elements in the array must be
(a) initialized
(b) initialized and defined
(c) defined
(d) neither initialized nor defined
14. Under which of the following conditions,the size of the array need not be specified?
(a) when the compiler is smart
(b) when it is a formal parameter
(c) when initialization is a part of definition
(d) when it is a declaration
15. The following function is used to count and return the number of characters in a given string
(a) strcat()
(b) strrev()
(c) strcmp()
(d) strlen()
16. void funct (void)
The above function declaration indicates
(a) it returns nothing and no arguments
(b) it returns nothing and had arguments
(c) it returns a value and had arguments
(d) it returns a value and no arguments
17. Which of the following statements is false about call by reference
(a) a copy of actual parameters is created
(b) Effects the actual parameters
(c) the formal parameters are pointer variables
(d) Actual Parameters are address
18. What is the use of strcpy( ) function
(a) string concatenation
(b) copies one string into another
(c) finds the length of the string
(d) string comparison
19. Register variables can hold ———– values
(a) float
(b) complex
(c) double
(d) int
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
A C D C A B A D B B D B C C D A A B D B
1. The symbol with rounded ends is used to represent
(a) input/output
(b) equation processing
(c) decision making
(d) start/ stop
2. A machine language program consists of instructions written in
(a) english like words
(b) 0’s and 1’s
(c) keywords
(d) mnemonics
3. The only allowed special character in a variable name is
(a) ;
(b) (under scrore)
(c) ,
(d) :
4. The keyword is used to define enumerated data type
(a) typedef
(b) struct
(c) array
(d) enum
5. Which of the following is not a correct representation of the real constant in C
(a) 15 E +3
(b) 15 e 0.3
(c) 1.5 e 4
(d) 150 E +2
6. Output of printf(“%f”,3/4) is———
(a) 0.00
(b) gives an error
(c) 0
(d) 0.75
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. M = 5, Y = M++, After executing these statements the value of M and Y are
(a) M=6, Y=6
(b) M=6, y = 7
(c) M=5, Y=6
(d) M=6, Y=5
9. Which of the following arithmetic expression is invalid
(a) 7.5 % 3
(b) -9%3
(c) 9% -3
(d) 2 + 3/5
10. What is the output of the following program
Main( )
{ float a;
int x = 6; y = 4;
a = x/y;
print (“%f”,a)
}
(a) 1.00
(b) error
(c) 2.0
(d) 1.5
11. If statement is a —————statement
(a) multiway decision
(b) loop construct
(c) one-way decision
(d) two way decision
12. Which of the following statement causes an immediate exit from the inner most loop structure.
(a) stop
(b) exit
(c) kill
(d) break
13. Array elements are stored in
(a) indirect memory locations
(b) scattered memory locations
(c) sequential memory locations
(d) direct memory locations
14. If we don’t initialize a static array, what will be the elements set to:
(a) character constant
(b) 0
(c) a floating point number
(d) an undetermined value
15. putchar() and getchar() are both
(a) assignment statements
(b) input and output statements
(c) type declaration statements
(d) control statement
16. main() is
(a) user defined function
(b) member function
(c) library function
(d) friendly function
17. Which of the following statements is false about call by reference
(a) Actual Parameters are address
(b) Effects the actual parameters
(c) the formal parameters are pointer variables
(d) a copy of actual parameters is created
18. What will be the output of the following program?
void main()
{char x[ ]
=
{‘s’, ‘
a’, NULL };
printf (“\n %d”, sizeof (x));
}
(a) 1
(b) 2
(c) 0
(d) 3
19. If storage class is missing in the array definition , by default it will take to be
(a) either automatic or external depending on the place of occurrence
(b) external
(c) automatic
(d) static
20. The header file that must be included at the beginning of a C program to use a library function cos is
(a) dos.h
(b) stdlib.h
(c) conio.h
(d) math.h
D B B D B A D D A A D D C B B A D D A D
1. The symbol for decision making statement is
(a) rectangle
(b) circle
(c) none
(d) diamond
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. Which of the following is not a key word of C?
(a) sizeof
(b) const
(c) main
(d) void
4. Which of the following is a scalar data type used in ‘C’
(a) structure
(b) union
(c) double
(d) array
5. A character constant is assigned within
(a) single quotes
(b) double quotes
(c) no quotes
(d) paranthers
6. Associativity of arithmetic operators is from
(a) right to left
(b) middle to left
(c) left to right
(d) middle to right
7. Among the following operators, whose associatively is right to left
(a) logical operators
(b) arithmetic operators
(c) conditional expression
(d) bitwise operators
8. The symbol for exclusive OR operator is:
(a) _
(b) ^
(c) &
(d) |
9. x = 9 - ((12 / 3 ) + 3 * 2 ) - 1 what is the value of x.
(a) 2
(b) 10
(c) -2
(d) 8
10. Which of following is valid syntax for printf
(a) printf (1%’,a);
(b) printf(“%d,%d”,a,b);
(c) printf(“WELCOME)
(d) printf(“%d” a);
11. Identify the wrong statement:
(a) if a(b) if (a >b) {; ; }
(c) if (a(d) if (a12. Give the output of the following program:
#include < stdio.h >
main()
{int I=1;
while (I < 5)
{printf(“%d”, I);
}}
/* End of Main */
(a) Infinite loop
(b) Warning for no return type for main ( )
(c) Print the value of I as 1
(d) Prints the value of I as11111
13. Elements of a string are accessed by a number called as
(a) pointer
(b) coordinate
(c) index
(d) label
14. If we don’t initialize a static array, what will be the elements set to:
(a) 0
(b) an undetermined value
(c) character constant
(d) a floating point number
15. The statements that prints out the character set from A-Z is, where a is an integer variable
(a) for(a=‘a’; a<=‘z’, a++) printf(“%c”; a);
(b) for(a=‘A’; a<=‘z’, a++) printf(“%c”; a);
(c) for(a=‘A’; a<=‘z’, a++) printf(“%c”; a);
(d) for(a=’A’ a<=‘Z’, a++) printf(“%c”; a);
16. The values of actual arguments are assigned to the formal arguments on a basis
(a) many to one
(b) one to many
(c) one to one
(d) many to many
17. Recursive functions are
(a) takes less main storage
(b) executes faster than iterative functions
(c) critical parameters
(d) easy to code
18. To convert the string of upper case letters to lower case letters which of the following string functions is used
(a) tolower()
(b) strlwr()
(c) struprlow()
(d) tolwrcase()
19. The following Program
main()
{int i = 2;
{int i = 2,j=5;
printf(“%d %d ”,i,j);
}printf(“%d %d”,i,j);
}
(a) prints 2 5 2 5
(b) prints 4 5 2 5
(c) Will not compile successfully
(d) prints 5 2 5 2
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
D B C C A C C B C B A A C A D C D B C C
1. The error in a program is called
(a) bug
(b) flow
(c) virus
(d) vaccine
2. Which of the following operators is not used in c
(a) X
(b) >
(c) &
(d) >>
3. Which of the following is a valid numeric constant
(a) $1000
(b) 20,000
(c) 15 750
(d) 65432
4. The qualifier that may precede float is
(a) long
(b) signed
(c) unsigned
(d) Nothing to precede
5. How many variables of the same type can be initialized at a time with the same value
(a) One
(b) Three
(c) Two
(d) any number of variables
6. main( )
{ int a=5; float b=10,c;
c=b%a;
printf(“%f”,c);
}output is——————–
(a) 0.000000
(b) gives an error
(c) 0.00
(d) 2.0
7. The operator with lowest priority in the list && , + , | | , < is
(a) +
(b) <
(c) &&
(d) | |
8. main( )
{int m=7,y;
y=m++;
printf(“y=%dm=%d”,y,m);
y=–m;
printf(“y=%dm=%d”,y,m);
}output is———–
(a) y=7,m=8,y=7,m=7
(b) y=7,m=8,y=6,m=7
(c) y=7,m=7,y=6,m=6
(d) y=7,m=8,y=6,m=6
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) 6.6/a
(c) 2/n
(d) 2*a
10. for( i = 1;i !=5; i++)
{ printf(“%d”, i+2);} What is the output ?
(a) 3 5 7 9 11
(b) 3 4 5 6 7
(c) 3 4 5
(d) 1 2 3 4 5
11. Switch case construct is an alternative for
(a) Do-while loop
(b) While loop
(c) For loop
(d) If-else construct
12. The while loop is terminated when the conditional expression returns
(a) 3
(b) zero
(c) 2
(d) 1
13. The allowed data types for the index of an array
(a) Only char
(b) Only int
(c) Only float
(d) Only boolean
14. The elements of array a[5] are
(a) a[1] to a[5]
(b) a[1] to a[4]
(c) a[0] to a[5]
(d) a[0] to a[4]
15. A string in the ‘C’ language is represented by enclosing a sequence of characters in
(a) parenthesis
(b) double quotes
(c) flower brackets
(d) single quotes
16. main() is
(a) library function
(b) member function
(c) user defined function
(d) friendly function
17. Recursive functions are
(a) critical parameters
(b) executes faster than iterative functions
(c) takes less main storage
(d) easy to code
18. If the first string and the second string both are identical, then strcmp function returns
(a) a value of 0
(b) a value of 1
(c) any positive integer
(d) either 1 or 0
19. The following program
main()
{inc(); inc(); inc();
}inc()
{static int x;
pritnf(“%d”, ++x);
}
(a) Prints three consecutive unpredictable numbers
(b) Prints 1 2 3
(c) Prints 0 1 2
(d) Prints 1 1 1
20. #define PI 3.14 is a kind of .
(a) Pre compiler directive
(b) Preprocessor directive
(c) Compiler directive
(d) Processor directive
A A D D D B D A B B D B B D B C D A B B
1. Representing various steps in a flow diagram is called as
(a) flow chart
(b) paint
(c) diagram
(d) program
2. The function getchar( ) is used to read
(a) a word
(b) a character
(c) a string
(d) a boolean value
3. The individual units of a C program is known as
(a) tokens
(b) units
(c) records
(d) program
4. Which of the following is a scalar data type used in ‘C’
(a) union
(b) array
(c) double
(d) structure
5. How many variables of the same type can be initialized at a time with the same value
(a) any number of variables
(b) One
(c) Two
(d) Three
6. Associativity of arithmetic operators is from
(a) middle to left
(b) right to left
(c) left to right
(d) middle to right
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. M = 5, Y = M++, After executing these statements the value of M and Y are
(a) M=6, Y=5
(b) M=5, Y=6
(c) M=6, Y=6
(d) M=6, y = 7
9. Which of the following shows the correct hierarchy of arithmetic operations in C
(a) ( ), / or *, - or +
(b) ( ),&&,*or / + or -;
(c) ( ), &&, *,/,+,-
(d) ( ), &&, / , *, +, -
10. Consider the segment
If(1) printf(“yes”);
else printf(“no”);
what will be the output
(a) Error
(b) no
(c) yes
(d) Unpredictable
11. In switch (expression) statement, the expression should evaluate to
(a) a void
(b) an integer
(c) a character
(d) a float
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 = 9 y = 9
(d) x = 6 y = 6
13. The value within the [] brackets in an array declaration specifies
(a) subscript value
(b) address 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) three dimensional
(b) one dimensional
(c) two dimensional
(d) multidimensional
15. “A” is a , while ‘A’ is a
(a) Integer/character
(b) String/character
(c) Character/String
(d) String/float
16. Any program in C contains atleast
(a) zero functions
(b) two functions
(c) one function
(d) three functions
17. What is the output of
main()
{int x, change (int);
x = 20;
change (x);
printf (“%d”, x);
return 0;
}change (
int x);
{x = 10;
printf (“%d”. x);
}
(a) 10 30
(b) 10 20
(c) 20 20
(d) 10 10
18. The function is used to find the length of the string
(a) strrev()
(b) strrsa()
(c) strcat()
(d) strlen()
19. In the case of static storage class which of the following is false
(a) provide privacy to a set of functions
(b) Restrict the scope of an external identifier
(c) Initial values is garbage value
(d) Preserve the exact values of variable
20. Which of the following is the symbol for preprocessor
(a) <>
(b) #
(c) $
(d) *
A B A C A C B A A C B C D C B C B D C B

0 comments:

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