Chapter 1: Overview of 1) State whether the following statements are true or false. a) Every line in a C program should end with a semicolon (True) b) In C language lowercase letters are significant (True) c) Every C program ends with an END word (False) d) main( ) is where the program begins its execution (True) e) A line in a program may have more than one statement (False) f) A printf statement can generate only one line of output g) The closing brace of the main( ) in a program is the logical end of the program (True) h) The purpose of the header file such as stdio.h is to store the source code of a program i) Comments cause the computer to print the text enclosed between /* and */ when executed (F) j) Syntax errors will be detected by the compiler (True) 2) Which of the following statements are true? a) Every C program must have atleast one user-defined function (True) b) Only one function may be named main( ) (True) c) Declaration section contains instructions to the computer (False) 3) Which of the following statements about comments are false? a) Use of comments reduces the speed of execution of a program (False) b) Comments serve as internal documentation for programmers (True) c) A comment can be inserted in the middle of a statement (False) d) In C, we can have comments inside comments (False) Chapter 2: Constants, Variables, and Data Types 4) State whether the following statements are true or false a) Any valid printable ASCII can be used in an identifier b) All variables must be given a type when they are declared (True) c) Declarations can appear anywhere in a program (False) d) ANSI C treats the variables name and Name to be same (False) e) The underscore can be used anywhere in an identifier (False) f) The keyword void is a in C (True) g) Floating point constants, by default, denote float type values (False) h) Like variables, constants have a type (False) i) Character constants are coded using double quotes (False) j) Initialization is the process of assigning a value to a variable at the time of declaration (True) k) All static variables are automatically initialized to zero (True) l) The scanf function can be used to read only one value at a time (False) Chapter 3: Operators and Expressions 5) State whether the following statements are true or false a) All arithmetic operators have the same level of precedence (False) b) The modulus operator % can be used only with integers (True) c) The operators <=, >=and !=all enjoy the same level of priority (False) d) During modulo division, the sign of the result is positive, if both the operands are of the same sign (False) e) In C, if a data item is zero, it is considered false (True) f) The expression !(x<=y) is same as the expression x>y (True) g) A unary expression consists of only one operand with no operators (False) h) Associativity is used to decide which of several different expressions is evaluated first i) An expression statement is terminated with a period j) During the evaluation of mixed expressions, an implicit cast is generated automatically (True) k) An explicit cast can be used to change the expression (True) l) Parentheses can be used to change the order of evaluation expressions (True) Chapter 4: Managing Input and Output Operations 6) State whether the following statements are true or false a) The purpose of the header file is to store the programs created by the users

Dept of Computer Science SSBN Degree College

b) The C standard function that receives a single character from the keyboard is getchar c) The getchar cannot be used to read a line of text from the keyboard d) The input list in a scanf statement can contain one or more variables e) When an input contains more data items than the number of specifications in a scanf statement, the unused items will be used by the next scanf call in the program f) Formal specifiers for output convert internal representations for data to readable characters g) Variables form a legal element of the format control string of a printf statement h) The scanf function cannot be used to read a single character from the keyboard i) The format specifications %+-8d prints an integer left-justified in a field width of 8 with a plus sign, if the number is positive j) If the field width of a format specifier is larger than the actual width of the value, the value is printed right-justified in the field k) The print list in a printf statement can contain function calls l) The format specification %5s will print only the first 5 characters of a given string to be printed Chapter 5: Decision Making and Branching 7) State whether the following are true or false a) When if statements are nested, the last else gets associated with the nearest if without an else b) One if can have more than one else clause c) A switch statement can always be replaced by a series of if..else statements d) A switch expression can be of any type e) A program stops its execution when a break statement is encountered f) Each expression in the else if must test the same variable g) Any expression can be used for the if expression h) Each case label can have only one statement i) The default case is required in the switch statement j) The predicate !( (x >=10)|(y = =5) ) is equivalent to (x <10) && (y !=5 ) Chapter 6: Decision Making and Looping 8) State whether the following statements are true or false a) The do…while statement first executes the loop body and then evaluate the loop control expression b) In a pretest loop, if the body is executed n times, the test expression is executed n+1 times c) The number of times a control variable is updated always equals the number of loop iterations d) Both the pretest loops include initialization within the statement e) In a for loop expression, the starting value of the control variable must be less than its ending value f) The initialize, test condition and increment parts may be missing in a for statement g) While loops can be used to replace for loops without any change in the body of the loop h) An exit-controlled loop is executed a minimum of one time i) The use of continue statement is considered as unstructured programming j) The three loop expression used in a for loop header must be separated by commas Chapter 7: Arrays 9) State whether the following statements are true or false a) The type of all elements in an array must be the same b) When an array is declared, C automatically initializes its elements to zero c) An expression that evaluates to an integral value may be used as a subscript d) Accessing an array outside its range is a compile time error e) A char type variable cannot be used as a subscript in an array f) An unsigned long int type can be used as a subscript in an array g) In C, by default, the first subscript is zero h) When initializing a multidimensional array, not specifying all its dimensions is an error i) When we use expression as a subscript, its result should be always greater than zero j) In C, we can use a maximum of 4 dimensions for an array k) In declaring an array, the array size can be a constant or variable or an expression

