Sei sulla pagina 1di 16

1) The address of a variable temp of type float is (A) *temp (B) &temp (C) float& temp (D) float

temp& Ans: B 2) If an array is declared as int a[4] = {3, 0, 1, 2}, then values assigned to a[0] & a[4] will be ________ (A) 3, 2 (B) 0, 2 (C) 3, 0 (D) 0, 4 Ans: C 3) What type of errors are checked during compilation (A) logical errors (B) divide by zero error (C) run - time errors (D) syntax errors Ans: D 4) The minimum number of temporary variable needed to swap the contents of two variable is (A)3 (B)1 (C) 0 (D) 2 Ans:C 5) What is range of char data value? (A) -64 to 64 (B) -128 to 127 (C) 0 to 255 (D) -127 to 128 Ans:B 6) The process of repeating a group of statements in an algorithm is known as (A) sequence (B) iteration (C) flow (D) selection Ans:B 7) Every executable C program must contain a (A) printf function (B) scanf, printf and main functions (C) main function (D) scanf function Ans:C 8) The individual units of a C program is known as (A) records (B) tokens (C) units (D) program

Ans:B 9) Pseudo code is (A) language independent code (B) refined version of program (C) code developed using the syntax of a specific language (D) outcome of compilation process Ans:A 10) A block is enclosed with pair of (A) ( ) (B) { } (C) <> (D) [ ] Ans:B 11) The purpose of main function is (A) to stop program execution (B) to stop algorithm (C) to start algorithm (D) to start program execution Ans:D 12) How many values a function can return at a time (A) only one (B) depends on the system (C) infinite values (D) 2 Ans:A 13) The purpose of return statement is (A) To return control back to the calling function (B) To return control and value to calling function (C) To return void (D) To return value to the calling function Ans:B 14) If the value of the formal argument is changed in the called function, the corresponding change in the calling function, if it is call by value (A) machine dependen (B) does not reflects (C) unpredictable (D) reflects Ans:B 15) When compared to call by value, the call by reference is_________in execution (A) fast (B) neither slow nor fast

(C) slow (D) equal Ans:A 16) The statement used to send back any value to the calling function is (A) continue (B) exit (C) break (D) return Ans:D 17 The index or subscript value for an array of size n ranges from (A) 1 to n-1 (B) 0 to n-1 (C) 1 to n (D) 0 to n Ans:B 18) If we dont initialize a static array, what will be the elements set to: (A) 0 (B) a floating point number (C) an undetermined value (D) character constant Ans:A 19) A string is an array of (A) integers (B) floating point numbers (C) characters (D) boolen values Ans:C 20) Two dimensional array elements are stored (A) system dependent (B) in row major order (C) compiler dependent (D) in column major order Ans:C 21) Array elements are stored in (A) Sequential memory locations (B) Scattered memory locations (C) Direct memory locations (D) Random memory location Ans:A 22) Identify the incorrect declaration of arrays from the following (A) int a[50]; (B) float values[10][20]; (C) double a[50]; (D) int score[10,15];

Ans:D 23) Array is used to represent the following (A) A list of data items of different data type (B) A list of data items of real data type (C) A list of data items of same data type (D) A list of data items of integer data type Ans:C 24) Arrays are passed as arguments to a function by (A) reference (B) both value and reference (C) context (D) value Ans:A 25) In a multidimensional array with initialization (A) no demension must be omitted (B) the left most dimension may be omitted (C) both leftmost and right most may be omitted (D) the right most dimension may be omitted Ans:B 26) Which of the following is not a storage class (A) external (B) automatic (C) register (D) define Ans:D 27) 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 Ans:C 28) The storage area for register variables (A) cache (B) memory (C) processor registers (D) virtual memory Ans:C

29) Register variable are active (A) outside the function (B) throughout the program (C) only in the function where it is defined (D) surrounding of that function Ans:C 30) A static variable is one (A) which cant be initialized (B) which is same as automatic variable but it is placed at the head of the program (C) which is initialized once and cant be changed at run time (D) which retains its value through out the life of the program Ans:D 31) An external variable definition can appear in (A) only two files (B) only three files (C) only one file (D) more than one file Ans:C 32) 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 Ans:D 33) Automatic variable are active (A) outside the function (B) only in the function where it is defined (C) surroundings of that function (D) throughout the program Ans:B 34) 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 Ans:B

35) Register variables can hold ________ values (A) float (B) int (C) complex (D) double Ans:B 36) A string is an array of (A) integers (B) floating point numbers (C) characters (D) boolen values Ans:C 37) 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() Ans:D 38) The function is used to reverse a string (A) strrsa() (B) strrev() (C) strcmp() (D) strcat() Ans:B 39) The function strrev( )________ the actual string in the array (A) will not reverse (B) may not reverse (C) will reverse (D) may reverse Ans:C 40) What is the use of strcmp( ) function (A) finds the length of the string (B) string comparison (C) copies one string into another (D) string concatenation Ans:B 41) If the first string and the second string both are identical, then strcmp function returns (A) a value of 0 (B) either 1 or 0 (C) a value of 1 (D) any positive integer Ans:A 42) What function is appropriate for accepting a string? (A) getch ( ) (B) gets( )

(C) getche ( ) (D) scanf ( ) Ans:B 43) What is the use of the strlen( ) function (A) finds the length of the string (B) string comparison (C) string concatenation (D) copies one string into another Ans:A 44) function used to open a file is (A) feof( ) (B) f.open( ) (C) openf( ) (D) fopen( ) Ans:D 45) end of file is detected by (A) fend( ) (B) endf( ) (C) EOF (D) FEND Ans:C 46)Which of the following is not a storage class? a)register b)auto c)protected d)extern Ans:C 47)How to compare two strings without comparing its case? a)strcpy() b)strcpmi() c)strrev() d)strcmpi() Ans:D 48)Which of the following short hand assignment operator is the correct? a)x+=1 b)y=-1 c)y=y+1 d)x=x*x Ans:A 49)Function of the getchar() a)returns a character b)reads a character c)copies the character d)returns integer Ans:B

50)Wich one of the following terminates the program? a)break b)exit c)goto d)continue Ans:B 51)Output the following code: char a[10]; a=a; printf(%d,a);

a)65 b)%d c)97 d)a Ans:C 52)Storage area of register storage class is a)stack b)cpu register c)primary memory d)CD-rom Ans:B 53)Which one of the follwing symbol is used to implement the concept of pointers in structure? a)+(addition) b)->(arrow) c)&(ampersand) d) . (Membership) Ans:B 54)Another name for pointer operator is a)deferencing operator b)multiplicative operator c)direction operator d)concatenation operator Ans:A 55)Function of ftell() is a) Writes a character to a file b) Reads an integer from a file c) current position in the file d) Sets the position to a desired point in the file. Ans:C

56) Which symbol is used to make comments ? a. // b. # c. !! Ans a 57) How would you insert pre-written code into a current program ? a) #read b) #get c) #include d) #pre Ans: C 58) Which symbols represent a block of code ? a) { ... code here } b) ( ... code here ) c) [ ... code here ] d) < ... code here > Answer is : B 59) In which standard library file is the function printf() located ? a) stdlib.h b) stdio.h c) stdout.h d) stdoutput.h Answer is :B 60) In order to properly use a variable... a) The variable must have a valid type. b) The variable name can not be a keyword (part of the C syntax). c) The variable name must begin with a letter. d) All of the above. Answer is :D 61) Which mathematical operators are in the correct order ? a) Addition, Division, Modulus b) Division, Multiplication, Modulus c) Modulus, Multiplication, Subtraction d) Modulus, Addition, Division Answer is :C

62) Which of the following are NOT relational operators ? a) > b) <>Answer is :C 63) The first expression in a for loop is ?a) The test expression. b) The step value of the loop. c) The value of our counter variable. d) None of the above. Answer is : C 64) What is the break statement used for ?a) To quit the program. b) To quit the current iteration. c) To stop the current iteration and begin the next iteration. d) None of the above. Answer is :B 65)What is the continue statement used for ? a) To continue to the next line of code. b) To stop the current iteration and begin the next iteration from the beginning. c) As an alternative to the else statement. d) None of the above. Answer is :B