Dept of Computer Science SSBN Degree College

l) The declaration int x[2]={1,2,3}; is illegal Chapter 8: Character Arrays and Strings 10) State whether the following statements are true or false a) When initializing a string variable during its declaration, we must include the null character as part of the string constant, like “GOOD\0” b) The gets function automatically appends the null character at the end of the string read from the keyboard c) When reading a string with scanf, it automatically inserts the terminating null character d) String variables cannot be used with the assignment operator e) We cannot perform arithmetic operations on character variables f) We can assign a character constant or a character variable to an int type variable g) The function scanf cannot be used in any way to read a line of text with the white-spaces h) The ASCII character consists of 128 distinct characters i) In the ASCII collating sequence, the uppercase letters precede lowercase letters j) In C, it is illegal to mix character data with numeric data in arithmetic operations k) The function getchar skips white-space during input l) In C, strings cannot be initialized at run time m) The input functions gets has one string parameter n) The function call strcpy(s2,s1):copies string s2 into string s1 o) The function call strcmp (“abc”, “ABC”); returns a positive number Chapter 9: User-Defined Functions 11) State whether the following statements are true or false a) C functions can return only one value under their function name b) A function in C should have atleast one argument c) A function can be defined and placed before the main function d) A function can be defined within the main function e) An user-defined function must be called atleast once; otherwise a warning message will be issued f) Any name can be used as a function name g) Only a void type function can have void as it argument h) When variable values are passed to functions, a copy of them are created in the memory i) Program execution always begins in the main function irrespective of its location in the program j) Global variables are visible in all blocks and functions in the program k) A function can call itself l) A function without a is illegal m) Global variables canoe be declared as auto variables n) A must always be placed outside the calling function o) The of a function is int by default p) The variable names used in prototype should match those used in the function definition q) In parameter passing by pointers, the formal parameters must be prefixed with the symbol in their declarations r) In parameter passing by pointers, the actual parameters in the function call may be variables or constants s) In passing arrays to functions, the function call must have the name of the array to be passed without brackets t) In passing strings to functions, the actual parameter must be name of the string post-fixed with size in brackets Chapter 10: Structures and Unions 12) State whether the following statements are true or false a) A struct type in C is a built-in data type b) The tag name of a structure is optional c) Structures may contain members of only one data type d) A structure variable is used to declare a data type containing multiple fields e) It is legal to copy a content of a structure variable to another structure variable of the same type

Dept of Computer Science SSBN Degree College

f) Structures are always passed to functions by printers g) Pointers can be used to access the members of structure variables h) We can perform mathematical operations on structure variables that contain only numeric type members i) The keyword typedef is used to define a new data type j) In accessing a member of a structure using a pointer p, the following two are equivalent: (*p).member_n name and p->member_name k) A union may be initialized in the same way a structure is initialized l) A union an have another union as one of the members m) A structure cannot have a union as one of its members n) An array cannot be used as a member of a structure o) A member in a structure can itself be a structure Chapter 11: Pointers 13) State whether the following statements are true or false a) Pointer constants are the addresses of memory locations b) Pointer variables are declared using the address locations c) The underlying type of a pointer variable is void d) Pointers to pointers is a term used to describe pointers whose contents are the address of another pointer e) It is possible to cast a pointer to float as a pointer to integer f) An integer can be added to a pointer g) A pointer can never be subtracted from another pointer h) When an array is passed as an argument to a function, a pointer is passed i) Pointers cannot be used as formal parameters in headers to function definitions j) Value of a local variable in a function can be changed by another function Chapter 12: File Management in C 14) State whether the following statements are true or false a) A file must be opened before it can be used b) All files must be explicitly closed c) Files are always referred to by name in C programs d) Using fseek to position a file beyond the end of the file is an error e) Function fseek may be used to seek from the beginning of the file only Chapter 13: Dynamic Memory Allocation and Linked Lists 15) State whether the following statements are true or false a) Dynamically allocated memory can only be accessed using pointers b) Calloc is used to changed the memory allocation previously allocated with malloc c) Only one call to free is necessary to release an entire array allocated with calloc d) Memory should be freed when it is no longer required e) To ensure that it is released, allocated memory should be freed before the program ends f) The link field in a linked list always points to successor g) The first step in a adding a node to a linked list is to allocate memory for the next node Chapter 14: The Preprocessor 16) State whether the following statements are true or false a) The keyword #define must be written starting from the first column b) Like other statements, a processor directive must end with a semicolon c) All preprocessor directives begin with # d) We cannot use a macro in the definition of another macro

Dept of Computer Science SSBN Degree College