66) A function prototypes are useful a) Because they tell the compiler that a function is declared later. b) Because they make the program more readable.. c) Because they allow the programmer to see a quick list of functions in the program along with the arguments for each function. d) All of the above. Answer is :D 67) Because of variable scope a) Variables created in a function cannot be used another function.

b) Variables created in a function can be used in another function. c) Variables created in a function can only be used in the main function d) None of the above. Answer is :A 68) Which symbol is used to declare a pointer ? a) & b) @ c) *d) $ Answer is :C 69) Which symbol is used to reference a pointer ? a) * b) & c) @ d) $ Answer is :B 70) Adding to a pointer that points to an array will a) Cause an error. b) Increase the value of the element that the pointer is pointing to. c) Cause the pointer to point to the next element in the array. d) None of the above. Answer is :C 71) To access the members of a structure, which symbol is used ? a) * b) c) , d) . Answer is : D

72) A member is a a) Variable in a structure. b) Structure's datatype. c) Pointer to a structure. d) None of the above. Answer is :A 73) Structures can... a) Hold many variables of different types. b) Have pointers to structures. c) Be assigned to one another, given they are the same type. d) All of the above. Answer is :D 74) In a C program, the first statement that will be executed is: a) The first executable statement of the program. b) The first executable statement of the main() function. c) The first executable statement after the comment /*start here*/ d) The first executable statement of the end function. Answer is :B 75) The statement: int *jack a) Declares that all variables ending with jack are ints. b) Is a pointer declaration. jack is a pointer to an int variable. c) Declares that jack is the address of a variable and that the address is an int. d) Declares that all variables starting with jack are ints. Answer is :B
76) Which of the following is the correct way of declaring a float pointer: 1) float ptr; 2) float *ptr; 3) *float ptr; 4) None of the above Ans:float *ptr;

77) What is the result of 16>>2? 1) 4 2) 8 3) 3 4) 0 Ans:1) 4 78) What is the output of C statement 7.5 % 3 ? a. 1.5 b. 1 c. No output d. Error Answer = D 79) Which of the following statement is used to take the control to the beginning of the loop ? a. exit b. break c. continue d. None of these Answer = C

80) What will be the output of following program ? #include<stdio.h> int main( ) { int x=4; while(x==1) { x=x-1; printf("%d",x); x--; } } a. 4 b. 1,2,3,4

c. Prints Nothing d. None of above Answer :C 81) Which of the following is/are storage class A. Automatic B. Static C. Allocated D. All of Above Ans:C 82) Which of the following is not a valid variable name declaration? a) int _a3; b) int a_3; c) int 3_a; d) int _3a

Answer:c

83) All keywords in C are in a) LowerCase letters b) UpperCase letters c) CamelCase letters d) None

Answer:a

84) Variable name resolving (number of significant characters for uniqueness of variable) depends on a) Compiler and linker implementations b) Assemblers and loaders implementations c) C language d) None
Answer:a

85) Which of the following is not a valid C variable name? a) int number; b) float rate; c) int variable_count; d) int $main;
Answer:d

86) Which of the following is true for variable names in C? a) They can contain alphanumeric characters as well as special characters b) It is not an error to declare a variable to be one of the keywords(like goto, static) c) Variable names cannot start with a digit d) Variable can be of any length
Answer:c

87) The format identifier %i is also used for _____ data type? a) char b) int c) float d) double
Answer:b

88) Which of the following is a User-defined data type? a) typedef int Boolean; b) typedef enum {Mon, Tue, Wed, Thu, Fri} Workdays; c) struct {char name[10], int age}; d) all of the mentioned
Answer:d

89) What is the size of an int data type? a) 4 Bytes b) 8 Bytes c) Depends on the system/compiler d) Cannot be determined
Answer:c

90) Which of the following declaration is not supported by C? a) String str; b) char *str; c) float str = 3e2; d) Both (a) and (c)
Answer:a

Potrebbero piacerti anche