C and C++
C and C++
Question 1 The language of object oriented program is [A] C [B] FORTRAN [C] PASCAL [D] C++ Answer : D 2 The feature of object-oriented program is (i). Emphasis on data (ii). Program is divided in to objects (iii). Only focus on data only (iv). Data is hidden [A] (i) only [B] (i) & (ii) & (iv) only [C] (iii) only [D] (iv) and (i) Answer : B Object is of type [A] Class type [B] Predefined type [C] Member function [D] Data Answer : A A class is [A] [B] [C] [D] Answer : A Collection of objects of similar type Collection of objects of dissimilar type Collection of member functions only Separated from the member function and object
The concept of object-oriented programming is (i). Polymorphism (ii). Encapsulation (iii). Muti-threading (iv) Inheritance [A] (i) only [B] (i), (ii), (iv) only [C] (ii) and (iii) only [D] (iv) only Answer : B
Any C++ program execution starts from [A] Main [B] Above the main [C] Without main [D] Outside the main Answer : A The operator << is called as [A] Bit-wise left shift [B] Right shift [C] Bit-wise right shift [D] Left shift Answer : A The input/output statements contains in this header file [A] Conio.h [B] iostream.h [C] stdio.h [D] math.h Answer : B In C++ main() returns the value of type [A] Integer [B] String [C] Byte [D] Array Answer : A
10 The reference data member of a class can be initialized [A] In the constructor [B] In the class declaration [C] In the initialiser [D] Cannot be initialized at all Answer : A 11 A comment: [A] Is a note that can be put in to the source code [B] Is ignored by the compiler [C] Starts with the /* character pair [D] All of the above Answer : D 12 Choose the correct answer [A] C++ is more strongly typed than C [B] C is more strongly typed than C++ [C] Size of literal character in C is that of a character
[D] Answer : D
13 The cascading operators use [A] Multiple use of << in one statement [B] Single use of << in one statement [C] Single use of >> in one statement [D] Multiple of >> in one statement Answer : A 14 C front [A] [B] [C] [D] Answer : C Is front end of a C compiler Is the pre-processor of a C compiler Translates a C++ code to its equivalent C code None of the above
15 The C++ program implementations have extensions such as [A] .c [B] .C [C] .pp [D] All of the above Answer : D 16 The C++ compiler would produce [A] An object file [B] An executable file [C] Class file [D] Text file Answer : A 17 The output function in C++ used as [A] Printf [B] Scanf [C] Cout [D] Cin Answer : C 18 The software development components [A] Procedures [B] Methods [C] Tools [D] All of the above Answer : D 19 The classic software development life cycle contains
20 The life cycle method is called as [A] Water fall model [B] Win-win model [C] Spiral model [D] None Answer : A 21 Problem space contains [A] Objects defined in problem space during analysis Solution specifier objects defined during [B] analysis [C] Objects defined before the problem space [D] Objects defined after the problem space Answer : A 22 In a C++ program constant is defined [A] Before main [B] After main [C] Any where but starting on new line [D] Cannot be determined Answer : C 23 In header files whether functions are [A] Declared [B] Defined [C] Declared & determined [D] Initialized Answer : B 24 The polymorphism means in oops concept [A] Single form only [B] Single name to be used for more than one [C] Different names to be used for more than one [D] No name is used Answer : B 25 Which of the following is procedural language [A] Ada [B] Small talk [C] C++
[D] C Answer : D 26 Which is/are the following object-oriented languages [A] Smalltalk [B] C++ [C] Eiffel [D] All of the above Answer : D 27 The C++ developed by [A] Dennis Ritchie [B] Bjarne Strostrup [C] Clocksin & Mellish [D] J Hame Answer : B 28 Which header file contains the input stream [A] ostream.h [B] conio.h [C] iostream.h [D] stdio.h Answer : B 29 The out put stream symbol in C++ [A] >> [B] <> [C] << [D] :: Answer : C 30 In which of the following is literal [A] String [B] enum [C] int [D] float Answer : B 31 What is the mechanism of scope resolution operator? [A] To access the local variable in the function To access the global variable from the function in [B] which local variable name same as global variable [C] Dont access the global variable from the function [D] All of the above Answer : B
32 The variable name is [A] Memory location of entity [B] Constant [C] Keyword [D] Literal Answer : A 33 The logical operator is [A] & [B] ^ [C] << [D] ! Answer : D 34 Which of the following is Bit-wise complement operator [A] ! [B] && [C] >> [D] ~ Answer : D 35 The unary operator is [A] -[B] ++ [C] [D] +Answer : C 36 The symbol defined using # define are called as [A] Vector [B] Macro [C] Expression [D] Integer Answer : B 37 The statement terminator in C++ represented by [A] : [B] \n [C] \t [D] ; Answer : D 38 String constants are represented within [A] Single quotes [B] Double quotes [C] /* and */
[D] The braces Answer : A 39 Which is not keyword of C++ [A] Const [B] Main [C] Sizeof [D] Void Answer : B 40 Tokens are separated by using [A] : [B] . [C] ; [D] Separator Answer : D 41 (1)A definition allocates memory space for a variable (2)A declaration allocates memory space for a variable (3)A definition can occur multiple times (4)A declaration can occur multiple times Regarding the difference between a declaration & a definition of a variable, which of the above statements are true? [A] (1)& (3) only [B] (1)&(4) only [C] (2)&(3) only [D] (2)&(4) only Answer : B 42 What is variable declaration? [A] The assignment of properties to a variable [B] The assignment of memory space to a variable The assignment of properties & memory space to [C] variable The assignment of properties and identification to [D] a variable Answer : D 43 The bit-wise AND is used for [A] Masking [B] Comparison [C] Division [D] Shifting bits Answer : A
44 Explicit type conversion is known as [A] Casting [B] Coercion [C] Options a& b [D] Upward type conversion Answer : C 45 The symbol # in the #define statements must commence from [A] Any where in a line [B] The first column of a line [C] The first column of next line [D] The first line Answer : A 46 How the library functions are made available to a program? [A] By using #define statements [B] By linking loader to the program [C] By using #include statements [D] By using function declaration Answer : C 47 main() { double x=1/2.0-1/2; printf(x=%.2f\n,x); } What will be the output? [A] X=0.00 [B] X=0.25 [C] X=0.50 [D] X=1.00 Answer : C 48 The associativity of assignment operator is [A] Right to left [B] Left to right A for arithmetic expression and b for pointer [C] expression A for pointer expression and b for arithmetic [D] expression Answer : A 49 Dividing a program into functions [A] Is the key to object oriented programming [B] Makes the program easier to conceptualize [C] Makes the program run faster
[D] May increase the size of program Answer : B 50 How many bytes occupies the char variable [A] 4- bytes [B] 2-bytes [C] 1-byte [D] 16-bits Answer : C 51 Function prototyping is used to [A] Describe the function [B] Describe the number and type of arguments [C] Describe the return value only [D] Describe the parameters Answer : B 52 When a argument is passed by reference A variable is created in the function to hold the [A] arguments value [B] The function cant access the arguments value A temporary variable is used in the calling [C] program to hold the argument value The function access the argument original value in [D] the calling program Answer : A 53 Passing arguments to functions using reference is [A] To affect only the actual arguments [B] Same as the actual argument [C] Interchanging their values [D] No change in formal parameters Answer : A 54 What is the output of the following program Void swap (int &i, int &j) { int temp = i; i = j; j = temp; } main () { int a = 10, b = 3; swap (a, b); Cout<< a = << a<<<
55 Which of the following parameter passing mechanism is/are supported by C++ , but not by C? (i). Pass by value (ii). Pass by reference (iii). Pass by constant reference (iv). All the above [A] (i) only [B] (i) and (iii) only [C] (ii) and (iv) only [D] (iii) only Answer : B 56 The parameter associated with the function during function call is called [A] Local parameter [B] Global parameter [C] Actual parameter [D] Formal parameter Answer : C 57 Inline function is a Function that is expanded in line when it [A] involved [B] Function that is expanded in block of statements [C] Function that is inside the function [D] Function cannot be expanded Answer : A 58 Inline functions may not work in (i). Switch (ii). Static variable (iii). For loop (iv). Return statement exists [A] (i) only [B] (i) (ii) & (iv) [C] (iii) & (iv) [D] (iii) (i) only Answer : B
59 The declaration void fun(int) indicates that fun is a function which [A] Has no argument [B] Returns nothing [C] Both a and b [D] Has argument Answer : B 60 If many functions have the same name, which of the following, if present,will be used by the compiler to invoke the correct function to be used? [A] The operator [B] Object pointer [C] Function signature [D] All of the above Answer : D 61 The virtual functions in C++ is analogous to _____ statements in C [A] Switch [B] Go to [C] For [D] While Answer : B 62 When the calling function calls called function, the function should have a [A] Prototype [B] Data member [C] Object [D] Static member Answer : A 63 Constructors are used in C++ to [A] Declare an object [B] Initialize an object [C] Destroy the object [D] Modify the object Answer : B 64 The default constructor can be called with [A] Parameters [B] No parameters [C] Arguments [D] Integers Answer : B
65 In the following program the function is defined as Void g() { Car a; Car b(); } [A] Function [B] Object [C] Class [D] Variable Answer : A 66 A function abc is defined as (Assume h, g are declared as integers) Void abc(int x = 0, int y = 0) { Printf (%d, %d, x, y); } Which of the following function calls is/are legal? [A] abc (); [B] abc (h); [C] abc (h, h); [D] abc (h, g); Answer : D 67 Function prototyping means [A] Checking if the function is declared before its use [B] Checking of the function has a forward reference Checking of the function call confirms to the [C] declaration in type and number [D] Checking if the function has no reference Answer : C 68 By passing values to the called functions by reference using swap [A] Changes are made by the passed parameters [B] No changes are made by the passed parameters [C] Exchanged their values by the parameters [D] Values are not exchanged by the parameters Answer : C 69 Pass-by-value wont work in C++, of the destination type is [A] Abstract base class [B] Derived class [C] Static class [D] Extended class Answer : A 70 The standard output stream object in C++ is
71 The standard input is in header file in C++ [A] [B] <# iostream.h> [C] [D] Answer : A 72 The global object is used by [A] The entire program [B] Only part of the program [C] Not used by the program [D] The functions Answer : A 73 The use of the break statement in a switch statement is [A] Optional [B] Mandatory [C] Not allowed [D] To check an error Answer : A 74 The statement to read a decimal value from the keyboard, into the integer variable sum is [A] cin >> sum; [B] cin >> sum; [C] cout << sum; [D] cout << sum; Answer : B 75 In C++, the goto statement causes control to [A] Function [B] A label [C] A variable [D] An operator Answer : B 76 Overloaded functions in C++ [A] Are a group of functions with the same name [B] All have the same number and type of arguments [C] May fail unexpectedly due to stress
[D] Cause compilation problems Answer : A 77 In C++ functions, a default argument has a value that May be supplied by the calling program (or) the [A] function [B] May have a constant value [C] May have a variable value [D] May not be supplied by the calling program Answer : A 78 An enumerated data type brings together a group of Constant values integers with user-defined [A] names [B] Related data types [C] Items of different data types [D] Similar types of data Answer : A 79 How many values can be returned from a function [A] 2 [B] 1 [C] 4 [D] 5 Answer : B 80 Operator overloading is [A] Making C++ operators work with objects [B] Giving new meanings to existing C++ operators [C] Making new C++ operators [D] Both (a) and (b) Answer : D 81 When you overload an arithmetic assignment operator, the result [A] Must be returned Goes in the subject of which the operator is a [B] member [C] Goes in the object to the left of the operator [D] Goes in the object to the right of the operator Answer : C 82 In function, when an argument is passed by reference [A] The function cannot access the arguments value A temporary variable is created in the calling [B] program to hold the arguments value [C] A variable is created in the function to hold the
[D] Answer : C
arguments value The function access the arguments original value in the calling program
83 Static automatic variable is used to Conserve memory when a function is not [A] executing [B] Make a variable visible to several functions Make a variable visible to only one function and [C] retain a value when a function is not executing Make a variable visible to many functions when it [D] is executing and retain a value when a function is not executing Answer : D 84 Virtual functions in C++, allow you to Use the same function call to execute member [A] function of objects from different class [B] Create functions that have no body Group of objects of different classes they can all [C] be accessed by the same code Create an array of type pointer-to-base-class that [D] can hold pointers to derived class Answer : A 85 Pure virtual function is a virtual function that [A] Has no body [B] Is used in a base class [C] Returns nothing [D] Both a and b Answer : D 86 Virtual base class is useful when [A] It makes sense to use a base class with no body There are multiple paths from one derived class to [B] another Different functions in base and derived classes [C] have the same name The identification of a function in a base class is [D] ambiguous Answer : D
87 In C++ container classes are used as [A] Objects [B] Templates [C] Interfaces [D] Default constructors Answer : B 88 # include main() { cout <<Simple Enough; return(0); } [A] Simple enough [B] 0 [C] Simple oops concept [D] 1 Answer : B 89 Static data members are visible only [A] Within the class [B] Outside the class [C] To number of classes [D] To number of objects Answer : A 90 A static member function is used to Access only other static members declared in [A] different classes Access only other static members declared in the [B] same class Access all other data members declared within [C] the same class Access all other data members declared out side [D] the class Answer : B 91 The keyword friend appears in [A] The public section of a class [B] The private section of a class [C] The class allowing access to another class [D] All of the above Answer : D 92 A friend function is used in two classes as [A] To access the private data of both classes
To access the private data from one class only Not accessed by the classes To access the public and private data of both classes
93 Reusability is a desirable feature of a language as it [A] Decreases the testing time [B] Lowers the maintenance cost [C] Both (a) & (b) [D] Reduces the execution time Answer : C 94 Choose the correct statement [A] Recursive function cannot be declared as inline [B] Recursive function can be declared as inline Recursive function should not be declared outside [C] the main() Recursive function accepts integer arguments [D] only Answer : A 95 cout stands for [A] Class output [B] Character output [C] Common output [D] Call output Answer : C 96 The following program Void abc (int &p) { Cout << p; } Void main (void) { float m = 11.23; abc (m); Cout << m; } This code [A] Results in compilation error [B] Results in runtime error [C] Prints 11.23 [D] Prints 11 Answer : A
97 The following program Class abc; Class def { int i1; //statement1 Protected: int i2,i3; //statement2 Friend abc; }; Class abc { Public: void mn (def A) } Cout << (A.i1 = 3); Cout << (A.i2 = 4); Cout << (A.i3 = 5); }; Void main () {def x1; abc x2; x2.mn(x1);} Will compile successfully if statement 1 is [A] removed Will compile successfully of statement 2 is [B] removed [C] Will run successfully and print 345 Will compile successfully of statements 3 is [D] removed Answer : C 98 If the function chg is coded as int chg (const int & x) {x = 10; return (11); }then [A] It results in compile time error [B] It results in run time error [C] It prints 112 [D] It prints 1110 Answer : A 99 The storage class static can be used to [A] Restrict the scope of an external identifier [B] Preserve the exit value of variable [C] Provide privacy to set of functions [D] All of the above Answer : D 100 C preprocessor
Takes care of conditional compilation Dont care of macros Takes care of static files Acts after compilation
101 Choose the correct answer The scope of a macro definition extends the entire [A] program The scope of macro definitions extends from the [B] point of definition to the end of the file [C] New line is not a macro definition delimiter The scope of a macro does not extends the entire [D] program Answer : A 102 Preprocessing is typically done Either before or at the beginning of the [A] compilation process [B] After compilation but before execution [C] After loading [D] Before loading Answer : A 103 Choose the correct answers [A] x is same as x [B] Length of the string x is two Unless otherwise specified, the first name in an [C] enum has the value1 [D] None of the above Answer : D 104 In C++ the limit on the length of a name [A] 32 Characters [B] 64 Characters [C] No limit [D] 128 Characters Answer : C 105 The use of void are (i). To specify the return type of a function, when it is not running any value (ii). Contains empty argument to a function (iii). Contains arguments to a function
(iv). Doesnt specify return value [A] (i) only [B] (ii) and (iv) [C] (iv) only [D] (iii) and (iv) Answer : A 106 C++ character set includes [A] Letters [B] Digits [C] Special characters [D] All the above Answer : D 107 The user defined data types [A] Structure [B] Function [C] Array [D] Pointer Answer : A 108 The syntax of enum is [A] Enum shape {circle, square, triangle}; [B] Enum shape = circle, square; [C] Enum shape []; [D] Enum {shape = circle, square}; Answer : A 109 The enum in C++ Doesnt permit an int value to convert it to an [A] enum [B] Permits int to Enum value [C] Permits int to int value only [D] Permits float value Answer : A 110 The valid statement in enum [A] Color background = blue; [B] Color background = 7; [C] Color background [] = blue; [D] Color background = red, blue; Answer : A 111 The enum in C++ is defined as [A] Defined within a class and local to class [B] Defined outside the class and global to class [C] Defined in class and global to all class variable
[D] Not in class Answer : A 112 The value of const declared in C++ [A] Cannot be modified by the program [B] Modified by the program [C] Modified only with length [D] Modifies limited part of the program Answer : A 113 This would be illegal in C [A] Const int size = 10; [B] int a = 10; [C] int a[0] = 10; [D] String name = b; Answer : A 114 In C++ const variables are [A] Global to file [B] Local to file [C] Not to be accessed [D] Changed Answer : B 115 C++ variable are case sensitive [A] False [B] Cant say [C] True [D] Sometimes Answer : C 116 In C++ static variable are [A] Not to be accessed [B] Global to class [C] Cant say [D] Local only Answer : D 117 Which of the following is allowed in C++ [A] Strict type compatibility than C [B] Type compatibility not maintained [C] Loosely held compatibility [D] Tight compatibility Answer : A 118 In a C++ program constant is defined [A] Before main
[B] After main [C] Anywhere but starting on new line [D] In class only Answer : C 119 The size of (int) is equivalent to [A] Size of (x) [B] Size of (x) [C] Size of (int x) [D] Size of (char) Answer : C 120 In C++ the size of (x) equals to [A] Size of (char) [B] Size of (int) [C] Size of (x) [D] Size of (float) Answer : A 121 In C++ all variables must be [A] Declared before they are used [B] Declared after they are used [C] Not defined when they are involved [D] Declared at run time Answer : A 122 The dynamic initialization in C++ [A] Initialization of the variables at compile time [B] Initialization takes place automatically [C] Initialization of the variable at run time [D] Initialization doesnt takes place Answer : C 123 A reference variable provides------- for previous defined variable [A] Same name [B] Alias name [C] No name [D] Cant say Answer : B 124 The size of integer [A] 4 bytes [B] 2 bytes [C] 1 byte [D] 32 bits
Answer : B 125 The output of the following is Void f (int &n) {x = x + 10} main() { int m = 10 f(m); Cout< } [A] 40 [B] 20 [C] Error [D] 10 Answer : C 126 The new operator used for [A] Memory allocation [B] Creating Memory allocation [C] Neither allocates nor deallocates [D] Deallocate the variable Answer : B 127 The scope of variable Extends from the point of its declaration itself [A] only Extends from the point of its declaration till the [B] end of the block Extends from the point of its declaration outside [C] of the block [D] Extends within the block Answer : B 128 The scope resolution operator is [A] > [B] : [C] :: [D] ; Answer : C 129 The symbol :: used to [A] Access the global variable [B] Access the local variable [C] Not access any variable [D] Provide inheritance
Answer : A 130 The following output is # include int m = 10; main( ) {int m = 20; {int k = m; Cout<<k = <<K Cout<<m = <<M } Cout<< ::m } [A] 20, 20, 10 [B] 10, 20, 40 [C] 10, 40, 20 [D] 10, 10, 40 Answer : A 131 Malloc and calloc ( ) functions used to [A] Allocate memory at compile time [B] Allocate memory dynamically at run time [C] Allocates static memory [D] Deallocate memory Answer : B 132 Pointer variable holds [A] Address of the memory space allocated [B] Value of the variable only [C] Doesnt contain value of the address [D] Address of different variable Answer : A 133 The new operator used in malloc( ) function is [A] Automatically computes the size of object [B] Returns the different pointer Not to initialize the object while creating the [C] memory space [D] used to allocate memory Answer : A 134 C++ permits which of the following type casting [A] (type-name) (expression) [B] (type-name) expression [C] [type-name] expression [D] type-name (expression)
Answer : D 135 Type casting is allowed in C++ [A] Implicitly [B] Explicitly [C] Both (a) & (b) [D] some times only Answer : B 136 Expressions is a combination of [A] Pointers [B] Strings [C] Operators [D] Constants Answer : C 137 Reference is not same as pointer because [A] A reference can never be null [B] A reference once established cant be changed Reference doesnt need an explicit differencing [C] mechanism [D] All the above Answer : D 138 Const int v [] = {1, 2, 4} Void f ( ) {Cout< } What is the output? [A] 3 [B] 5 [C] Error [D] 4 Answer : B 139 In C++ the object is defined as [A] Instance of the class [B] Not a member of the class [C] Template [D] Vector Answer : A 140 The reference data member of a class can be initialized [A] In the constructor [B] In the class declaration [C] In the initialiser list
[D] Cannot be initialized at all Answer : B 141 A class having no name [A] Is not allowed [B] Cannot have a constructor [C] Can have a destructor [D] Can be passed as an argument Answer : B 142 A constructor is called whenever [A] An object is declared [B] Object is used [C] A class is declared [D] A class is used Answer : A 143 The difference between structure and class is by default The members of a class are private and structures [A] are public The members of a class are public and structures [B] are private [C] There is no difference [D] None Answer : A 144 The private access specifier is defined as follows [A] Members can be accessed only outside the class [B] Members can be accessed only within the class [C] Members not accessed by within the class [D] Members treated as functions Answer : B 145 By default the members of a class are [A] Protected [B] Public [C] Private [D] Object Answer : C 146 Binding of data and functions in to single unit is referred to as [A] Data hiding [B] Polymorphism [C] Message passing [D] Encapsulation Answer : D
147 Constructors must have the [A] Same name as class [B] Different name as class [C] Default name [D] Same as main() function Answer : A 148 Classes are useful because they [A] Are removed from memory when not in use [B] Permit data to be hidden from other class Bring together all aspects of an entity in one [C] place [D] Can closely model objects in the real world Answer : B 149 Copy constructor is invoked when [A] A function returns by value [B] An argument is passed by value [C] A function returns for reference [D] An argument is passed by reference Answer : A 150 A C++ stream is [A] The flow of control through a function [B] Flow of data from one place to another [C] Associated with a particular class [D] A file Answer : B 151 The public files in a class library usually contain [A] Constant definitions [B] Member function definitions [C] Class declarations [D] Variable definitions Answer : C 152 When a language has the capability to produce new data types, it is called [A] Extensible [B] Overloaded [C] Encapsulated [D] Reprehensible Answer : A 153 What is a structure? [A] Collection of same data types [B] Collection of variables
[C] Collection of heterogeneous data [D] Collection of objects Answer : C 154 Overloading is otherwise known as [A] Virtual polymorphism [B] Transient polymorphism [C] Pseudo polymorphism [D] Polymorphism Answer : D 155 Assume that a program contains the following three statements? Char itemname [10] = ; Cout <<Enter name::; Cin >> itemname; If, after executing this program, enter two words Redcoat, C++ will store _____in the itemname [A] Coat [B] Red [C] Red coat [D] Cold Answer : C 156 In the statement return-type class-name :: function name () { Function body } Scope of the function restricted to specified class [A] name only [B] Scope of the function to different classes [C] Restriction of total class [D] Function not executed Answer : A 157 The function putdata() has been defined inside the class and therefore behaves like [A] A string [B] Inline function [C] A string [D] Constructor Answer : B 158 Constructors cannot be [A] Abstract class
[B] Declared [C] Virtual [D] None Answer : C 159 Constructors can return type? [A] Integer [B] String [C] 0 [D] Dont return Answer : C 160 Let class APE be a friend of class SAPIEN. Let class HUMAN is a child class of SAPIEN and let MONKEY be a child class of APE. Then [A] SAPIEN is not a friend of APE [B] APE is not a friend of HUMAN [C] MONKEY is not a friend of SAPIEN [D] All the above Answer : D 161 If a file is opened in r+ mode then [A] Reading is not possible [B] Writing is possible [C] It will be created if it does not exist [D] All the above comments are true Answer : B 162 The fseek feature [A] Needs two arguments [B] Makes the rewind feature unnecessary Is meant for checking whether a given file exists [C] or not [D] Need no arguments Answer : B 163 Object oriented program is based on [A] Function abstraction [B] Data abstraction [C] System abstraction [D] None Answer : B 164 Establishment of communication among objects in C++ is through [A] Data hiding [B] Binding
[C] Message passing [D] Polymorphism Answer : C 165 In a class member functions are defined [A] Only inside the class [B] Only outside the class [C] Neither inside nor outside the class [D] Both inside and outside the class Answer : D 166 The mechanism of binding the function to class using the operator is [A] Scope resolution operator (: :) [B] Arithmetic operator (+) [C] Assignment operator (=) [D] Operand operator (&) Answer : A 167 A inline member function is treated like [A] Preprocessor [B] Macro [C] Method [D] Object Answer : B 168 In C++ program any call to input line member function in a program replaced by itself is called__________ [A] Inline function [B] Macro expansion [C] Inline expansion [D] Macro function Answer : C 169 A member function prototype defined within a class is defined by using which keyword [A] Public [B] No keyword [C] Private [D] Void Answer : B 170 In a class the access specifier protected members are significantly used in [A] Polymorphism [B] Overloading [C] Inheritance
[D] Message passing Answer : C 171 The size of vector object by creating an object is known only [A] At runtime [B] At compile time [C] At creation [D] All the above Answer : A 172 A copy of the object is passed to function and any modifications made to the object is not reflected in the object used to call the function is_______ [A] Pass-by-reference [B] Pass-by-value [C] Pass-by-pointer [D] Pass-by-address Answer : B 173 The parameter passing pointer is Only the address of the object is passed and not a [A] copy of the entire object The address of the object and copy of the entire [B] object is passed [C] Only the entire object is passed [D] All of the above Answer : A 174 In C++ class the friend class Allow the functions to declare public member of [A] the class Allow the functions to access even the private [B] members of class Disallows the functions to access even the private [C] members of the class [D] None Answer : B 175 A friend function posses __________________ The scope of the friend function is not limited to [A] the class The friend function cannot be called using the [B] object of the class [C] The friend function can be either declared in the private (or) public part of a class without affecting
[D] Answer : D
176 The following program Class A {Private: int value; Public: Void setVal(int v) {Value = v;} int getVal() {return (Value);} }; Void decrement (A & a) a. Value ; Class B {Public: Void touch (A & a) {a. Value ++;} }; [A] Run successfully [B] Will not compile [C] Run time error [D] Return value Answer : B 177 The order of execution of constructor of following declaration will be Class derived: public base, virtual B [A] Derived, Base, B [B] B, Base, Derived [C] Derived, B, Base [D] Base, B, Derived Answer : B 178 Structure member have _____________ accessibility by default [A] Private [B] Abstract [C] Void [D] Public Answer : D 179 Static data members are accessed like variables [A] Global
[B] Local [C] Neither global nor local [D] Cant be determined Answer : A 180 Choose the correct statement? Static functions cant access only the static [A] members of declared in the same class Static functions can access all the static members [B] of declared different classes Static functions can access only the static [C] members declared in the same class [D] All of the above Answer : C 181 The ability to create user defined data types for modeling real world object is [A] Data encapsulation [B] Data abstraction [C] Data hiding [D] Message passing Answer : B 182 An object is destroyed which is invoked [A] Constructor [B] Default Constructor [C] Destructor [D] All of the above Answer : C 183 Constructor overloading mechanism is Have the same name as the class and differ in [A] their signatures Have the different name as the class and same as [B] signature [C] Have the same name as the class and as signature [D] Cannot be determined Answer : A 184 The class is having ______________ destructor [A] More than 1 [B] Only 2 [C] Only 1 [D] 4
Answer : C 185 Allocation of memory to objects at the time of their construction is [A] Runtime construction [B] Dynamic construction [C] Dynamic destruction [D] Compile time construction Answer : B 186 Class A { int i1; protected: int i2; public: int i3; }; Class B: public A { Public: int I4; }; Class C: B {}; In the above program the variable i2 is accessible [A] To a public function in Class A [B] To a public function in Class B [C] To a public function in Class C [D] All the above Answer : D 187 The following program shows Class x Private: ----Public: x (x obj); [A] Runs [B] Error [C] Correct [D] Run time error Answer : B 188 A constructor having a reference to an instance of its own class as an argument is [A] Dummy constructor
[B] Parameterized constructor [C] Copy constructor [D] Default constructor Answer : C 189 Constant data members are [A] Read only data members [B] Write only data members [C] Both read and write data members [D] Neither read nor write data members Answer : A 190 A dynamic object is instantiated [A] At compile time [B] At run time [C] Declaration time [D] All the above Answer : B 191 The dynamic memory allocation is created by using the operator [A] Delete [B] ENUM [C] New [D] Create Answer : C 192 Pointer variables accessing the data (or) function member by using the symbol [A] & [B] -> [C] = [D] => Answer : B 193 The syntax of reference to dynamic objects [A] Class Name *Ref obj = & (new Class Name); [B] Class Name (new Class Name) = & Ref Obj; [C] Class Name & Ref Obj = * (new Class Name); [D] None Answer : C 194 The operator overloading feature of C++ is one of the following [A] Polymorphism [B] Function overloading [C] Data abstraction
[D] Inheritance Answer : A 195 The field operator in C++ [A] # [B] /t [C] ~ [D] & Answer : C 196 Unary operator overloading is the mechanism of ____________ Overloading without explicit arguments to an [A] operator function Overloading with a single explicit argument to an [B] operator function Overloading with more explicit arguments to [C] function [D] All of the above Answer : A 197 The binary operator is [A] One explicit argument [B] More than two explicit arguments [C] Two explicit arguments [D] No explicit argument Answer : C 198 In the following relation the imaginary part is C = x 1 + i y 1; [A] xi [B] y1 [C] x 1 + iy 1 [D] Cant be determined Answer : B 199 Which of the following correct prototype for insertion operator overloading [A] Ostream * operator, << (ostream s, int); [B] Ostream operator, << (ostream s, int); [C] Ostream s operator, << (ostream s); [D] Ostream s operator, << (ostream s, int); Answer : C 200 The concatenation of strings is performed by using which the perpendicular library function _____________
201 Which is the correct syntax in C++ [A] Weight = (float) age; [B] Weight = float (age); [C] Weight = (float) (age); [D] Weight = float age; Answer : B 202 In which of the following function the arguments required to be explicitly passed to the function and process them explicitly [A] Member function [B] Constant function [C] User defined function [D] Friend function Answer : D 203 The following program output is Class fig2d {int dim1, dim 2; Public: fig2d() {dim1 = 5; dim2 = 6;} Virtual void operator << (ostream & rhs); }; Void fig2d :: operator << (ostream & rhs) {rhs < dim1 <<<< this-> dim2 <<} } Void main() { fig2d obj1; fig2d obj2; obj1 << Cout; obj2 << Cout; } [A] 5 [B] 5, 6 [C] 6 [D] 6, 5 Answer : D 204 Struct emp {
int sal = 10000; int id = 20; }s1; Void main () {Cout << s1.sal <<<< s1.id; } What is the output? [A] 0, 0 [B] 1000, 20 [C] Error [D] 20, 1000 Answer : C 205 What is structure [A] Collection of same data types [B] Collection of variables [C] Collection of heterogeneous data [D] Collection of dissimilar data types Answer : C 206 Structure declaration starts with the keyword [A] Enum [B] Struct [C] Class [D] Extern Answer : B 207 The syntax of array of structures is [A] Array Name [index]; [B] Structure Name = Array Name [index]; [C] Structure Name Array Name [index]; [D] Struct Array [0]; Answer : C 208 The union stated as [A] More than one variable in the same memory area [B] Only limited variables in the different memory [C] Only collection of constant variables [D] both a& c Answer : A 209 The technique of building new classes from existing classes is called as [A] Polymorphism [B] Inheritance [C] Encapsulation
[D] Data binding Answer : B 210 class dog : public x, public y is an instance of [A] Multiple inheritance [B] Repeated inheritance [C] Linear inheritance [D] Homogeneous inheritance Answer : A 211 Choose the incorrect statement [A] A destructor is not inherited [B] A constructor cannot be virtual [C] A destructor cannot be virtual [D] A constructor is not inherited Answer : C 212 A class contains so many number of objects is called as----class [A] Abstract [B] Container [C] Vector [D] Interface Answer : B 213 In inheritance mechanism the protected member can be accessed by-[A] Only out side of the class [B] Both within the class & outside of the class [C] Only within the class [D] Cannot play role in inheritance Answer : C 214 The members& member functions declared as protected in base class can be accessed by [A] Only member functions of the base class [B] Only member functions of the derived class Both member functions of the base & derived [C] class [D] Cannot directly accessed within the class Answer : C 215 If a method is to be an interface between the outside world and a class, it has to be declared as-------[A] Private [B] Protected [C] Public
[D] External Answer : C 216 Derived class can be---------[A] Does not inheriting the properties of base class [B] Inheriting the properties of base class [C] Neither inheriting nor creating new functions [D] All of the above Answer : B 217 The derivation of derived class from the base class can be represented by using -------- symbol [A] :: [B] && [C] : [D] *& Answer : C 218 Protected members of the base class become [A] Public members of the derived class [B] Private members of the base class [C] Private members of the derived class [D] Public members of the outside of the class Answer : C 219 A derived class cannot be inherits --------from base class [A] Data members & member functions [B] Constructor [C] Destructor [D] Both b & c Answer : D 220 A single inheritance mechanism syntax is--------[A] Class Dog : public Mow ,public Animal [B] Class Dog : public Animal [C] Class Animal : public Dog : public Mow [D] Class Dog : public x, public y Answer : B 221 class Base { public: void display(){cout<<\n Display Base;} virtual void show(){cout<<\n show base;} }; class Derived : public Base{ public:
void display(){coutt<<\n display derived;} void show(){cout<<\n show derived;} }; int main(){ Base B; Derived D; Base *bptr; bptr=&B; bptr->display(); bptr->show(); bptr=&D; bptr->display(); bptr->show(); return 0;} what will be the out put of this program? display base show base [A] display derived show derived Display Base show base [B] display base show derived display base show base [C] display base show base display base show derived [D] display derived show base Answer : B 222 The mechanism of inheriting properties of existing class and it contains own features is& functions is called as------[A] abstract class [B] external class [C] base class [D] derived class Answer : D 223 Choose the correct statement [A] Base class unchanged, using derived class [B] Base class changed , using derived class Base class can be accessed properties defined in [C] the derived class of its own
[D] Answer : A
224 The derivation of a class from another class is called--[A] Multiple inheritance [B] Multilevel inheritance [C] Multi path inheritance [D] Hybrid inheritance Answer : B 225 The base class members might be needed in the derived class can be declared as------[A] Protected [B] Private [C] public [D] external Answer : A 226 In inheritance mechanism the constructor must be defined as-----in base & derived class [A] private [B] protected [C] public [D] const Answer : C 227 class B class D: private B { private: { private: int privateB; protected: int privateD; protected: int protected; public:
In the above program which statement is not accessed & error [A] Statement2 [B] Satement2&3 [C] Statement1 [D] Statement3 Answer : C 228 The friend function of a friend class have access----[A] Private members of class only [B] Both private & protected members of class only [C] Protected members of class only Neither private nor protected members of the [D] class Answer : B 229 The base class with no argument constructor can--------[A] Have a constructor in derived class [B] Not have a constructor in derived class [C] Have a default constructor [D] Both a& b Answer : B 230 class B{ public: B() {cout<<HELLO} }; class D: public B { public: cout<<HAI; };
void main(){ D obj1;} What is the out put of the program? [A] HELLO [B] HAI [C] Compile time error [D] Run time error Answer : A 231 class B{ public: B(){cout<<No argument constructor; B (int a) {cout<<base class ;} }; class D : public B{ public: D(int a){cout<<child class;} }; void main(){ D objd(3); } what is the out put of the above program? [A] No argument constructor [B] base class [C] child class [D] error Answer : C 232 class B1{ public: B1(){cout<<HELLO;} }; class B2{ public: B2(){cout<<HAI;} }; class D: public B1,public B2{ public: D():B2(),B1(){ Cout<<WELCOME;} }; void main(){ D objd; } The order of constructor invoked is
233 When the object goes out of scope in the class is invoked the ------- of the class [A] Constructor [B] Destructor [C] New [D] Delete Answer : B 234 The destructor syntax of the class is ---[A] B(){} [B] :B(){} [C] ~B(){} [D] can not be determined Answer : C 235 In inheritance the overloaded member function is an object of derived class [A] Refers to its own functions & base class [B] Refers to child class only [C] Both a& b [D] Refers to base class only Answer : A 236 By using the which symbol we can access the base class function s in overloading functions [A] & [B] : [C] . [D] :: Answer : D 237 An abstract class is [A] It has instances [B] It has no instances [C] It designed to create objects [D] All of the above Answer : B 238 A class extends another classes are named as [A] Abstract class [B] External class
[C] Friend class [D] Container class Answer : A 239 By using which ------- class , interface can be changed which immediately changes entire the system [A] static class [B] abstract class [C] friend class [D] external class Answer : B 240 A class can be derived by inheriting the traits of two (or) more base classes is called as ---------[A] Multilevel inheritance [B] Multipath inheritance [C] Multiple inheritance [D] Single inheritance Answer : C 241 Which of the following statements Ambiguity occurs Base class having functions with the different [A] name Members of a derived class (or) its objects [B] referring to a member, whose name is the same as the base class [C] Base classes having functions with the same name [D] Both b& c Answer : D 242 In inheritance mechanism the sub class can serve as a super class for the lower level classes is called as--[A] Multiple inheritance [B] Hybrid inheritance [C] Hierarchical inheritance [D] Single inheritance Answer : C 243 What are the virtual functions? The form of member function that can be changed [A] at compile time The form of member function that can be changed [B] at run time Member function that can not be changed at run [C] time [D] Can not be changed at both run time & compile
time Answer : B 244 The mechanism of allowing operate on user defined data types with the same inheritance is realized by-------[A] Function overloading [B] Operator overloading [C] Dynamic binding [D] Operator overriding Answer : B 245 In function overloading the suitable function signature invoked at-[A] Run time [B] Compile time [C] Cannot be determined [D] Both a& b Answer : B 246 Virtual functions mechanism is the concept of [A] Polymorphism [B] Operator overloading [C] Ad-hoc polymorphism [D] Function overloading Answer : A 247 Resolving function call at compile time is known as ---[A] Early binding [B] Late binding [C] Dynamic binding [D] All of the above Answer : A 248 Run time polymorphism allows in [A] Pointers [B] Arrays [C] Virtual functions [D] Function overloading Answer : C 249 Virtual functions can be declared in --------[A] Derived class [B] Abstract class [C] Container class [D] Base class Answer : D
250 When the virtual function is invoked? Derived class pointer is pointing to the base class [A] object Base class pointer is pointing to the derived class [B] object [C] Base class pointer itself [D] Both a& c Answer : B 251 class Father{ char name[20]; public: Father(char *fname){ strcpy(name, fname);} void show() {cout<<NAME< }; class Son: public Father{ char name[20]; public: Son(char *sname , char *fname):Father(fname) { strcpy (name,sname);} void show() {cout<<NAME<<END1;} }; void main(){ Father *fp; Father f1(ABC); fp=&f1; fp->show(); Son s1(XYZ, ABC); fp=&s1; fp->show();} what is the out put ? ABC [A] XYZ ABC [B] ABC XYZ [C] XYZ XYZ [D] ABC Answer : B 252 Which the following is valid statement?
Base class pointer may address an object of its own class A pointer to the derived class can be used as a pointer to other classes A pointer to derived class object cannot address an object of the base class Both a& b
253 Virtual functions should be defined in , what section of the class? [A] Public [B] Private [C] Abstract [D] Protected Answer : A 254 when a function defined as virtual in the base class and the same function redefined in the derived class then that function is by default--[A] Abstract [B] Const [C] Virtual [D] External Answer : C 255 Pure virtual functions can be defined contains--------[A] Virtual functions are defined with a body [B] Virtual functions are defined with null body [C] Virtual functions with definition & declaration [D] All of the above Answer : B 256 A class with pure virtual function ----[A] Cannot be instantiated [B] Can be instantiated [C] Can be initialized [D] Cannot allowed Answer : A 257 The syntax of pure virtual functions [A] Return Type FunctionName(arguments) [B] Virtual Return Type FunctionName(arguments) Virtual Return Type [C] FunctionName(aarguments)=0;
[D] Virtual return Type Fn(a) Answer : C 258 An abstract class with the pure virtual function has following the property [A] Objects of an abstract class cannot be created [B] Objects can be created from Abstract classes Derived classes cannot be built from these [C] abstract classes [D] All of the above Answer : A 259 A derived object pointed to by the base class pointer is deleted, which of the following is invoked? [A] Virtual constructor [B] Constructor [C] Destructor [D] Virtual destructor Answer : D 260 Choose the correct statement? [A] Constructors can be virtual [B] Constructors cannot be virtual [C] Destructors cannot be virtual [D] Both a & b Answer : B 261 Templates declared for functions are called as------[A] Class Templates [B] Function Templates [C] Frame work [D] Both a &b Answer : B 262 The syntax of Function Template is [A] [B] [C] [D] Answer : C Return Type FuncName(arg) {} class T Return Type FuncName(arg) {} template Return Type FuncName(arg) {} None
263 A class template describes------------How to build classes that implement the same data [A] structure How to build classes that implement the different [B] data structure& algorithm How to build functions that implement the same [C] algorithm How to build functions that implement the [D] different algorithm Answer : A 264 A template can be [A] Container class [B] Cookie cutter [C] Vector [D] Macro Answer : B 265 Choose the correct statement? [A] A template class cannot be instantiated [B] A template class can be instantiated [C] Both a& b [D] A template class same as normal class Answer : B 266 When template function is invoked? [A] Internally creates a new function [B] Run time [C] Compile time [D] Both a& c Answer : D 267 When the overloaded function template occurs [A] The functions with different names & types [B] The functions with the same names & types [C] Both a& b [D] Cannot say Answer : B 268 The template argument syntax is -----template class myclass{ [A] Tarr[size]; }; [B] template class myclass {
[C]
[D] Answer : C
269 template void print(T data) {cout<<DATA< template void print(T data, int nTimes) { for(int i=0;i<NTIMES;I++) cout<<DATA< void main() { print(1); print(1.5,2); } what is the out put? 1 [A] 1.5 [B] 1 1.5 1 1 [C] 1.5 1.5 [D] 1 1 1.5 Answer : C 270 In template class inheritance supports [A] has-a relationship [B] is-a- relationship [C] no-relationship [D] was-a-relationship Answer : B 271 In template class containership supports the [A] has- a- relationship [B] is-a-relationship [C] was-a-relationship
[D] no-relationship Answer : A 272 #include class a { public: void something() {cout<<a} }; class b { public: void something() {cout<<b;} }; class c:public a, public b{}; int main() {cx;} what will be the out put? [A] a:: something() is called [B] b :: something() is called [C] runtime error [D] syntax error Answer : D 273 Which of the following identifies a constant pointer to changeable character data? [A] const char& [B] const char* [C] char* const [D] no such variable can be defined Answer : C 274 A friend class is Whose member functions cannot access the [A] private members of the another class Whose member functions cannot access the [B] private members of the same class Whose member functions can access the private [C] members of the another class Member functions cannot access public members [D] of the class Answer : C 275 Which type of overloading operators allows ------ Friend
++ :: <<(or)>>
276 The ordinary function access the object that involves the member function , where as friend function [A] Does not requires objects to be passed by address Requires objects to be passed by reference (or) [B] value [C] Both a& b [D] Does not requires objects to be passed by value Answer : B 277 A class template arguments can be of type [A] Strings [B] Function name [C] Constant expression [D] All of the above Answer : D 278 fstream is used [A] For handling input files [B] For handling out put files For handling files on which both input &out put [C] are done [D] For display files Answer : C 279 In the ifstream class the open() functions inherits the following one [A] get() [B] put() [C] write() [D] seekp() Answer : A 280 An Exception in c++ [A] Program runs successfully [B] An error terminates the program [C] Syntax error [D] Modifies the program Answer : B 281 The minimum temporary variables needed to swap the
contents of two variables is [A] 1 [B] 2 [C] 3 [D] 0 Answer : A 282 The C language terminator is [A] Semicolon [B] Colon [C] period [D] exclamation mark Answer : A 283 What is false about the following -- A compound statement is [A] A set of simple statements [B] Demarcated on either side by curly brackets [C] Can be used in place of simple statement [D] A C function is not a compound statement Answer : C 284 What is true about the following C Functions [A] Need not return any value [B] Should always return an integer [C] Should always return a float [D] Should always return only one value Answer : D 285 Main must be written as [A] The first function in the program [B] Second function in the program [C] Last function in the program [D] Any where in the program Answer : D 286 Which of the following about automatic variables within a function is correct? Its type must be declared before using the [A] variable [B] They are local [C] They are not initialized to zero [D] They are global Answer : B 287 Write one statement equivalent to the following two statements x=sqr(a);
return(x); Choose from one of the alternatives [A] return(sqr(a)); [B] printf("sqr(a)"); [C] return(a*a*a); [D] printf("%d",sqr(a)); Answer : D 288 Which of the following about the C comments is incorrect? [A] C comment scan go over multiple lines [B] Comments can start any where in the line A line can contain comments with out any [C] language statements [D] Comments can occur within comments Answer : D 289 What is the value of y in the following code? x=7; y=0; if(x=6) y=7; else y=1; [A] 7 [B] 0 [C] 1 [D] 6 Answer : C 290 Read the function conv() given below conv(int t){ int u; u=5/9 * (t-32); return(u); } What is returned [A] 15 [B] 0 [C] 16.1 [D] 29 Answer : B 291 Which of the following represents true statement either x is in the range of 10 and 50 or y is zero [A] x >= 10 && x <= 50 || y = = 0 [B] x<50 [C] y!=10 && x>=50
[D] None of these Answer : A 292 What does the following function print? func(int i) { if(i%2)return 0; else return 1;} main() { int i =3; i=func(i); i=func(i); printf("%d",i); } [A] 3 [B] 1 [C] 0 [D] 2 Answer : B 293 In C language '9' represents the data type [A] int [B] char [C] string [D] float Answer : B 294 "1 e 02" represents the data type is [A] int [B] char [C] string [D] float Answer : C 295 10e05 represents the data type is [A] int [B] char [C] string [D] float Answer : D 296 What is the data type of 15 in C language [A] int [B] char [C] string [D] float Answer : A
297 Read the following code # define MAX 100 # define MIN 100 .... .... if(x>MAX) x=1; else if(x x=-1; x=50; if the initial value of x=200,what is the value after executing this code? [A] 200 [B] 1 [C] -1 [D] 50 Answer : D 298 A memory of 20 bytes is allocated to a string declared as char *s then the following two statements are executed: s="Entrance" l=strlen(s); what is the value of l ? [A] 20 [B] 8 [C] 9 [D] 21 Answer : B 299 Given the piece of code int a[50]; int *pa; pa=a; To access the 6th element of the array which of the following is incorrect? [A] *(a+5) [B] a[5] [C] pa[5] [D] *(*pa + 5) Answer : D 300 Identify the in correct expression [A] a=b=3=4; [B] a=b=c=d=0; [C] float a; int b=3.5; [D] int a; float b; a=b=3.5;
Answer : A 301 Regarding the scope of the variables; identify the incorrect statement automatic variables are automatically initialized [A] to 0 [B] static variables are automatically initialized to 0 [C] the address of a register variable is not accessible static variables cannot be initialized with any [D] expression Answer : A 302 cond 1?cond 2?cond 3?:exp 1:exp 2:exp 3:exp 4; is equivalent to which of the following? if cond 1 exp 1; else if cond 2 [A] exp 2; else if cond 3 exp 3; else exp 4; if cond 1 if cond 2 if cond 3 [B] exp 1; else exp 2; else exp 3; else exp 4; if cond 1 && cond 2 && cond 3 [C] exp 1 |exp 2|exp 3|exp 4; if cond 3 exp 1; [D] else if cond 2 exp 2; else if cond 3 exp 3; else exp 4; Answer : A 303 Which of the following is invalid [A] a+=b [B] a*=b [C] a>>=b [D] a**=b Answer : D 304 What is y value of the code if input x=10 if (x==10)
y=9; else if(x==9) y=7; else y=8; [A] 9 [B] 8 [C] 6 [D] 7 Answer : A 305 a=0; while(a<5) printf("%d\\n",a++); How many times does the loop occurs? [A] infinite [B] 5 [C] 4 [D] 6 Answer : A 306 How many times does the loop iterated? for (i=0;i=10;i+=2) printf("Hi\\n"); [A] 10 [B] 2 [C] 5 [D] None of these Answer : D 307 What is incorrect among the following A recursive function [A] calls itself [B] is equivalent to a loop [C] has a termination condition [D] does not have a return value at all Answer : C 308 Consider the following program main() {unsigned int i=10; while(i>=0){ printf("%u",i) i--;} } How many times the loop will get executed [A] 10
[B] 9 [C] 11 [D] infinite Answer : D 309 Pick out the add one out [A] malloc() [B] calloc() [C] free() [D] realloc() Answer : D 310 Consider the following program main(){ int a[5]={1,3,6,7,0}; int *b; b=&a[2]; } The value of b[-1] is [A] 1 [B] 3 [C] -6 [D] none Answer : B 311 # define prod(a,b)=a*b main(){ int x=2; int y=3; printf("%d",prod(x+2,y-10)); } The output of the program is [A] 8 [B] 6 [C] 7 [D] None Answer : D 312 Consider the following program segment int n,sum=1; switch(n){ case 2:sum=sum+2; case 3:sum*=2; break; default:sum=0;} If n=2, what is the value of sum [A] 0 [B] 6
[C] 3 [D] None of these Answer : B 313 Identify the incorrect one 1.if(c=1) 2.if(c!=3) 3.if(a<B)THEN 4.if(c==1) [A] 1 only [B] 1&3 [C] 3 only [D] All of the above Answer : A 314 The format specified for hexa decimal is [A] %d [B] %o [C] %x [D] %u Answer : A 315 Find the output of the following program main(){ int x=5, *p; p=&x printf("%d",++*p); } [A] 5 [B] 6 [C] 0 [D] none of these Answer : B 316 Consider the following C code main(){ int i=3,x; while(i>0){ x=func(i); i--; } int func(int n){ static sum=0; sum=sum+n; return(sum);} The final value of x is [A] 6 [B] 8
[C] 1 [D] 3 Answer : A 317 int *a[5] refers to [A] array of pointers [B] pointer to an array [C] pointer to a pointer [D] none of these Answer : A 318 Which of the following statements is incorrect typedef struct new{ int n1; [A] char n2; } DATA; typedef struct { [B] int n3; char *n4;}ICE; typedef union{ int n5; [C] float n6;} UDT; #typedef union { [D] int n7; float n8;} TUDAT; Answer : D 319 What will be the result of executing following program? main { char *x="new"; char *y="dictionary"; char *t; void swap (char * , char *); swap (x,y); printf("(%s, %s)",x,y); char *t; t=x; x=y; y=t; printf("-(%s, %s)",x,y); } void swap (char *x,char *y) { char *t; y=x; x=y; y=t;
(New, Dictionary)-(New, Dictionary) (Dictionary, New)-(New, Dictionary) (New, Dictionary)-(Dictionary, New) (Dictionary, New)-(Dictionary, New)
320 If a directory contains public files (can be valid and used by any one ) which should not be altered ,the most liberal permissions that can be given to the directory is [A] 755 [B] 777 [C] 757 [D] 775 Answer : A 321 What would the following program results in main() { char p[]="string"; char t; int i,j; for(i=0,j=strlen(p);i<J;I++) { t=p[i]; p[i]=p[j-i]; p[j-i]=t; } printf("%s",p); } [A] Will print string Will not print anything since p will be pointing to [B] a null string [C] Will print gstrin [D] Will result in a complication error Answer : C 322 What will be the result of executing the following statement? int i=10; printf("%d %d %d",i,++i,i++); [A] 10 11 12 [B] 10 11 11 [C] result is OS dependent [D] result is compiler dependent Answer : D
323 What does extern means in a function declaration? [A] The function has global scope [B] The function need not be defined [C] Nothing really The function has local scope only to the file it is [D] defined in Answer : C 324 What will be result of the following program? main() { void f(int,int); int i=10; f(i,i++); } void f(int i,int j) { if(i>50) return; i+=j; f(i,j); printf("%d,",i); } [A] 85,53,32,21 [B] 21,32,53,85 [C] 32,21,11,10 [D] None of the above Answer : D 325 What will be the result of the following segment of the program? main() { char *s="hello world"; int i=7; printf("%s",s); } [A] syntax error [B] hello world [C] hello [D] world Answer : B 326 What will be the result of the following program? main()
{ int a,b; printf("enter two numbers :"); scanf("%d%d",a,b); printf("%d+%d=%d",a,b,a+b); } [A] run successful and prints result [B] compiled but with warnings [C] will generate run time error /core dump [D] none Answer : C 327 What is the size of 'q'in the following program? union{ int x; char y; struct { char x; char y; int xy;}p; }q; [A] 11 [B] 6 [C] 4 [D] 5 Answer : B 328 What will be the result of the following program? main() { char *x="String"; char y[] = "add"; char *z; z=(char *) malloc(sizeof(x)+sizeof(y)=1); strcpy(z,y); strcat(z,y); printf("%s+%s=%s",y,x,z); } [A] Add+string=Add string [B] syntax error during compilation [C] run time error/core dump [D] None Answer : D 329 enum number { a=-1, b= 4,c,d,e} what is the value of e ?
7 4 5 3
330 Result of the following program is main() { int i=0; for(i=0;i<20;i++) { switch(i) case 0:i+=5; case 1:i+=2; case 5:i+=5; default i+=4; break;} printf("%d,",i); } } [A] 0,5,9,13,17 [B] 5,9,13,17 [C] 12,17,22 [D] 16,21 Answer : D 331 What is the result main() { char c=-64; int i=-32 unsigned int u =-16; if(c>i){ printf("pass1,"); if(c printf("pass2"); else printf("Fail2"); } else printf("Fail1); if(i printf("pass2"); else printf("Fail2")
332 main() { char *p1="name"; char *p2; p2=(char*)malloc(20); while(*p2++ = *p1++); printf("%s\n",p2); } What is the out put? [A] empty string. [B] name [C] amemee [D] compilation error Answer : C 333 main() { int x=20,y=35; x=y++ + x++; y= ++y + ++x; printf("%d%d\n",x,y); } the program prints [A] 57, 94 [B] 56,57 [C] 21,56 [D] error Answer : A 334 main() { int x=5; printf("%d%d%d\n",x,x<<2,x>>2); } The out put of the above program is [A] 5, 20,16 [B] 3,20,4 [C] 5,10,16 [D] compilation error
Answer : A 335 #define swap(a,b) a=a+b;b=a-b;a=a-b; main() { int x=5;y=10; swap1(x,y); printf("%d %d\n",x,y); swap2(x,y); printf("%d %d\n",x,y); } int swap2(int a, int b) { int temp; temp=a; a=b; b=temp; return 0; } What is the out put? [A] 10, 5 [B] 2, 10 [C] 15, 10 [D] 10, 20 Answer : A 336 main() { char *ptr = " Ramco Systems" (*ptr)++; printf("%s\n",ptr); ptr++; printf("%s\n",ptr); } What is the out put? Samco Systems [A] amco systems Ramco Systems [B] SystemRamco [C] Compilation error [D] Prints nothing Answer : A 337 main() { char s1[]="Ramco"; char s2[]= "systems";
printf("%s",s1); } What is the out put? Compilation error giving that it can not modified [A] L value [B] Ramcosystems [C] Ramco [D] None Answer : C 338 main() { char *p1; char *p2; p1=(char *)malloc(25); p2=(char *)malloc(25); strcpy(p1,"Ramco"); strcpy(p2,"systems"); strcat(p1,p2); printf("%s",p1); } What is the out put? [A] Ramcosystems [B] Ramco [C] systems [D] compilation error Answer : A 339 int x; main() { int x=10; x++; change_value(x); x++; modify_value(); printf("First output:%d\n",x); x++; change_value(x); printf("secpnd output:%d\n",x); modify_value(); printf("Third output:%d\n",x); } modify_value() {
return(x+=10); } change_value() { return(x+=1); } What is the out put? [A] 12, 1 , 1 [B] 1, 1, 1 [C] 10,12,14 [D] 10, 11, 12 Answer : A 340 main() { int x=10;y=15; x = x++; y = ++y; printf("%d %d\n",x,y); } What it prints? [A] 12,11 [B] compilation error [C] 5, 11 [D] 11, 16 Answer : D 341 main() { int a=0; if(a==0) printf("Ramco Systems\n"); printf("Ramco Systems\n"); } What is the out put of above program? [A] Only one time "Ramco Systems" will be printed [B] Infinite times it prints the same string [C] Compilation error [D] None Answer : A 342 int a=2,b=3,c=4; printf("a=%d,b=%d\n",a,b,c); What is the out put? [A] 3,4 [B] 2,3,4 [C] 2,3
[D] 2 Answer : C 343 for(i=1;i<10;++i,printf("%d",i));+[A] Compilation error [B] Run successfully [C] Compile with warnings [D] None Answer : A 344 Whole logic is given in function s but they are working properly. The main logic is char *string; string=malloc(5*sizeof(char)); strcpy(string,"Hello"); printf("%s",string); /* func to print */ [A] Compilation error [B] Hello [C] Hello with null characters [D] None Answer : B 345 In a system integer takes 3bytes and char takes 1byte struct something{ int a; char b[4]; }; Size of struct something is? [A] 7 bytes [B] 3 bytes [C] 6 bytes [D] 13 bytes Answer : A 346 typedef struct {char *; nodeptr next; } * nodeptr ; What does nodeptr stand for? [A] variable of the structure type [B] pointer to the structure [C] termination of the structure [D] None Answer : B 347 struct list{
int x; struct list *next; }*head; the struct head.x =100 Is the above assignment to pointer is ? [A] Wrong [B] Right [C] compile successfully [D] None Answer : A 348 What is the output of the following? int i; i=1; i=i+2*i++; printf(%d,i); [A] 3 [B] 2 [C] 4 [D] 6 Answer : C 349 FILE *fp1,*fp2; fp1=fopen("one","w") fp2=fopen("one","w") fputc('A',fp1) fputc('B',fp2) fclose(fp1) fclose(fp2) } Find the Error, If Any? [A] No error. But It will over writes on same file [B] Error in pointer declaration [C] Runs successfully [D] None Answer : B 350 What is the output(s) for the following? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye"); } main() { char *f();
printf("%c",*f()='A'); } [A] 65 [B] A [C] Good bye [D] None Answer : B 351 #define MAX(x,y) (x)>(y)?(x):(y) {int i=10; j=5; k=0; k=MAX(i++,++j); printf(%d %d %d %d,i,j,k); } What is the out put of the program? [A] 11,6,10 [B] 12,6,11 [C] 10,5,0 [D] 11,6,11 Answer : A 352 a=10; b=5; c=3; d=3; if(a<B)&&(C=D++) printf(%d %d %d %d a,b,c,d); else printf("%d %d %d %d a,b,c,d); The out put of the following program is? [A] 11,3,5,4 [B] 10,5,3,3 [C] 12,5,3,3 [D] 10,6,5,3 Answer : B 353 main() { int i = 10; printf(" %d %d %d \n", ++i, i++, ++i); } What is the out put? [A] 13,11,11 [B] 11,11,13 [C] 10,11,12 [D] 10,12,13 Answer : A
354 #include main() { int *p, *c,i; i = 5; p = (int*) (malloc(sizeof(i))); printf("\n%d",*p); *p = 10; printf("\n%d %d",i,*p); c = (int*) calloc(2); printf("\n%d\n",*c); } What is the out put? [A] 5,2,10 [B] 10,10,0 [C] 10,5,10,0 [D] 0,10,10,10 Answer : C 355 #include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); } What is the out put? [A] 10, 11,100,101 [B] 10,11,12,13 [C] 100,101,102,103 [D] compilation error Answer : B 356 main() { int a=10,b=20; b=a>=5?100:200; printf("%d\n",b); } What is the out put? [A] 20 [B] 200 [C] 10 [D] 100 Answer : D
357 #define PRINT(int) printf("int = %d ",int) main() { int x,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3; PRINT(x); y>>=3; PRINT(y); } What is the out put? [A] 9,3,0 [B] 0,3,0 [C] 27,3,3 [D] 27,9,3 Answer : B 358 #include main() { char s[] = "Bouquets and Brickbats"; printf("\n%c, ",*(&s[2])); printf("%s, ",s+5); printf("\n%s",s); printf("\n%c",*(s+2)); } What is the out put? [A] compilation error [B] Run successfully and prints [C] u, u [D] None Answer : B 359 main() { char *p = "Hello world!"; p[0] = 'H'; printf("%s",p); } What is the out put ? [A] H [B] Hello world [C] Compilation error [D] Abnormal termination error Answer : B
360 What is the output of the following code main() { char str[20]; printf("Enter a string: "); scanf("%[^a]",str); printf("%[^a]",str); } [A] compilation error [B] prints Enter a string & %[^a] [C] prints str [D] run time error Answer : B 361 main() { int a[2]={4,5}; a[0,1]=45; printf("%d%d",a[0],a[1]); } [A] 4,5 [B] 4 [C] 3 [D] None Answer : A 362 In the following C program code int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+zap(n-1); } Then the call zap(6) gives the values of zap [A] 8 [B] 9 [C] 6 [D] 12 Answer : B 363 The out put of the program is main() { char a='\123' printf ("%c \n",a); return 0; }
364 What is the out put? n=7623 { temp=/10; result=temp*10+ result; n=n/10 printf(%d\n,result); } [A] 3267 [B] 7623 [C] 8470 [D] 8890 Answer : C 365 What would be the output of the following program? #include main() { extern int a; printf("%d",a);; } int a=20; [A] 20 [B] 0 [C] garbage value [D] error!! Answer : D 366 What would be the output of the following program? main() { int a[5]={2,3}; printf("\n %d %d %d",a[2],a[3],a[4]); } [A] Garbage value [B] 233 [C] 322 [D] 000 Answer : D 367 What would be the output of the following program? main()
{ inti=-3,j=2,k=0,m; m=++i&&++j||++k; printf("\n %d %d %d %d",i,j,k,m); } [A] -2 3 0 1 [B] -3 2 0 1 [C] -2 3 1 1 [D] error Answer : A 368 What would be the output of the following program? main() { int a,b; a=sumdig(123); b=sumdig(123); printf("%d %d",a,b); } sumdig(int n) { static int s=0; int d; if(n!=0) { d=n%10; n=(n-d)/10; s=s+d; sumdig(n); } else return(s); } [A] 12; 6 [B] 6; 12 [C] 3; 15 [D] error Answer : B 369 What would be the output of the following program? #define CUBE(x) (x*x*x) main() { int a,b=3; a=CUBE(b++); printf("\n %d %d",a,b); }
64 4 27 4 27 6 64 6
370 What would be the output of the following program? main() { const int x=get(); printf("%d",x); } get() { return(20); } [A] 20 [B] garbage value [C] error [D] 0 Answer : A 371 A function has this prototype void f1(int **x), How will you call this function? int **a; [A] f1(a) int a; [B] f1(&a); int *a; [C] f1(&a); int a=5; [D] f1(&&a) Answer : C 372 point out the error, if any, in the for loop main() { int l=1; for(;;) { printf("%d",l++); if(l>10) break; } } [A] The condition in the for loop is a must
[B] The two semicolons should be dropped [C] The for loop should be replaced by awhile loop [D] No error Answer : D 373 Can the following piece of code be executed? int main(void) { char strA[10]="compile",strB[10]; my_strcpy(strB,strA); puts(strB); } char * my_strcpy(char *destination,char *source) { char *p=destination; while(*source!='\0') { *p++=*source++; } *p='\0'; return destination; } Compilation will only give a warning but will [A] proceed to execute & will display "compile" The compilation error char *(char *,char *) differs [B] in levels of indirection from 'int()' will occur [C] Yes & it will print compile on the screen [D] None of the above Answer : C 374 What would be the output of the following program #include main() { char str[5]="fast"; static char *ptr_to_array = str; printf("%s",ptr_to_array); } Compilation will only give a warning but will [A] proceed to execute & will display "fast" [B] display "fast" on screen [C] will give a compilation error [D] none of the above Answer : C
375 What would be the output of the following program? main() { int num,*p; num=5; p=# printf("%d",*p); } [A] 6 [B] 5 [C] junk value [D] compilation error Answer : B 376 What would be the output of the following program? main() { int a[3]={2,3,4}; char *p; p=a; p=(char *)((int *)p+1); printf("%d",p); } [A] 2 [B] 0 [C] junk value [D] 3 Answer : C 377 What would be the output of the following program main() { int i=10; fn(i); printf("%d",i); } fn(int i) { return ++i; } [A] 10 [B] 11 [C] 12 [D] Compilation error Answer : D
378 What will be the value of i & j after the loop is executed? for(i=0,j=0;i<5,j<25;i++,j++) [A] i=4,j= 24 [B] i=24,j= 24 [C] i=25,j= 25 [D] i=5,j=25 Answer : B 379 What would be the output of the following program? main() { int i,j; i=10; j=sizeof(++i); printf("%d",i); } [A] 11 [B] 10 [C] 4 [D] compilation error Answer : B 380 What would be the output of the following program? main() { int i=7; printf("%d\n",i++*i++); } [A] 49 [B] 56 [C] 72 [D] Compilation error Answer : B 381 What will the printf print? main() { char *p,*f(); p=f(); printf("f() returns:%s\n",p); } char *f() { char result[80]; strcpy(result,"anything will do"); return (result);
f() returns: anything will do f() returns 0 compilation error The printf statement is not going to be executed
382 How many times the following program would print 'Jamboree'? main() { printf("\n Jamboree"); main(); } [A] infinite number of times [B] 32767 times [C] 65535 times [D] till the stack does not overflow Answer : A 383 Notice the error in the default statement in the code snippet below. Will it give a compilation error? main() { int a=10,j; j=fn(a); switch(j) { case 30: printf("the value is 30"); break; case 50: printf("the value is 50"); break; default: printf("the value is not 30 or 50"); } } fn(int a) { return (++a); } [A] Will display "the value is 30" [B] Will display "The value is not 30 or 50" [C] Yes a compilation error would happen No compilation errors but there will be no output [D] on the screen Answer : B
384 What would be the output of the following program? main() { struct emp { char name[20]; int age; float sal; }; struct emp e = {"tiger"}; printf("\n %d %f",e.age,e.sal); } [A] 0 0.000000 [B] Garbage values [C] Error [D] none of the above Answer : A 385 Which holds true for the following statement? class c: public A, public B To member in class A, B should not have same [A] name To member in class A, C should not have same [B] name [C] both a& b [D] none Answer : A 386 struct x { int i; char c; } union y{ struct x a; double d; }; printf("%d",sizeof(union y)); What is the out put? [A] 8 [B] 5 [C] 4 [D] 1 Answer : A 387 struct x{
char c1; char c2; int i; short int j; }; struct y{ short int j; char c1; char c2; int i; }; printf("%d %d",size of (struct x),size of (struct y)); What is the out put? [A] 6,6 [B] 88 [C] 12 8 [D] 8 12 Answer : A 388 enum x {a=1,b,c,d,f=60,y}; printf("%d",y); What is the value of y? [A] 5 [B] 61 [C] 6 [D] 7 Answer : B 389 #include void main(){ { # define x 10 } printf("%d \n",++x); } What is the out put? [A] 11 [B] 10 [C] compile error [D] runtime error Answer : C 390 #include void main() { int k=2,j=3,p=0;
p=(k,j,k); printf("%d\n",p); } What is the value of p? [A] 2 [B] error [C] 0 [D] 3 Answer : A 391 How to typedef a function pointer which takes int as a parameter and return an int [A] Is not possible [B] typedef int *funcptr int; [C] typedef int * funcptr( int); [D] typedef int (*funcptr)(int); Answer : D 392 #include void main() { int k=10; k<<=1; printf("%d\n",k); } What is the out put? [A] 10 [B] 0 [C] 20 [D] compilation error Answer : C 393 #include void main() { int i=-10; for(;i;printf("%d\n",i++)); } What it prints? [A] error [B] prints -10 to -1 [C] infinite loop [D] does not print anything Answer : B 394 #include void main()
{ int i=65,j=0; for(;j<26; i++,j++){ printf("%s\n", i); } } What is the out put? [A] compilation Error [B] prints A to Z [C] prints a to z [D] runtime error Answer : B 395 #include void main() { unsigned int i=-1; printf("%d\n",i); printf("%u\n",i*-1); } What is the out put? [A] runtime error [B] compilation error [C] prints -1 to 1 [D] prints 1 and 1 Answer : C 396 #include void main() { int **i; int *j=0; i=&j; if (NULL != i&& NULL != *i){ printf("I am here"); } } What is the out put? [A] prints I am here [B] does not print anything [C] compilation error [D] runtime error Answer : B 397 #include void main()
{ int *j=(int *)0x1000; printf("%p",j); } What is the out put? [A] prints-1000 [B] runtime error [C] compilation error [D] none of the above Answer : D 398 #include void main() { int a[2][2]={{2},{3}}; printf("%d",a[0][0]); printf("%d",a[0][1]); printf("%d",a[1][0]); printf("%d",a[1][1]); } What is the out put? [A] 23 00 [B] 20 00 [C] 00 30 [D] 20 30 Answer : D 399 #include void main(int x) { printf("%d",x) ; } if the name of the executable file is abc and the command line is given as abc xyz what is the output [A] Compilation error [B] 1 [C] 2 [D] Undefined Answer : C 400 #include void main(int argc) { char a[]={'1','2','3',0,'1','2','3'}; printf(a); }
What is the out put? [A] Compilation error [B] 123 [C] 123 123 [D] 1230123 Answer : B 401 #include void func(int *x) { x=(int *) malloc(sizeof(int)); printf("in func: %p\n",x); } void main(int argc) { int **pp; int *p; pp=(int **) malloc(sizeof(int *)); p=(int *) malloc(sizeof((int)); *pp=p; printf("first:%p \n",*pp); func(*pp); printf("last %p \n",*pp); } Assuming the p is equal to 1000 and x is equal to 2000 after malloc call What is the out put? [A] 1000, 2000, 1000 [B] 1000, 2000, 2000 [C] 1000, 1000, 1000 [D] 2000, 2000, 2000 Answer : A 402 #include #define const const void main(int argc) { const int x=0; } What is the out put? [A] Compilation error [B] Runs fine [C] Runtime error [D] None of these Answer : B 403 #include
void main(int argc) { int d=1234.5678; printf("%d",d); } What is the out put? [A] error [B] 1234.5678 [C] 1234 [D] 1235 Answer : C 404 #include void main(int argc) { int a[]={5,6}; printf("%d",a[1.6]); } What is the out put? [A] 5 [B] runtime error [C] compilation error [D] 6 Answer : D 405 #include struct x { int i=0; /*line A*/ }; void main(int argc) { struct x y; /*line B*/ } The above program shows? [A] error due to B [B] no problem with option A and B [C] error somewhere other than line A and B [D] error due to line A Answer : D 406 #include void main(int arg c) { int x=1111; printf("%d",!x);
} What is the out put? [A] prints 1111 [B] compilation error [C] prints 0 [D] is not a valid option Answer : C 407 struct { int len; char *str }*p; ++p -> len; The above program shows? [A] increments p [B] increments len [C] compilation error [D] nothing happens with either of p and len Answer : B 408 int i=10; The above statement shows? [A] declaration [B] definition [C] both a & b [D] none Answer : C 409 #include void main(int arg c) { char a[]=abcdefghijklmnopqrstuvwxyz; printf(%d,sizeof(a)); } What is the out put? [A] 25 [B] 26 [C] 27 [D] 28 Answer : C 410 #include void main(int arg c) { char a[]=abcdefghijklmnopqrstuvwxyz; char *p=a; printf(%d,strlen(p));
p+=10; printf(%d,strlen(a)); } What it prints? [A] 26 26 [B] 26 16 [C] Compilation error [D] 16 26 Answer : A 411 If the following program (myprog)is run from the command line as myprog 1 2 3 What would be the output? main(int argc , char *argv[]) { int i ,j=0; for (i=0;i<ARGC;I++) j=j+atoi(argv[i]); printf(%d.j); } [A] 123 [B] 6 [C] Error [D] 0 Answer : B 412 When pointers declared initialized to [A] null [B] newly allocated memory [C] nothing, its random [D] none of the above Answer : C 413 What is the output of the following code? #include void main() { printf("%d",printf(" hello world ")); } [A] 13 [B] hello world 13 [C] hello world [D] error Answer : B 414 What is the output of the following code, assuming that the array begins at location 5364875?
#include7 void main() { int a[2][3][4]={ {2,1,4,3,6,5,8,7,0,9,2,2} {1,2,3,4,5,6,7,8,9,0,1,2} }; printf("%u %u %u %u",a,*a,**a,***a); } [A] 5364875,5364876,5364877,5364878 [B] 5364875,5364876,5364877,2 [C] 5364875,5364875,5364876,5364876 [D] 5364875,5364875,5364875,2 Answer : D 415 enum day { jan = 1 ,feb=4, april, may}; What is the value of may? [A] 4 [B] 5 [C] 6 [D] 11 Answer : C 416 main () { int x,j,k; j=k=6;x=2; x=j*k; printf("%d", x); } What is the value of x? [A] 6 [B] 2 [C] 36 [D] 12 Answer : C 417 fn f(x) { if(x<=0) return; else f(x-1)+x; } The value of fn(5)? [A] 0 [B] 3 [C] 2
[D] 15 Answer : D 418 int i=20,j,k=0; for(j=1;j { k+=j<10?4:3; } printf("%d", k); What it prints? [A] 81 [B] 100 [C] 4 [D] 3 Answer : C 419 int i =10; main() { int i =20,n; for(n=0;n<=i;) { int i=10; i++; } printf("%d", i); What is the value of i? } [A] 10 [B] 20 [C] 30 [D] 40 Answer : B 420 f=(x>y)?x:y The above statement shows? [A] f points to max of x and y [B] f points to min of x and y [C] error [D] none. Answer : A 421 if x is even, then (x%2)=0 x &1 !=1 x! ( some stuff is there) The above program statements show?
only two are correct three are correct only one is correct none
422 Given the following c program func() { static int i = 10; printf("%d",i); i++; } What is the value of i if the function is called twice? [A] 10 [B] 20 [C] 11 [D] 12 Answer : C 423 Given the following c program func(int *i, int*j) {*i=*i * *i; *j=*j* *j; } main() { int i = 5, j = 2; func(&i,&j); printf("%d %d", i, j);} What is the output? [A] 100 [B] 1,104 [C] 10, 4 [D] compilation error Answer : C 424 For the following C program void insert(key,r) typekey key,data array r; {extern int n; if(n>=max) /*error table if full */ else r[n++].k=key; } This on executing, enables a [A] Basic sequential search [B] Binary search
[C] Interpolation search [D] None Answer : B 425 Find the output of the following C program? void f(char *p) {p=(char *) malloc(6); strcpy(p,"hello"); } void main( ) {char *P="bye"; f(p); printf("%s',p); } [A] hello [B] bye [C] hellobye [D] error Answer : B 426 For the following C program int x(char *a) {a=(char *) malloc(10*sizeof(char)); *a="hello"; } main() {char *a="new"; x(a); printf("%s",a); } The output is [A] hello [B] new [C] hello new [D] Run time error Answer : B 427 proc() { static i=10; printf("%d",i); i++; } If this proc() is called second time, what is the o/p [A] 10 [B] 12 [C] 20
[D] 11 Answer : D 428 int arr[] = {1,2,3,4}; int *ptr=arr; *(arr+3) = *++ptr + *ptr++; The Final contents of arr[] [A] {3,4} [B] {2,3,4} [C] {1,2,3,4} [D] {1,2} Answer : C 429 f(char *p) { p=(char *)malloc(sizeof(6)); strcpy(p,"HELLO"); } main() { char *p="BYE"; f(p); printf("%s",p); } What is the o/p? [A] HELLO [B] BYE [C] HELLOBYE [D] BYEHELLO Answer : B 430 If "AaBbCc" is passed to the char char x(*a) { a[0]?x(a+1):1; printf("%c",a[0]); return 1; } What will be the output? [A] AaBbC [B] CcBbAa [C] Aa [D] Compilation error Answer : B 431 f(*p) {
p=(char *)malloc(6); p="hello"; return; } main() { char *p="bye"; f(p); printf("%s",p); } What is the o/p? [A] hello [B] hellobye [C] bye [D] byehello Answer : C 432 Global variables declared in different files are at [A] Compile time [B] Loading time [C] Linking time [D] Execution time Answer : B 433 sizeof(int) [A] [B] [C] [D] Answer : B Always 2 bytes Depends on compiler that is being used Always 32 bits Can't tell
434 Which one will over flow given two programs? prog 1: prog2: main() main() { { int fact; int i,n=5,fact=0 long int x; for(i=1;i<=n;i++) fact=factorial(x); fact=fact*i; } } int factorial(long int x) { if(x>1) return(x*factorial(x-1); } [A] program 1; [B] program 2;
[C] both 1 &2 [D] none Answer : A 435 main(){ char str[5]="hello"; char NULL; if(str==NULL) printf("string is null"); else printf("string is not null"); } What is out put of the program? [A] string is null [B] string is not null [C] error in program [D] it executes but prints nothing Answer : B 436 void f(int *p){ static val=100; val=&p; } main(){ int a=10; printf("%d ",a); f(&a); printf("%d ",a); } What will be out put? [A] 10 [B] 10, 20 [C] 10, 10 [D] 100 Answer : A 437 struct a{ int x; float y; char c[10]; } union b{ int x; float y; char c[10]; } Which is true? [A] sizeof(a)!=sizeof(b);
[B] sizeof(a)=sizeof(b); [C] compilation error [D] run time error Answer : A 438 # define f(a,b) a+b #defiune g(c,d) c*d Find the value of f(4,g(5,6))? [A] 26 [B] 51 [C] 34 [D] 36 Answer : C 439 main() { char a[10]="hello"; strcpy(a,'\0'); printf("%s",a); } What is the out put of the program? [A] string is null [B] hello [C] program error [D] garbage value Answer : A 440 int fn(int a) { a=+b; //some stuff } main() { x=fn(a); y=&fn; What are x & y types? x is int & y is pointer to a function which takes [A] integer value [B] x is pointer & y is integer constant to function [C] x is pointer to function only [D] y is integer to point the function Answer : A 441 enum number { a=-1, b= 4,c,d,e}; What is the value of e ?
7 4 5 15
442 Output of the following program is main() {int i=0; for(i=0;i<20;i++) {switch(i){ case 0:i+=5; case 1:i+=2; case 5:i+=5; default i+=4; break;} printf("%d,",i); } [A] 0,5,9,13,17 [B] 5,9,13,17 [C] 12,17,22 [D] 16,21 Answer : D 443 What is the out put in the following program? main() {char c=-64; int i=-32 unsigned int u =-16; if(c>i) {printf("pass1,"); if(c printf("pass2"); else printf("Fail2"); } else printf("Fail1); if(i printf("pass2"); else printf("Fail2") } [A] Pass1,Pass2 [B] Pass1,Fail2 [C] Fail1,Pass2
[D] Fail1,Fail2 Answer : C 444 What will the following program do? void main() { int i; char a[]="String"; char *p="New String"; char *Temp; Temp=a; a=malloc(strlen(p) + 1); strcpy(a,p); //Line number:9// p = malloc(strlen(Temp) + 1); strcpy(p,Temp); printf("(%s, %s)",a,p); free(p); free(a); } //Line number 15// Swap contents of p & a and print:(New string, [A] string) [B] Generate compilation error in line number 8 [C] Generate compilation error in line number 5 [D] Generate compilation error in line number 7 Answer : B 445 In the following code segment what will be the result of the function, value of x , value of y? {unsigned int x=-1; int y; y = ~0; if(x == y) printf("same"); else printf("not same"); } [A] same, MAXINT, -1 [B] not same, MAXINT, -MAXINT [C] same , MAXUNIT, -1 [D] same, MAXUNIT, MAXUNIT Answer : A 446 What will be the result of the following program? char *gxxx() {static char xxx[1024]; return xxx; }
main() {char *g="string"; strcpy(gxxx(),g); g = gxxx(); strcpy(g,"oldstring"); printf("The string is : %s",gxxx()); } [A] The string is : string [B] The string is :Oldstring [C] Run time error/Core dump [D] Syntax error during compilation Answer : B 447 What will be result of the following program? void myalloc(char *x, int n) {x= (char *)malloc(n*sizeof(char)); memset(x,\0,n*sizeof(char)); } main() {char *g="String"; myalloc(g,20); strcpy(g,"Oldstring"); printf("The string is %s",g); } [A] The string is : String [B] Run time error/Core dump [C] The string is : Oldstring [D] Syntax error during compilation Answer : C 448 What will be the result of the following program? main() {char p[]="String"; int x=0; if(p=="String") {printf("Pass 1"); if(p[sizeof(p)-2]=='g') printf("Pass 2"); else printf("Fail 2"); } else { printf("Fail 1"); if(p[sizeof(p)-2]=='g') printf("Pass 2");
else printf("Fail 2"); } } [A] Pass 1, Pass 2 [B] Fail 1, Fail 2 [C] Pass 1, Fail 2 [D] Fail 1, Pass 2 Answer : D 449 The redirection operators > and >> [A] do the same function [B] differ : > overwrites, while >> appends differ : > is used for input while >> is used for [C] output differ : > write to any file while >> write only to [D] standard output Answer : B 450 int i=7; printf(%d,i++*i++); what is the answer ? [A] 56 [B] 49 [C] 64 [D] none Answer : A 451 struct code { int i; int t; } /* some code */ main() { } What is wrong ? [A] Semicolon is missing after structure declaration [B] No wrong [C] mian cannot be after struct [D] none Answer : A 452 c++ supports [A] pass by value only [B] pass by name
[C] pass by pointer [D] pass by value and by reference Answer : D 453 What is the error ? struct { int item; int x;} main(){ int y=4; return y;} [A] absence of semicolon [B] main() cannot be after structure [C] declaration of same data type in structure [D] none Answer : A 454 Which of the following is false regarding protected members? [A] can be accessed by friend functions of the child [B] can be accessed by friends of child's child [C] usually inaccessible by friends of class child has the ability to convert child ptr to base [D] ptr Answer : C 455 What is the output of the following void main() { int a=5,b=10; int &ref1=a,&ref2=b; ref1=ref2; ++ ref1; ++ ref2; cout<<A<<B< } value of a and b [A] 5 and 12 [B] 7 and 10 [C] 11 and 11 [D] none of the above Answer : C 456 What is the output of the following program listing? #include void main ( ) { int x,y: y=5; x=func(y++); printf(%s\n,(x==5)?true;false); } int func(int z)
{ if (z== 6) return 5; else return 6;} [A] [B] [C] [D] Answer : B
457 What is the output of the following program? #include main( ) { int x,y=10; x=4; y=fact(x); printf(%d\n,y); } unsigned int fact(int x) { return(x*fact(x-1));} [A] 24 [B] 10 [C] 4 [D] None Answer : D 458 main() { char str[]="Geneius"; print (str); } print(char *s) { if(*s) print(++s); printf("%c",*s); } What is the out put? [A] suiene [B] Genuine [C] Compilation error [D] None Answer : A 459 What is an array? contiguous allocation of memory occupied by [A] similar data types
contiguous allocation of memory occupied by different data types de allocation of memory of similar data types none
460 Consider the following program segment int n, sum=5; switch(n) { case 2:sum=sum-2; case 3:sum*=5; break; default:sum=0; } If n=2, what is the value of the sum? [A] 0 [B] 15 [C] 3 [D] None of these. Answer : B 461 Find the error? main() {void fun(); fun(); } void fun() { int i=10; if(i<10) return 2.0; return 3.0; } [A] no error but warning [B] cannot be compiled [C] multiple return statements [D] run successfully Answer : A 462 int a=9,b=5,c=3,d; d=(b-c)<(c-a) ? a : b; print (d)? [A] 3 [B] 5
[C] 9 [D] None Answer : B 463 Consider the prog and select answer #include void main ( ) { int k=4,j=0: switch (k) { case 3: j=300; case 4: j=400: case 5: j=500; } printf (%d\n,j); } What is the out put? [A] 300 [B] 400 [C] 500 [D] 0 Answer : C 464 Consider the following statements Statement 1 A union is an object consisting of a sequence of named members of various types Statement 2 A structure is a object that contains different types, any one of the several members of various types Statement 3: C is a compiled as well as an interpreted language Statement 4: It is impossible to declare a structure or union containing an instance several members of various types [A] all the statements are correct [B] except 4 all are correct [C] statement 3 is only correct [D] statement 1,3 are incorrect either 2 or 4 is correct Answer : D 465 consider the following program listing and select the output #include main ( ) { int a=010,sum=0,tracker: for(tracker=0;tracker<=a;tracker++) sum+=tracker; printf( %d\n,sum);} [A] 55
[B] 36 [C] 28 [D] n Answer : B 466 Spot the line numbers that are valid according to the ANSI C standards? Line 1: #include Line 2: void main() Line 3: { Line 4 : int *pia,ia; 5 : float *pafa,fa; 6 : ia=100; 7 : fa=12.05; 8 : *pfa=&ia; 9 : pfa=&ia; 10 : pia=pafa; 11 : fa=(float)*pia; 12 : fa=ia; 13: } [A] 8 and 9 [B] 9 and 10 [C] 8 and 10 [D] 10 and 11 Answer : A 467 What is the o/p of the follow program? #include main() { char char_arr[5]=ORACL; char c=E; printf(%s\n,strcat(char_arr,c)); } [A] ORACLE [B] ORACL [C] E [D] None Answer : A 468 consider the following program listing #include main() { int a[3]; int *i; a[0]=100;a[1]=200;a[2]=300;
i=a; printf(%d\n, ++*i); printf(%d\n, *++i); printf(%d\n, (*i)--); printf(%d\n, *i); } What is the o/p? [A] 101,200,200,199 [B] 200,201,201,100 [C] 101,200,199,199 [D] 200,201,300,301 Answer : A 469 Which of the following correctly declares My_var as a pointer to a function that returns an integer [A] int *My_Var(); [B] int *(My_Var()); [C] int (*)My_Var(); [D] int (*My_Var)(); Answer : D 470 Consider the follow pgm listing? Line 1: #include 2: void main() 3: { 4: int a=1; 5: const int c=2; 6: const int *p1=&c; 7: const int*p2=&a; 8: int *p3=&c; 9: int*p4=&a; 10:} What are the lines that cause compilation errors? [A] 7 [B] 8 [C] 6 and 7 [D] no errors Answer : B 471 What will be the o/p #include main() { int a[3]; int *x; int *y;
a[0]=0;a[1]=1;a[2]=2; x=a++; y=a; printf(%d %d\n, x,(++y)); } [A] 0,1 [B] 1,1 [C] error [D] 1,2 Answer : B 472 What is the procedure for swapping a,b(assume that a,b and tmp are of the same type? [A] tmp=a; a=b;b=temp; [B] a=a+b;b=a-b;a=a-b; [C] a=a-b;b=a+b;a=b-a; [D] all of the above Answer : A 473 const int MAX=10; main() { enum a {a,b,MAX}; print MAX; } What it prints? [A] 2 [B] 10 [C] 11 [D] prints Nothing Answer : A 474 void *p; What operation cannot be performed on p? arithmetic operation unless it is properly type [A] caste [B] increment operation [C] decrement operation [D] None Answer : A 475 char **p="Hello"; print p,*p,**p; What it prints? [A] Hello (null) [B] warning: suspicious pointer conversion [C] Cannot be compiled
[D] None Answer : A 476 main() { printf("Genius %d",fun(123)); } fun(int n) { return (printf("%d",n)); } What is the out put? [A] 123genius3 [B] Compilation errors [C] 123 [D] None Answer : A 477 main() { int i=4; fun(i=i/4); print i; } fun(int i) { return i/2; } What it prints? [A] 1 [B] 4 [C] 2 [D] None Answer : A 478 Output of the following program is main() { int i=0; for(i=0;i<20;i++) { switch(i){ case 0: i+=5; case 1: i+=2; case 5:
i+=5; default: i+=4; break; } } } What is the out put? [A] 5,9,13,17 [B] 12,17,22 [C] 16,21 [D] Syntax error. Answer : C 479 What does the following function print? func(int i) { if(i%2) return 0; else return 1; } main() { int i=3; i=func(i); i=func(i); printf("%d",i); } [A] 3 [B] 1 [C] 0 [D] 2 Answer : B 480 What will be the result of the following program? char*g() { static char x[1024]; return x; } main() { char*g1="First String"; strcpy(g(),g1); g1=g(); strcpy(g1,"Second String"); printf("Answer is:%s", g());
Answer is: First String Answer is: Second String Run time Error/Core Dump None of these
481 Consider the following program main() { int a[5]={1,3,6,7,0}; int *b; b=&a[2]; } The value of b[-1] is [A] 1 [B] 3 [C] -6 [D] none Answer : B 482 Given a piece of code int x[10]; int *ab; ab=x; To access the 6th element of the array which of the following is incorrect? [A] *(x+5) [B] x[5] [C] ab[5] [D] *(*ab+5} Answer : D 483 enum number { a=-1, b=4, c,d,e,} what is the value of e? [A] 7 [B] 4 [C] 5 [D] 3 Answer : A 484 Find equivalent *(*(s+x)+y) ==> s[x][y] ? [A] content of s[x][y] [B] &(*s[x],s[y]) [C] (*s[x],*[y]) [D] None Answer : A
485 Find invalid statement [A] scanf("%d",a[2]); [B] scanf("%d",&a[2]); [C] scanf("%d",&a); [D] All of the above Answer : A 486 **main program: int i=foo(2), foo(int s) ; { if(!s) return s; else { int i=5; return i} } What is the out put of the program? [A] 5 [B] 4 [C] 0 [D] compilation error Answer : A 487 k=2, i=0,j=1; if(i0)&&(k=2) printf(k); if(i0|| k=0) printf(k); What is the out put? [A] compilation error [B] 0 [C] 2 ,2 [D] None Answer : C 488 main() { char ch; int count=0; while((ch = getch() != '\n') { while (ch == ' ') ch = getch(); while((ch!=' ') && (ch!='.')) { count++; ch=getch(); } }
What is the out put? [A] compilation error [B] prints11 [C] run successfully but print nothing [D] none Answer : C 489 main() { int i; for(i=0;i<3;i++) switch(i) { case 1: printf("%d",i); case 2 : printf("%d",i); default: printf("%d"i); } } What is the out put? [A] 011122 [B] 11201 [C] 0112233 [D] 012 Answer : A 490 What is the final value of i and how many times loop is executed? #include main() { int i, j, k, l, lc=0; printf("Enter the number string:<1234 567 >\n"); scanf("%2d%d%1d",&i,&j,&k); for(;k;k--,i++) for(l=0;l> printf("%d %d\n",i,l);} printf("LOOPS= %d\n", lc-1); } [A] i = 17, and loop is executed for 169 times [B] i=1,and loop is executed for infinite times [C] compilation error [D] none Answer : A 491 #include main() {
func(1); } func(int i){ static char *str[] ={ "One","Two","Three","Four"}; printf("%s\n",str[i++]); return; } What is the out put? [A] Two [B] One [C] Three [D] None Answer : A 492 #include main() { int i; for (i=1;i<100; i++) printf("%d %0x\n",i,i); } What are the out put values of i? i is from 1 to 99 for the first format,for the second [A] format 1to9, a to f, 10 to 19,1ato1f, 20 to 29, etc [B] compilation error [C] prints 1 to 99 [D] run time error Answer : A 493 #include main() { int facto(int n); int i,ans; printf("\n Enter a Number:"); scanf("%d",&i); ans = facto(i); printf("\factorial by recursion = %d\n", ans); } int factorial(int n) { if (n <= 1) return (1); else return ( n * factorial(n-1)); } What is the out put, if the input is 4
26 21 24 4
494 What is the output of the following problem? #include main(){ int j,ans; j = 4; ans = count(4); printf("%d\n",ans); } int count(int i) { if ( i < 0) return(i); else return( count(i-2) + count(i-1)); } [A] 0 [B] -1 [C] 1 [D] 4 Answer : B 495 swap(int x,y) { int temp; temp=x; x=y; y=temp; } main() { int x=2;y=3; swap(x,y); } After calling swap ,what are the values x& y? [A] 2, 3 [B] 3, 2 [C] Cannot be compiled [D] None Answer : B 496 Which of following operator can't be overloaded? [A] ==
[B] ++ [C] ?! [D] <= Answer : C 497 Static variable will be visible in [A] Function in which they are defined [B] Module in which they are defined [C] The entire program [D] None Answer : A 498 Which of the following is not true about C++ [A] Code removable [B] Encapsulation of data and code [C] Program easy maintenance [D] Program runs faster Answer : A 499 For the following C program struct { int x; int y; }abc; x cannot be accessed by the following 1)abc-->x; 2)abc[0]-->x; 3)abc.x; 4)(abc)-->x; [A] 1, 2, 3 [B] 2&3 [C] 1&2 [D] 1, 3, 4 Answer : B 500 Automatic variables are destroyed after fn. ends because [A] Stored in swap [B] Stored in stack and poped out after fn. returns [C] Stored in data area [D] Stored in disk Answer : B 501 Give the output of the following program struct XXX {int a=6; float b=4; char s;
}structure; size of (structure); [A] 2 bytes [B] 4 bytes [C] 1 bytes [D] 6 bytes Answer : B 502 Give a definition for a function which returns a array of pointers with argument of int* p=large(&a[ ],&[ ]); [A] int *large(int *x[ ],int *y[ ]){} p=large(*int[ ], *int [ ] [B] int *large(int &x[ ],int &y [ ]) [C] large(int *a, int *b) [D] None Answer : A 503 Give a function declaration with no arguments which refers a two dimensional array [A] double avg(int x[ ][n], , ); [B] double avg(x[ ][ ]); [C] int sum(x[ ],y[ ]); [D] none Answer : A 504 Give the output of the following program main() {char *s; s="hot java"; strcpy(s,"solaris java"); } [A] hotjava solaris java [B] solaris java [C] hot java [D] compilation error Answer : B 505 Give the output of the following program main() {char *p='a'; int *i=100/*p; } What will be the value of *i? [A] 0 [B] 1
[C] compilation error [D] 65 Answer : A 506 int i=9; switch(i) { printf("hello"); case 9 : printf("abc"); break; default : printf("def"); } } What would be the output? [A] hello [B] abc [C] def [D] compilation error Answer : B 507 int z[3]={1,2,3}; int *p=&z[1]; int x=*p++; printf("%d",x); What is the value of x? [A] 2 [B] 1 [C] 3 [D] 0 Answer : A 508 What is the output of the program given below? #include main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); } [A] Compilation error [B] Runs successfully & prints 1-127 [C] Run time error [D] Infinite loop Answer : B 509 What is the memory allocated by the following definition? int (*x)[10];
510 What is the memory allocated by the following definition int (*x)(); [A] 20 bytes [B] 4 bytes [C] 2 bytes [D] 8 bytes Answer : C 511 In the following program segment #include main() { int a=2; int b=9; int c=1; while(b) { if(odd(b)) c=c*a; a=a*a; b=b/2; } printf("%d\n",c); } How many times is c=c*a calculated? [A] 1 time [B] 2 times [C] 3 times [D] 4 times Answer : A 512 In the program segment in question 5 what is the value of a at the end of the while loop? [A] 3 [B] 2 [C] 4 [D] none Answer : C 513 Give the output for the following program. #define STYLE1 char
main() { typedef char STYLE2; STYLE1 x; STYLE2 y; clrscr(); x=255; y=255; printf("%d %d\n",x,y); } [A] 255,255 [B] -1,-1 [C] 0,0 [D] -255,-256 Answer : B 514 Give the output for the following program segment. #ifdef TRUE int i=0; #endif main() { int j=0; printf("%d %d\n",i,j); } [A] compilation error [B] Prints 0,0 [C] Run time error [D] -1,-1 Answer : A 515 In the following program #include main() { char *pDestn,*pSource="I Love You Daddy"; pDestn=malloc(strlen(pSource)); strcpy(pDestn,pSource); printf("%s",pDestn); free(pDestn); } [A] Free() fails [B] Strcpy() fails [C] prints I love You Daddy [D] error Answer : C
516 What is the output for the following program #include main() { char a[5][5],flag; a[0][0]='A'; flag=((a==*a)&&(*a==a[0])); printf("%d\n",flag); [A] 0 [B] 1 [C] A [D] None Answer : A 517 Find the output of the following program int *p,*q; p=(int *)1000; q=(int *)2000; printf("%d",(q-p)); [A] 500 [B] 2000 [C] 1000 [D] 150 Answer : A 518 What does the statement int(*x[])() indicate? [A] Array of pointers to the integer type [B] Pointer to pointer of arrays [C] Pointer to an array [D] None Answer : A 519 What does the file stdio.h contain? [A] function definition [B] function declaration [C] Both function definition & function declaration [D] parameters Answer : C 520 scanf() is used for ? [A] To scan the entire string [B] To scan the entire char [C] To scan the double variable [D] To scan the pointer variable Answer : A 521 What does the statement strcat(S2,S1) do?
522 For the following C program #define AND && #define ARRANGE (a>25 AND a<50) main() {int a = 30; if (ARRANGE) printf("within range"); else printf("out of range"); } What is the output? [A] within range [B] out of range [C] compilation error [D] none Answer : A 523 For the following C program #define AREA(x)(3.14*x*x) main() {float r1=6.25,r2=2.5,a; a=AREA(r1); printf("\n Area of the circle is %f", a); a=AREA(r2); printf("\n Area of the circle is %f", a); } What is the output? Area of the circle is 122.656250 [A] Area of the circle is 19.625000 Area of the circle is 102.656250 [B] Area of the circle is 18.625000 [C] Compilation error [D] None Answer : A 524 void main() { extern int a; a=10; printf("%d",a);
give linker error- a not defined ans print 10 give compiler error none
525 int a[10]; printf("%d,%d",a[0],a[12]); will compiler show any error? [A] no [B] printf statement [C] size of array exceeded [D] none Answer : A 526 void main() { int d=5; printf("%f",d); } What is the out put? [A] Undefined [B] 5 [C] 6 [D] None Answer : A 527 void main() { int i; for(i=1;i<4,i++) switch(i) case 1: printf("%d",i);break; { case 2:printf("%d",i);break; case 3:printf("%d",i);break; } switch(i) case 4:printf("%d",i); } What is the out put? [A] 1,2,3,4 [B] 4 [C] 3,4 [D] 1,2
Answer : A 528 void main() { char *s="\12345s\n"; printf("%d",sizeof(s)); } What is the out put? [A] 6 [B] 4 [C] 5 [D] 1 Answer : A 529 void main() { unsigned i=1; /* unsigned char k= -1 => k=255; */ signed j=-1; /* char k= -1 => k=65535 */ /* unsigned or signed int k= -1 =>k=65535 */ if(i printf("less"); else if(i>j) printf("greater"); else if(i==j) printf("equal"); } What is the out put? [A] less [B] greater [C] equal [D] compilation errror Answer : A 530 void main() { float j; j=1000*1000; printf("%f",j); } What is the out put? [A] 1000000 [B] Overflow [C] Error [D] None
Answer : D 531 int f(); void main() { f(1); f(1,2); f(1,2,3); } f(int i,int j,int k) { printf("%d %d %d",i,j,k); } What are the number of syntax errors in the above? [A] Mismatching function calling [B] Function prototype missing [C] Redeclaration of variables [D] None Answer : D 532 #define one 0 #ifdef one printf("one is defined "); #ifndef one printf("one is not defined "); What it prints? [A] one is defined [B] one is not defined [C] error in program [D] none Answer : A 533 void main() { int count=10,*temp, sum=0; temp=&count; *temp=20; temp= *temp=count; printf("%d %d %d ",count,*temp, sum); } What is the out put? [A] 10 10 20 [B] 20 20 20 [C] compilation error [D] 20 10 10
Answer : B 534 main() { static i=3; printf("%d",i--); return i>0 ? main():0; } What is the out put? [A] 321 [B] compilation error [C] 123 [D] 345 Answer : A 535 char *foo() { char result[100]); strcpy(result,"anything is good"); return(result); } void main() { char *j; j=foo(); printf("%s",j); } What it prints? [A] any thing is good [B] compilation error [C] resultgood [D] prints nothing Answer : A 536 f() { int a=2; f1(a++); } f1(int c) { printf("%d", c); } What is the value of c ? [A] 2 [B] 3 [C] 4
[D] linker error Answer : B 537 f1() { f(3); } f(int t) { switch(t); { case 2: c=3; case 3: c=4; case 4: c=5; case 5: c=6; default: c=0; } What is the value of c? [A] 0 [B] 6 [C] 4 [D] 3 Answer : A 538 What is the fallacy in the following program segment ? int *f1() { int a=5; return &a; } f() int *b=f1() int c=*b; } [A] no error [B] semicolon missing in function call [C] function to pointer assignment [D] None Answer : B 539 Find the fallacy in the following program segment? int a; short b; b=a; [A] no error [B] assignment of int variable to short variable
[C] re declaration of same variables [D] none Answer : A 540 How can the word YES be stored in any array? array[1] = 'Y' array[2] = 'E' [A] array[3] = 'S' array[4] = '\0' array[0] = "Y" array[1] = "E" [B] array[2] = "S" array[3] = "\0" array[1] = "Y" [C] array[2] = "E" array[3] = "S" array[0] = 'Y' array[1] = 'E' [D] array[2] = 'S' array[3] = '\0' Answer : D 541 Find the output for the following C program main() { char *p1="Name"; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf("%s\n",p2); } [A] empty string [B] name [C] compilation error [D] non portable pointer conversion Answer : A 542 Find the output for the following C program? main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); } [A] 34 35
[B] 20 35 [C] 57 94 [D] compilation error Answer : C 543 The value of 15 / 10.0 is ________ [A] 1.5 [B] Not defined [C] 0 [D] Infinite Answer : A 544 The value of 15 / 10 is ________ [A] 1.5 [B] Not defined [C] 0 [D] 1 Answer : D 545 For a = 14, b = 4 the value of a / b is [A] 3 [B] 2 [C] 0 [D] 1 Answer : A 546 For a = 14, b = 4 the value of a % b is [A] 3 [B] 2 [C] 0 [D] 1 Answer : B 547 If x = 5, y = 6, z = 6 then x + y * x - z is [A] 180 [B] 60 [C] 110 [D] 29 Answer : D 548 void main (void) { int a, b; int sum; printf(Enter any two numbers); scanf(%d, %d, &a, &b); sum = a + b;
printf(%d, sum) ; } Using the above program compute the value of sum when a = 10, b = 20; [A] 40 [B] 10 [C] 30 [D] 200 Answer : C 549 void main(void) { int a, b; int sub; printf(Enter any two numbers); scanf(% d % d, &a, &b); sub = a b; printf(%d, sub) ; } Find sub when a = 50, b = 40; [A] 40 [B] 10 [C] 30 [D] 200 Answer : B 550 void main(void) { int a, b; int mul; printf(Enter any two numbers); scanf(% d % d, &a, &b); mul = a * b; printf(%d, mul); } Find mul when a= 50, b = 100 [A] 5000 [B] 2 [C] 20 [D] 50 Answer : A 551 void main(void) { int a, b; int div;
printf(Enter any two numbers); scanf(% d % d, &a, &b); div = a / b; printf(%d, div); } Find div when a = 50, b= 80 [A] 1.6 [B] 1 / 1.6 [C] 0 [D] 1 Answer : C 552 If a = 22.2 / b + (3 * b +(4 * c) / b * d) / (2 / n); which operation will be performed first. [A] 22.2 / b [B] 3*b [C] 4*c [D] 2/n Answer : A 553 If b is an integer variable, b = 9 / 2; will return a value [A] 4.5 [B] 5 [C] 4 [D] 0 Answer : C 554 The expression, b = 30 * 1000 + 2768 evaluates to [A] 32768 [B] -32768 [C] 113040 [D] 0 Answer : A 555 Suppose x = 8.8, y = 3.5, z = -5.2. Determine the value of 2 * y + 3 * (x z) [A] 47 [B] 48 [C] 49 [D] 50 Answer : C 556 Suppose x = 8.8, y = 3.5, z = -5.2. Determine the value of 2 * x / (3 * y) [A] 1.7 [B] 1.67619
[C] 1.35896 [D] 2.4587 Answer : B 557 Assume x, y, z are floating point variables and they have been assigned the value x = 8.8, y = 3.5, z = -5.2 The value of the arithmetic expression (2 * x) * (3 * y) is [A] 2 [B] 1.6 [C] 1.67619 [D] 184.8 Answer : D 558 Which operator has the highest priority? [A] ++ [B] % [C] + [D] / Answer : A 559 What is the output of the following code? main () { double x = 1 / 2 . 0 1 / 2; printf(x = % .2f\n, x); } [A] x = 0.00 [B] x = 0.25 [C] x = 0.50 [D] x = 1.00 Answer : C 560 n = 7623; result = 0; { temp = n % 10; result = temp + result * 10; n = n / 10 } The value of result after execution. [A] 3267 [B] 3 [C] 0 [D] 762 Answer : B 561 Which of the following is invalid
562 What is the value of the expression: x%y+x/y+y%x given the following declarations: int x = 7; int y = 3; [A] 3 [B] 4 [C] 5 [D] 6 Answer : D 563 int k = 3/2*4+3/8+3 k=? [A] 4 [B] 7 [C] 3 [D] none Answer : B 564 Which of the following shows the correct hierarchy of arithmetic operations in C [A] () , ** , * or / , + or [B] () , ** , * , / , + , [C] () , ** , / , * , + , [D] () , / or * , - or + Answer : D 565 % operator can be used for [A] exponentiation [B] % operator is not present [C] division [D] modulus Answer : D 566 Which of the following operators take only integer operands [A] + [B] * [C] / [D] % Answer : D
567 The expression x=4+2%8 equates to [A] -6 [B] 6 [C] 4 [D] None of the above Answer : B 568 It is an integer variable, a = 5/2 [A] 2.5 [B] 3 [C] 2 [D] 0 Answer : C 569 Exp In 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] 3*c [D] 2/n Answer : C 570 Which of the following is bit wise operator? [A] < [B] | [C] || [D] + Answer : B 571 Which of the following is bit wise operator? [A] > [B] && [C] & [D] % Answer : C 572 How many bit wise operators are there? [A] 5 [B] 6 [C] 3 [D] 4 Answer : B 573 Which of the following is not a bit wise operator? [A] > [B] | [C] &
[D] ^ Answer : A 574 Bit wise operators are used for manipulation of data at ________ [A] binary level [B] bit level [C] machine level [D] compilation Answer : B 575 Bit wise operators are not applied to _______ [A] float [B] unsigned int [C] char [D] signed int Answer : A 576 Which of the following is not a bit wise operator? [A] & [B] | [C] $ [D] ~ Answer : C 577 Which of the following is a bit wise operator? [A] && [B] || [C] >> [D] ++ Answer : C 578 How the octal constants are represented? [A] They are preceded by zero [B] They are succeeded by zero [C] They are represented in single quotes [D] They are represented in double quotes Answer : A 579 How the string constants are represented? they are the sequence of zero or more characters [A] enclosed within double quotes [B] they are the sequence of zero or more characters [C] they are enclosed within double quotes [D] they are enclosed within single quotes Answer : A
580 The comments included in C program are [A] [B] [C] /* */ [D] () Answer : C 581 How the octal constants are represented? [A] they are preceded by 0x or 0X [B] they are succeeded by 0x or 0X [C] they are represented in single quotes [D] they are represented in double quotes Answer : A 582 What is the output of the following code? main() { printf(%d, A); } [A] a [B] A [C] Error [D] 65 Answer : D 583 %lu is used for [A] unsigned int [B] int [C] unsigned long int [D] long int Answer : C 584 Which of the following is initialization statement [A] int a; [B] int a=10; [C] int a=b; [D] none Answer : B 585 Which of the following operators have left to right associativity? [A] <<, >>, &, ^, | [B] <<, |, &, ^, >> [C] &, |, ^, >>,<< [D] |, ^, &, <<, >> Answer : A
586 Which of the following operators have right to left associativity? [A] ~, * [B] ~, | [C] *, & [D] |, ^ Answer : A 587 Identify the precedence level [A] &, |, &&, || [B] ||, &&, |, & [C] &, ||, &&, | [D] &&, ||, &, | Answer : A 588 The bitwise AND is used for [A] masking [B] comparison [C] division [D] shifting bits Answer : A 589 The bitwise OR is used to [A] set the desired bits to 1 [B] multiply numbers [C] divide the numbers [D] set the desired bits to 0 Answer : A 590 The bitwise XOR is used to [A] Complement the desired bits [B] Multiply the numbers [C] Divide the numbers [D] Mask the bits Answer : A 591 The result of the expression (~ (~7)) is [A] 7 [B] 1 [C] 0 [D] Invalid expression Answer : A 592 The operator that cannot be used for simple encryption [A] ~ [B] & [C] |
[D] ^ Answer : C 593 What is the value of the following expression? i = 1; i = ( i << = 1 % 2) [A] 2 [B] 1 [C] 0 [D] syntax error Answer : C 594 main() { int b ; b = 3^2 ; printf (%d,b) ; } Output of the b is [A] 9 [B] 8 [C] 6 [D] none Answer : D 595 Which of the following operator has highest priority [A] ! [B] && [C] || [D] all the above. Answer : A 596 The operator used for the conditional statement is [A] ! [B] ? [C] ^ [D] $ Answer : B 597 Which of the following is the correct syntax for the conditional statement [A] expression : conditional operator conditional expression : expression 1: expression [B] 2? conditional expression ? expression 1 : [C] expression 2 [D] conditional expression : expression 1? expression
2 Answer : C 598 What is the output : void main() { int a,b=5,c=10; a = (b-c) > (c-b) ? c : b; printf(%d,a); } [A] 10 [B] 5 [C] 0 [D] Error Answer : B 599 If a = 5 b = 10 c = 7 then the value of x =? x = (a > c) ? a : (( b > c) ? b : c) [A] 5 [B] 7 [C] 10 [D] 54 Answer : C 600 What is the output : void main() { int a,b=5,c=10; a = (b-c) > (c-b)? b: c; printf (%d,a); } [A] 10 [B] 5 [C] 0 [D] Error Answer : A 601 Identify the scalar data type in C? [A] double [B] union [C] function [D] array Answer : A 602 Identify the derived data type in C? [A] int [B] float [C] union
[D] char Answer : C 603 Which data type can be used to represent a scalar data type or derived data type? [A] pointer [B] double [C] structure [D] union Answer : A 604 Integral data type does not include [A] enum [B] int [C] char [D] long Answer : D 605 The ____ keyword allows for the creation of an alias for a data type. [A] type def [B] type var [C] type character [D] none Answer : A 606 Identify the wrong declaration [A] unsigned long int y1, y2 [B] long float f1; [C] long double ld; [D] signed n; Answer : B 607 What is a variable declaration? [A] The assignment of properties to a variable [B] The assignment of memory space to a variable The assignment of properties and memory space [C] to a variable The assignment of properties and identification to [D] a variable Answer : D 608 A character constant is written within [A] double quotes [B] single quotes [C] braces
[D] square brackets Answer : B 609 String constants are represented within [A] single quotes [B] double quotes [C] braces [D] \* and *\ Answer : B 610 C supports _______ number of primitive data types [A] 4 [B] 5 [C] 3 [D] 6 Answer : A 611 A _______ may precede a data type in a data type declaration. [A] Identifier [B] Qualifier [C] Initializer [D] Compiler Answer : B 612 Null string is represented as [A] [B] [C] 0 [D] Blank Answer : A 613 Variables are also known as ________ in C [A] Constants [B] Identifiers [C] Objects [D] Data types Answer : C 614 Assigning a value to a variable in declaration is known as [A] Initialization [B] Declaration [C] Assignment [D] Qualification Answer : A 615 The value used for assignment is known as [A] Constant
[B] Identifier [C] Initializer [D] Qualifier Answer : C 616 The variable declaration fixes ______ and _____ of the variables [A] name , data type [B] value, data type [C] name , value [D] name , address Answer : A 617 for (x = 1; x < = 10; x ++) { ..} The above code is for [A] loop inversion [B] inversion [C] printing numbers from 1 to 10 [D] printing numbers from 10 to1 Answer : C 618 If the adjacent loops are combined it is called as _________ [A] loop jamming [B] loop inversion [C] adjacent looping [D] looping adjacently Answer : A 619 Identify the wrong statement? [A] for (expr 1;expr 2) [B] for (expr 1; expr 3) [C] for (;expr ;) [D] for (; ;expr 3) Answer : B 620 Identify the finite loop? [A] for (x = 0; ; x ++); [B] for ( x = 0; ; ); [C] for (; ; ); [D] for (x = 1; x < = 10; x ++) Answer : D 621 What is the output of the following program? main ( ) { unsigned int x; for ( x = 10 ; x > = 0; x --)
printf(%d, x); } [A] prints numbers from 10 to 0 [B] prints numbers from 10 to 1 [C] prints numbers from 10 to -1 [D] goes to infinite loop Answer : A 622 unsigned char c; for (c = 0; c ! = 256; c + 2) printf(%d, c); How many times the loop is executed? [A] 127 [B] 128 [C] 256 [D] infinitely Answer : D 623 How many x are printed? for ( x = 0, y = 10; x < y; x ++, y --) printf(x); [A] 10 [B] 5 [C] 4 [D] 15 Answer : B 624 For the following code how many times the printf( ) function is executed? int x, y; for (x = 0; x < = 10; x ++); for (y = 0; y < = 10; y ++); printf(x = %d, y = %d\n, x, y); [A] 121 [B] 11 [C] 10 [D] 132 Answer : A 625 Result of the following program is main ( ) { int x = 0; for ( x = 0; x < 20; x ++) { switch (x) { case 0 : x + = 5; case 1 : x + = 2;
case 2 : x + = 5; default x + = 4; break; printf(%d,,x); } }} [A] 0, 5, 9, 13, 17 [B] 5, 9, 13, 17 [C] 12, 17,22 [D] 16,21 Answer : D 626 What is the output of the following loop: for(I=0, j=I++; j>I; j++, I++) {printf(%d%d, I, j); } [A] 0,1 [B] 0,0 [C] Infinite loop [D] No output Answer : D 627 What is the output? for (i = 1;i<=5;i + +) { printf(\n); for(j = 1;j<=i; j+ +) { printf(%d, i); } } 1 22 [A] 333 4444 55555 1 12 [B] 123 1234 12345 54321 4321 [C] 321 21 1 [D] 55555 4444 333 22
1 Answer : A 628 What is the output? for (i = 1;i<=5;i + +) { printf(\n); for(j = 1;j<=i; j+ +) { printf(%d, j); } } 1 22 [A] 333 4444 55555 1 12 [B] 123 1234 12345 54321 321 [C] 21 1 55555 4444 [D] 333 22 1 Answer : B 629 What is the output? for (i = 5;i>=1;i - -) {printf(\n); for(j = 1;j<=i; j+ +) { printf(%d, i); } } 1 22 [A] 333 4444 55555 1 12 [B] 123 1234 12345
[C]
[D] Answer : D
630 What is the output? for (i = 5;i>=1;i - -) { printf(\n); for(j = 1;j<=i; j + +) { printf(%d, j); } } 1 22 [A] 333 4444 55555 1 12 [B] 123 1234 12345 12345 1234 [C] 123 12 1 55555 4444 [D] 333 22 1 Answer : C 631 What is the output?
for (i = 5;i>=1;i - -) { printf(\n); for(j = 1;j<=5; j + +) { if (i >= j) continue; printf(%d, j); } }
[A]
[B]
[C]
[D] Answer : A
5 4 3 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
5 4 3 2 2 2 2 2 2 2 2 2 2 2
5 4 5 3 4 3
3 3 3 3 3 3
4 4 5 4 5 4
5 5
[A]
[B]
[C]
[D] Answer : A
1 1 1 1 5 4 3 2 1 1 1 1 1 1 1 1 1 1
2 3 4 2 3 2 5 4 5 3 4 5 2 2 2 2 2 2 2 2 3 3 3 3 3 3
4 4 5 4 5 4
for (i = 5;i>=1;i - -) { printf(\n); for(j = 1;j<=5; j + +) { if (i > j) break; printf(%d, j); } } 1 2 3 4 1 2 3 [A] 1 2 1 5 4 5 [B] 3 4 5 2 3 4 5
[C] no output [D] 1 Answer : D 635 What is the output of the following loop:
for(I=0, j=I++; j>I; j++, I++) { printf(%d%d, I, j); }
Answer : D 636 If the program fragment below executes, how many times does the word "Hello" get printed?
int i, j, k; for (i = 0; i < 100; i = i + 10) for (k = 0; k < 5; k ++) for (j = 1; j <= 1; j++) { printf("Hello\n"); i = i-1; }
10 20 50 100
The condition in the for loop is a must The two semicolons should be dropped The for loop should be replaced by a while loop No error
here is
C language
for
640 Break statement is used to exit from [A] if statement [B] for loop [C] a program [D] main() function Answer : B 641 What will be the output of the following programs
main() { int I; for (I=0; I ++<10;) printf(%d\n,i) }
1 to 10 1 to 9 0 to 9 0 to 10
Answer : A 643 The break statement is used to exist form [A] an If statement [B] a for loop [C] a program [D] The main() function Answer : B 644 Which of the following for loop is not valid [A] for(i=0;i<=10;i+=1) [B] for(;i<=10;i--) [C] for(i=0;i<=50) [D] for(; ;) Answer : C 645 Identify the selective control structure from the following: [A] FOR [B] WHILE [C] IF-ELSE [D] BREAK Answer : C 646 The selective control structures from the following is [A] IF-ELSE-IF [B] DO-WHILE [C] CONTINUE [D] GOTO Answer : A 647 Identify the selective control structure from the following: [A] FOR [B] DO-WHILE [C] BREAK [D] SWITCH-CASE Answer : D 648 Identify the selective control structure from the following: [A] Unconditional expression [B] Conditional expression [C] Compound statement [D] Unconditional statement Answer : B 649 The nested loops [A] Is a loop that contains another the loop [B] Is a loop that returns to the calling function
[C] Is a loop that returns to the main function [D] a loop that overlaps with another loop Answer : A 650 A loop is a _________ [A] Construct [B] Destruct [C] Constructor [D] Destructor Answer : A 651 Which of the following code is correct? [A] IF (X = = 0) [B] IF (X = = X) [C] IF (0 = = X) [D] IF (0 = = 0) Answer : A 652 Identify the wrong statement [A] IF (a < b); [B] IF a < b; [C] IF (a < b) { ; } [D] IF (a < b) Answer : B 653 Which is syntactically correct? [A] IF (a : = 10) { _ _ } ELSE IF (a > 10) { _ _ } [B] IF (a = = 10) { _ _ } ELSE IF (a < 10) { _ _ } [C] IF (a eq 10) { _ _ } ELSE IF (a < 10) { _ _ } [D] IF (a.eq.10) { _ _ } ELSE IF (a < 10) { _ _ } Answer : B 654 Which conditional expression always returns false value? [A] IF (a = = 0) [B] IF (a = 0) [C] IF (a = 10) [D] IF (10 = = a) Answer : B 655 Which conditional expression always returns true value? [A] IF (a = 1) [B] IF (a = = 1) [C] IF (a = 0) [D] IF (1 = = a) Answer : A 656 The syntax of IF statement is
IF expression then program-statement IF (expression) program-statement IF (expression) then program-statement IF expression {program-statement}
{ int a = 2, b = 4, c = 8, x = 4; if(x = = b) x = a; else x = b; if(x != b) c = c + b; else c = c + a; printf(c = %d \n, c) ; } What will be printed when the above code is executed?
c=4 c=8 c = 10 c = 12
{ unsigned int x = -10; int y = 10; if(y <=x) printf(He is good\n); if(y = =(x = -10)) printf(She is better\n); printf(c = %d\n, c); } What will be the output of the above sample code?
printf(The value of exponent\n); else printf(The value of PIE is used in conditional part\n); What might be the result?
Float value cant be given in conditional part. The value of PIE is used in conditional part. The value of exponent. The value of exponent cannot be used in conditional part.
{ int x; if (x > 4) printf( Manasa); else if (x > 10) printf(Karthik); else if(x > 21) printf(Pradeep); else printf(Sandeep);
What will be the value of x so that Karthik will be printed? [A] From 10 to 21 [B] From 11 to 21 [C] Greater than 10 [D] All are incorrect Answer : D 661 int a = 0, b = 2; if (a = 0) b = 0; else b * = 10; What is the value of b? [A] 0 [B] 20 [C] 2 [D] 3 Answer : B 662 int x = 2, y = 2, z = 1; What is the value of x after the following statements? If(x = y% 2) z + = 10; Else z + = 20; [A] 0 [B] 2 [C] 1 [D] garbage value Answer : A 663 int i;
i = 2; i++; if(i = 4) { printf(i = 4); } else { printf(i = 3); }
[B] i=3 [C] Unpredictable [D] i=2 Answer : A 664 What is the result
main() { char c = -64; int i = -32; unsigned int u = - 16; if(c > i) { printf(pass 1); if(c < u) printf(pass 2); else printf(Fail 2);} else printf(Fail 1); if(i < u) printf(pass 2); else printf(Fail 2); }
main() { float me = 1.1; double you = 1.1; if(me = = you) printf( HELLO); else printf(GOOD MORNING) }
int y; scanf("%d",&y); // input given is if( (y%4==0 && y%100 != 0) || y printf("%d is a leap year"); else printf("%d is not a leap year"); }
[A]
[B] 0 [C] error [D] 2000 is not a leap year Answer : A 667 What is the value of y in the following code? x = 7; y = 0; if(x = = 6) y =7; else y =1; [A] 7 [B] 0 [C] 1 [D] 6 Answer : C 668
Find the output for the following C program main() { int a = 0; if(a = 0) printf("Hai\n"); printf("Hai\n"); }
[D] a>b and b<=c. Answer : D 671 What is the value of y in the following code?
x=7; y=0; if(x = = 6) y =7; else y=1;
7 0 1 6
If the initial value of x=200,what is the value after executing this code?
200 1 -1 50
9 8 6 7
675 int
6 5 Syntax error 56
10 20 error 10 20
677 What will be the output of the following program main() { int x=10, y=20 If (x = = y); Printf(\n%d%d,x,y) } [A] 10,20 [B] 10,10 [C] 0,0 [D] None of the above Answer : A 678 What will be the output of the following program
main() { int a = 500,b,c; If(a>=400) b = 300; c = 200; printf(\n%d%d,b,c); }
679 The operator that uses a single operand is a ________ operator. [A] unary [B] binary [C] ternary
[D] assignment Answer : A 680 The unary minus is represented as ________ [A] [B] -[C] *[D] -* Answer : A 681 The unary plus is represented as ________ [A] + [B] ++ [C] &+ [D] +& Answer : A 682 For using the increment operator the operand must be a ________ [A] constant [B] variable [C] expression [D] integer Answer : B 683 For using the decrement operator the operand must be a _____ [A] constant [B] variable [C] expression [D] integer Answer : B 684 The increment operator [A] must succeed the operand [B] must precede the operand [C] must compulsorily succeed and precede operand [D] may precede or succeed the operand Answer : D 685 The operand n ++ [A] execution is similar to the execution of n + 1 [B] executes faster than n + 1 [C] executes slower than n + 1 [D] both executions are different Answer : B 686 n ++ requires _________ machine instruction
687 n + 1 requires _________ more instructions to carry out increment [A] operation [B] less instructions to carry out increment operation [C] less instructions than n ++ [D] more instructions than n ++ Answer : A 688 What is the right order of right to left associativity? [A] -, ++, - [B] - - , ++, [C] ++, - - , [D] -, - - , ++ Answer : A 689 What is the right order of left to right associativity? [A] -, ++, - [B] - - , ++, [C] ++, - - , [D] -, - - , ++ Answer : B 690 The _________ operator cannot be assigned to, or incremented, or decremented with ++ / - -. [A] unary [B] binary [C] ternary [D] cast Answer : D 691 x + + + + + y is evaluated as _______ [A] (x + +) + (+ + y) [B] (+ + x) + ( y + +) [C] (+ + x) + (+ + y) [D] (x + +) + ( y + +) Answer : A 692 Which is not a valid expression? [A] + 0XAB5 [B] 0525 [C] 15 -
[D] +a Answer : C 693 Which is not a valid expression? [A] p++ [B] ++p-[C] ++6 [D] ++x++ Answer : C 694 Which is not a valid expression? [A] + + (a + b) [B] y-[C] --x-[D] ++p+q Answer : A 695 The associativity of + + operator is [A] right to left [B] left to right a for arithmetic expression and b for pointer [C] expression a for pointer expression and b for arithmetic [D] expression Answer : A 696 Which operator has highest priority? [A] ++ [B] % [C] + [D] / Answer : A 697 Which is executed quickly? [A] p++ [B] p+ [C] +p [D] p+1 Answer : A 698 p + + executes faster than p + 1 since [A] p uses registers [B] single machine instruction is required for p + + [C] multi machine instructions is required for p + + [D] p uses more than one register to execute Answer : B
699 main()
{ int i=-1,j=-1,k=0,l=2,m; m=i++ && j++ && k++ || l++; printf("%d %d %d %d %d", i, j, k, l, m); }
i = -1, + i = -1 i = 1, + i = 1 i = -1, + i = 1 i = 1, + i = -1
i = -1, -i = 1 i = 1, - i = - 1 i = -1, - i = - 1 i = 1, - i = 1
702 main() { int i=5,j=6; printf("%d",i+ + +j); } [A] 11 [B] 10 [C] 12 [D] 30 Answer : A 703 main() { int i =0;j=0;
if(i && j++) printf("%d..%d",i++,j); printf("%d..%d,i,j); } [A] 00 [B] 11 [C] -1 -1 [D] 10 Answer : A 704 void main()
{ static int i, j, k; i=i+ +; j=j+ +; k=k+ +; printf(i = %d j = %d k = %d, i, j, k); }
-1 1 0 no value
706 If a = 5, y = a ++ + ++ a; Then the value of y = [A] 10 [B] 11 [C] 12 [D] 25 Answer : C 707 z = 10; x = 5; y = x +++ z; The value of y is _____ [A] 15 [B] 16 [C] 11
[D] Error Answer : A 708 x = 5; y = ++x + ++x; The value of y is ____ [A] 10 [B] 12 [C] 13 [D] 14 Answer : D 709 x = 5; y = x ++ + ++x + ++x; The value of y is ______ [A] 20 [B] 19 [C] 21 [D] 18 Answer : C 710 x = 5; y = x ++ + ++x; The value of y is _______ [A] 10 [B] 11 [C] 12 [D] 7 Answer : C 711 x = 5; printf(%d, x ++ + ++x); The output is _______ [A] 10 [B] 11 [C] 12 [D] 7 Answer : C 712 x = 5; y = x ++ - --x; The value of y is ______ [A] -1 [B] 0 [C] +1 [D] 5 Answer : B 713 x = 5;
y = x ++ + --x; The value of y is ______ [A] 8 [B] 10 [C] 9 [D] Error Answer : A 714 x = 5; y = x ++ * --x; The value of y is ______ [A] Error [B] 25 [C] 16 [D] 20 Answer : C 715 x = 5; y = ++ x * --x; The value of y is ______ [A] 16 [B] 20 [C] 25 [D] Error Answer : B 716 x = 6; printf(%d, x +++ x); The output is ______ [A] 13 [B] 14 [C] 12 [D] Error Answer : A 717 x = 6; printf(%d, x ++ + x); The output is ______ [A] 13 [B] 14 [C] 12 [D] Error Answer : A 718 x = 6; printf(%d, x + ++ x); The output is ______ [A] 13 [B] 14
[C] 12 [D] Error Answer : B 719 x = 6; printf(%d, ++x + ++ x); The output is ______ [A] 13 [B] 14 [C] 16 [D] 15 Answer : D 720 x = 6; printf(%d, ++ x + x); The output is ______ [A] 13 [B] 14 [C] 12 [D] Error Answer : B 721 x = 6; printf(%d, x +++ x); The output is ______ [A] 13 [B] 14 [C] 12 [D] Error Answer : A 722 x = 10; printf(%d, x ++ + x ++ + x ++); The output is ______ [A] 30 [B] 32 [C] 33 [D] 36 Answer : C 723 x = 10; y = x ++ + x ++ + x ++ The output is ______ [A] 30 [B] 32 [C] 33 [D] 36 Answer : A 724 x = 10; printf (%d, x ++ + ++ x + x ++); The output is ______ [A] 30
[B] 32 [C] 36 [D] 34 Answer : D 725 x = 10; printf(%d, x ++ + x -- + ++ x); The output is ______ [A] 30 [B] 32 [C] 36 [D] 34 Answer : B 726 x = 10; printf(%d, x ++ + x -- + x ++); The output is ______ [A] 31 [B] 32 [C] 36 [D] 34 Answer : A 727 x = 10; x = x ++ + x ++; The value of x is ______ [A] 20 [B] 21 [C] 12 [D] 22 Answer : D 728 x = 10; x = x -- + x --; The value of x is ______ [A] 20 [B] 18 [C] 12 [D] 19 Answer : B 729 The below flow chart describes [A] largest of two numbers [B] smallest of two numbers [C] adding of two numbers [D] subtraction of two numbers
Answer : A 730 How many program development steps are their? [A] 5 [B] 6 [C] 7 [D] 8 Answer : C 731 ________ is not the program development step. [A] Designing [B] Implementation [C] Testing [D] Sequencing Answer : D 732 Finding a better solution to the problem that arises in the program development is called _________ [A] analysis [B] statement of the problem [C] designing [D] Implementation Answer : A 733 The multi step process that mainly focuses on data, architecture, user interfaces and program components is called ________ [A] analysis [B] statement of the problem [C] designing [D] Implementation Answer : C 734 The coding and building of new software using a programmable language and software tools is called ___________ [A] analysis [B] statement of the problem [C] designing [D] Implementation Answer : D 735 Finding of uncover errors, assurance of software quality and review of analysis, design and implementation phases is called ___ [A] testing [B] statement of the problem
[C] designing [D] Implementation Answer : A 736 The descriptive information that explains the usage as well as functionality of the software is called _____________ [A] Maintenance [B] Documentation [C] Testing [D] Implementation Answer : B 737 The activity that includes amendments, measurements and tests in the existing software is called ____ [A] Maintenance [B] Documentation [C] Testing [D] Implementation Answer : A 738 Which of the following is not an advantage of flow charts? [A] Logic of program can be easily understood [B] Following the flow chart logically is simple Translation of a flow chart in to a computer [C] program is always very simple [D] All of the above Answer : C 739 Which of the following is not a selective control structure? [A] if-else [B] if-else-if [C] switch-case [D] For Answer : D 740 Which of the following is not an unconditional construct? [A] goto [B] break [C] for [D] continue Answer : C 741 The general syntax for the FOR loop is for(test condition; expression 2; expression 3) [A] { statements ; } [B] for(expression 1; expression 2; expression 3)
{ statements ; } for(expression 1; test condition; expression 2 { statements ; } for(expression 1; expression 2; test condition) { statements ; }
numbers from 1 to 10 numbers from 10 to 1 even numbers from 1 to 10 odd numbers from 10 to 1
743 The infinite loop using for loop is [A] for ( ; ; ) { } [B] for (test condition ; ; ) { } [C] for ( ;test condition ; ) { } [D] for ( ; ;test condition ) { } Answer : A 744 The infinite loop using for loop is [A] for (test condition ; ; ) { } [B] for (expression 1 ; ; expression 3 ) { } [C] for ( ;test condition ; ) { } [D] for ( ; ;test condition ) { } Answer : B 745 The infinite loop using for loop is [A] for (test condition ; ; ) { } [B] for (test condition ; ; ) { } [C] for ( ; ;expression 3 ) { } [D] for ( ; ;test condition ) { } Answer : C 746 x = 10; x = x ++ - x ++; The value of x is ______ [A] 2 [B] 1 [C] 0 [D] Garbage value
Answer : A 747 x = 10; x = ++ x + x ++; The value of x is ______ [A] 23 [B] 21 [C] 24 [D] 22 Answer : A 748 x = 10; x = x ++ / x ++; The value of x is ______ [A] 0 [B] 2 [C] 3 [D] 1 Answer : C 749 int z;
int x = 5; int y = -10; int a = 4; int b = 2; z = x++ - --y * b /a; What number will z in the sample code above contains
5 6 10 11
Find the output for the following C program main() { int x = 20, y = 35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n", x, y); }
55 93 57 94 53 94 20 35
10 15 11 17 11 16 12 16
5; -10; 4; 2; z = x++ - --y * b /a; What number will z in the sample code above contains
5 6 10 11
3 5 4 error
6 4 5 garbage
757 int b=3 ,a; a=b++; What is the value of a [A] 4 [B] 5 [C] 34 [D] 3 Answer : D 758 int b=3 ,a; a=++b; What is the value of a [A] 4 [B] 5 [C] 34 [D] 3 Answer : A 759 n+++ is used to increment the n value to [A] 2 [B] 3 [C] Nothing [D] 0 Answer : C 760 I/ O functions can be used in a program by including _____ header file. [A] conio.h
[B] stdio.h [C] math.h [D] mathlib.h Answer : B 761 Header files provides ____________ for the library functions. [A] definitions [B] declarations [C] both declarations and definitions [D] they are not needed Answer : C 762 Name the character oriented I / O function. [A] getchar () [B] scan f() [C] printf() [D] sqrt() Answer : A 763 Name the formatted I / O function. [A] getchar () [B] scan f() [C] putchat() [D] sqrt() Answer : B 764 %c %i %d %e %f %g %n %o %p %s %u %x %% is the list conversion specification of [A] getchar () [B] scan f() [C] putchar() [D] sqrt() Answer : B 765 What is the effect of using %n in scanf()? It assigns the number of characters read so far to [A] the matching argument given in the address list It assigns the number of integers read so far to the [B] matching argument given in the address list It assigns the number of variables read so far to the [C] matching argument given in the address list It assigns the number of characters read so far to [D] the matching argument given in the program list Answer : A 766 %c %d %i %e %f %g %E %G %n %o %p %s %u %x %X %
% is the list conversion specification of [A] getchar () [B] printf() [C] putchat() [D] sqrt() Answer : B 767 The End Of File is entered from keyboard in DOS environment using [A] Ctrl z [B] Ctrl a [C] Ctrl p [D] Ctrl x Answer : A 768 The End Of File is entered from keyboard in UNIX environment using [A] Ctrl z [B] Ctrl a [C] Ctrl d [D] Ctrl x Answer : C 769 Whenever a character * appears between the percentage sign (%) and conversion character it is known as [A] EOF [B] suppression character [C] precision character [D] qualifier Answer : B 770 What does the function scanf () return when an error occurs? [A] EOF [B] suppression character [C] precision character [D] qualifier Answer : A 771 The flags used in printf () are [A] -, +, # , 0, Blank [B] -, +, # , 0, $ [C] -, +, & , 0, Blank [D] -, +, # , 0,& Answer : A 772 What does the function printf () return when an error occurs? [A] EOF
[B] suppression character [C] precision character [D] negative value Answer : D 773 What does the function scanf () return when an error does not occur? [A] number of characters [B] EOF [C] flag [D] precision character Answer : A 774 The character ____ is used as suppression character in conversion specification. [A] & [B] $ [C] % [D] * Answer : D 775 The function putchar() uses ________ as its argument. [A] ASCII value [B] Address of integer [C] value of integer [D] binary value Answer : A 776 The _______ function reads the value of an int variable a. [A] scan f() [B] printf() [C] getch() [D] getchar() Answer : A 777 A string of non white characters, given as input for scanf() is called ______ [A] input field [B] input [C] output of previous statement [D] string Answer : A 778 Execution of printf( %d, A); displays the output as [A] 65, A [B] A, 65 [C] 56, A
[D] A, 56 Answer : A 779 Execution of printf( % + d, 25); displays the output as ______ [A] + 25 [B] 25 + [C] 26 [D] 24 Answer : A 780 Execution of printf( %4.2f, 3.1478); displays the output as ____ [A] 3.1478 [B] 3.15 [C] 3.14 [D] 0003.14 Answer : B 781 The library functions are made available to a program , by using ______ [A] stdio.h [B] conio.h [C] #include [D] #define Answer : C 782 Conversion specification is represented by the conversion character ______ [A] % [B] & [C] $ [D] ^ Answer : A 783 Execution of scanf( % * [ ] %c, & p, & q); skips _________ if any, while reading the next input [A] new line [B] blank space [C] input field [D] output field Answer : A 784 Header files in C contain [A] compiler commands [B] library functions [C] header information of C programs
[D] operators for files Answer : B 785 How are the library functions made available to a program? [A] by using #define statements [B] by linking loader to the program [C] by using #include statements [D] by using function declarations Answer : C 786 Identify the character oriented console I/O functions. [A] getchar () and putchar () [B] gets () and puts () [C] scanf () and printf () [D] fgets () and fputs () Answer : A 787 Identify the formatted console I/O functions. [A] getchar () and putchar () [B] gets () and puts () [C] scanf () and printf () [D] fgets () and fputs () Answer : C 788 What is the value returned by getchar() when an alphabet key is pressed? [A] the alphabet entered from the keyboard the ASCII value of the alphabet entered from the [B] key board [C] 0 [D] 1 Answer : B 789 The function putchar() uses [A] no argument one argument that is an ASCII value of the [B] character two arguments first one is ASCII value and the [C] second one is number of characters [D] one argument, that is the string Answer : B 790 The function getchar() uses [A] no argument [B] one argument that is an ASCII value of the
character one arguments that is a character variable one argument, that is the string
791 Identify the wrong statement [A] putchar(65) [B] putchar(x) [C] putchar(x) [D] putchar(\n) Answer : C 792 The function scanf ( ) returns [A] the actual values read for each argument [B] the number of successful read input values [C] no value (void) [D] ASCII values of the characters read Answer : B 793 The function printf ( ) returns [A] The number of characters displayed [B] the number of successful read input values [C] no value (void) [D] ASCII values of the characters read Answer : A 794 Conversion specification includes [A] \ and a conversion character [B] / and a conversion character [C] & and a conversion character [D] % and a conversion character Answer : D 795 Identify the correct statement given double x; [A] scanf (%d, &x); [B] scanf (%f, x); [C] scanf (%d, *x); [D] scanf (%lf, &x); Answer : D 796 Identify the correct statement given float y; [A] scanf(%e, &y); [B] scanf(%i, &y); [C] scanf(%2f, y); [D] scanf(%4.2f, y); Answer : A
797 For the given scanf () statement what is the form of input expected? scanf(%d. %d. %d., &date, &month, &year); [A] 22. 4. 1972 [B] 22 4 1972 [C] 22/ 4/ 1972 [D] 22 - 4 - 1972 Answer : A 798 Identify the wrong statement given, int x; float y; char z; [A] scanf(%d, %f, %c, &x, &y, &z); [B] scanf(%d, %f, %c, &x, &y, z); [C] scanf(Rs. %d, %f, %c, &x, &y, &z); [D] scanf(%d, %f, %c, x, y, z); Answer : B 799 char p, q; scanf(%c%l s, &p, &q); What are the values assigned, if x and y are given as inputs? [A] p = x and q = blank [B] p = x and q is not assigned [C] p = x and q = y [D] p = x and q = x Answer : C 800 Identify the wrong statement given the declarations char x, y; [A] scanf(%c%c, &x, &y); [B] scanf(%c%ls, &x, &y); [C] scanf(%*[ ] %c, &x, &y); [D] scanf(%d%d, x,y); Answer : D 801 What is the purpose of the flag in printf() function? [A] centered [B] Right justified [C] putting sign [D] Left justified Answer : D 802 What is the purpose of the flag + in printf() function? [A] left justified [B] + or precedes the signed numbers [C] right justified [D] centered Answer : A 803 Which of the following is Primary data type [A] int [B] struct
[C] string [D] const Answer : A 804 Which of following is a valid variable name [A] $Ram Chandra [B] Nish-anth [C] Ram.ch [D] ram Mohan Answer : D 805 A C variable cannot start with [A] An alpha belt [B] A number [C] A special symbol [D] Both b. and c. Answer : D 806 Which escape character is used to return carriage return [A] \n [B] \r [C] \t [D] \ Answer : B 807 The symbolic representation of the program is called ________ [A] algorithm [B] flow chart [C] program [D] procedure Answer : B 808 _________ allow the relation ship between various parts of the problem to be clearly specified. [A] algorithm [B] flow chart [C] program [D] procedure Answer : B 809 Flow chart representation follows _________ approach. [A] top down [B] bottom up [C] breadth first [D] depth first Answer : A
810 The comma operator is used in for loop because in order to have multiple expressions which are to [A] be evaluated [B] in order to separate various initializations [C] in order to assign values to variables [D] none Answer : A 811 Which of the following is not a bit wise operator? [A] ~ [B] || [C] | [D] >> Answer : B 812 What is the ASCII value of operator & [A] 037 [B] 038 [C] 039 [D] 040 Answer : B 813 What is the ASCII value of operator | [A] 121 [B] 122 [C] 123 [D] 125 Answer : D 814 What is the ASCII value of operator ~ [A] 123 [B] 124 [C] 126 [D] 125 Answer : C 815 What is the purpose of the flag # in printf() function? [A] left justified [B] right justified 0 and 0x precede non zero octal and hexa values [C] respectively [D] Leading zeros appear Answer : C 816 What is the purpose of the flag 0 used in printf() function?
leading blanks are displayed leading zero appears sign precedes + or sign precedes
817 What is the purpose of the flag blank used in the function printf()? precedes negative value and blank precedes [A] positive value precedes negative value and + precedes positive [B] value sign precedes negative value and nothing [C] precedes positive value [D] - Blank precedes negative and positive numbers Answer : A 818 printf( Daily Click!); In the code segment above the words Daily Click ! will be printed to what output device? [A] to an e-mail message [B] to the console [C] to the default printer [D] to wherever standard output has been directed to Answer : B 819 If x = 2, y = 6, and z = 6 then what will be the output of x=y==z; printf(%d, x); [A] 0 [B] 1 [C] 2 [D] 6 Answer : D 820 How many logical operators are there? [A] 5 [B] 6 [C] 3 [D] 4 Answer : C 821 Which of the following is logical operator? [A] > [B] &&
[C] & [D] % Answer : C 822 Which of the following is logical operator? [A] < [B] | [C] || [D] + Answer : C 823 Identify the not the logical operator [A] && [B] > [C] || [D] ! Answer : B 824 Which of the following is a logical operator? [A] ! [B] ^ [C] < [D] > Answer : A 825 Let a = 20, b = 40 and c = 60 then r = a < b && b < c [A] 0 [B] 40 [C] 20 [D] 120 Answer : A 826 When we want to test more conditions and make decisions we use ________ [A] logical operators [B] relational operators [C] conditional operators [D] arithmetic operators Answer : A 827 An expression which combines two or more relational expressions it is called as _______ [A] logical expressions [B] relational expressions [C] conditional expressions [D] arithmetic expressions Answer : A
828 A logical expression is also called as [A] compound expression [B] compound assignment [C] compound relation expression [D] multi relational expression Answer : C 829 Consider the below condition if age = 60 and
salary = 2000 If ( age > 55 && salary < 1000) printf( GOOD MORNING); else printf( BAD MORNING);
[A] [B]
[C] null value [D] garbage value Answer : A 833 Consider the below condition if number = 20
If ( number > 0 || number > 100) printf( GOOD MORNING); else printf( BAD MORNING);
834 If a = 0 and b = 1 then a || b is ________ [A] 0 [B] 1 [C] null value [D] garbage value Answer : B 835 If a = 0 and b = 1 and c = 1 then a || b && b || c is ________ [A] 0 [B] 1 [C] null value [D] garbage value Answer : B 836 main()
{ char not; not=!2; printf("%d",not); }
0 1 error no value
837 Which of the following represents true statement either x is in the range of 10 and 50 or y is zero [A] x<50 [B] y!=10 && x>=50 [C] x >= 10 && x <= 50 || y = = 0 [D] None of these Answer : C
838 Choose the conditional expression which is true only when the value of x (an int variable) is even and in the range 0 to 6. [A] x == 0 && x == 2 && x == 4 && x == 6 [B] x > 0 && x != 1 || x != 3 || x != 5 && x < 7 [C] (x % 2) == 1 && x >= 0 && x <= 6 [D] (x % 2) == 0 && x >= 0 && x <= 6 Answer : D 839 main()
{ int i = 4 , j = -1 , k=0 ,y,z; y = i+ 5 && j+1 || k+2; z = i+5 || j+1 && k+2; printf(\n y = %d z = %d , y , z); ?
2 1 1 -2 -2 2 1 0 -2 2 1 1 -2 2 0 1
2 1 1 -2 -2 2 1 0 -2 2 1 1 -2 2 0 1
5 6 3 4
843 Which of the following is a relational operator? [A] > [B] && [C] & [D] % Answer : A 844 Which of the following is a relational operator? [A] < [B] | [C] || [D] + Answer : A 845 Identify the relational operator [A] && [B] > [C] || [D] ! Answer : B 846 Let a = 20, b = 40 and c = 60 then r = a < b && b < c [A] 60 [B] 40 [C] 20 [D] 120 Answer : A 847 The output of the below condition if a = 20, b =
60 is If (a > b) printf( %d, a); else printf(%d, b);
[B] ^ [C] < [D] > Answer : B 849 Which of the following is a relational operator? [A] <= [B] # [C] & [D] % Answer : A 850 Which of the following is a relational operator? [A] != [B] !& [C] !% [D] || Answer : A 851 What is the output of the following code?
{ ch = A; while(ch < = F) { switch(ch) { case A :case B : case C : case D: ch++; break; case E: case F : ch++; } putchar (ch); } }
852 Which of the following is not an infinite loop ? [A] while(1)\{ ....} [B]
for(;;) { } x=0; do{ /*x unaltered within the .....} while(x = = 0); ...
[C]
loop*/
infinite 5 4 6
855 Point out the error, if any, in the while loop Main ( ) { int i = 1; while ( ) { printf ( %d, i++); if (i>10) break; } } [A] The condition in the while loop is a must There should be at least a semicolom in the while [B] () [C] The while loop should be replaced by a for loop [D] No error Answer : A 856 main()
{ int i=1; while(i<=32767) { printf(%d, i); i=i+1; } } what is the output
of
the above
program
857 main() { while(4<1) printf(hello there); } What is the output of the above program? [A] No output [B] Error [C] hello there [D] infinite loop Answer : A 858 main()
{ do { printf(hello); } while(4<1); } What is the output of the above program
859 A Do-While loop is useful when we want that the statement within the loop must be executed [A] only once [B] atleast once [C] more than once [D] none Answer : B 860 Algorithms written in English like language are called ______ [A] Pseudo code [B] Source code [C] Program code [D] Physical code Answer : A 861 ___ is defined as an ordered sequence of well defined and effective operations that, when executed will always produce a result and eventually terminate in a finite amount of time. [A] Algorithm
[B] Procedure [C] Pseudo code [D] Source code Answer : A 862 The process of breaking a problem into sub problems, continuing this until all the problems reach the lowest level such that each can be easily solved is called [A] Bottom-up design technique [B] Top-Down design technique [C] Object oriented design technique [D] Parsing Answer : B 863 The efficiency of an algorithm depends on which of the following parameters. [A] Time and size [B] Time and space [C] Space and size [D] Only time Answer : C 864 __________ is a list of instructions that a computer follows to carry out its computations. [A] Algorithm [B] Computer program [C] Source code [D] Object code Answer : B 865 Which of the following is a relational operator? [A] << [B] => [C] >= [D] >> Answer : C 866 Which of the following is a relational operator? [A] a>b [B] a !< b [C] a !> b [D] a !>= b Answer : A 867 If a = 20, b = 55 then c = a < b then c = _________ [A] 55 [B] 20
[C] null value [D] garbage value Answer : A 868 Which of the following is not a relational operator? [A] <= [B] >= [C] >>= [D] != Answer : C 869 The output of the below condition if a = 40, b =
60 is If (a = = b) printf( %d, a); else printf(%d, b);
873 The relational expressions is not used in decision statements such as [A] IF [B] WHILE [C] GOTO [D] SWITCH Answer : C 874 The priority of relational operators over arithmetic operators is [A] higher [B] lower [C] equal [D] operators do not have priority Answer : B 875 Relational operators are evaluated in relation to arithmetic operators. [A] first [B] last [C] depends on the order [D] compiler does not recognize Answer : B 876 main()
{ int i=10; i=!i>14; Printf ("i=%d",i); }
i=0 i = 10 i = 1 to 14 i = 0 to 13
[A] [B]
7 0
z = %d , x , y,z);
j = 15) ;
880 _________ is an individual entity of a program. [A] data type [B] token [C] character set [D] Identifier Answer : B 881 The header file that is applicable to all the programs is [A] [B] [C] [D] Answer : A 882 The header file that must be included while performing mathematical operations is [A] [B]
[C] [D] Answer : C 883 The header file that must be included while using the escape sequences is [A] [B] [C] [D] Answer : B 884 The escape sequence \a denotes [A] alert [B] alter [C] carriage return [D] form feed Answer : A 885 The escape sequence \f denotes [A] alert [B] alter [C] carriage return [D] form feed Answer : D 886 The escape sequence \r denotes [A] alert [B] alter [C] carriage return [D] form feed Answer : C 887 The escape character \0 denotes [A] alert [B] null character [C] carriage return [D] form feed Answer : B 888 A block of code is delimited by [A] Hyphen [B] Braces [C] Colon [D] Space Answer : B
889 Which of the following is not a character in C? [A] $ [B] ^ [C] ~ [D] | Answer : A 890 The _______ function is used to specify the minimum number of characters positions on the output field variable will consume. [A] putchar() [B] scanf () [C] printf() [D] getch () Answer : A 891 The _______ is used to read a number, a character or a string of characters from a standard input device, normally the key board. [A] printf() [B] scanf() [C] getche() [D] getch ( ) Answer : B 892 C programs are normally typed in to a computer using an ___ program. [A] Main [B] Editor [C] New line [D] Pseudo code Answer : B 893 Which of the following is not a keyword? [A] auto [B] case [C] while [D] printf Answer : D 894 Which of the following integer constants is illegal? [A] 15 750 [B] 190000 [C] 0X [D] -765 Answer : A
895 Which of the following is not a keyword in C? [A] const [B] main [C] sizeof [D] void Answer : B 896 An identifier cannot start up with [A] _ [B] uppercase alphabet [C] lower case alphabet [D] # Answer : D 897 Identify the octal constant? [A] 627 [B] 0X25 [C] -0756 [D] 06.52 Answer : C 898 The qualifier that may precede float is? [A] signed [B] unsigned [C] long [D] nothing Answer : D 899 The qualifier that may precede char is [A] short [B] unsigned [C] int [D] long Answer : B 900 The qualifier that may precede double is [A] signed [B] unsigned [C] short [D] long Answer : D 901 Printable characters always use [A] negative integers [B] positive integers [C] all integers
[D] -1 Answer : B 902 Which of the following is not a valid integer constant [A] 600000 u [B] 534878 ul [C] 0Xabpq [D] 0X625 Answer : C 903 Which of the following is not a valid floating constant? [A] 4E-6f [B] 4E 12 [C] 0.08e-4 [D] 1.3345F Answer : B 904 An octal constant is preceded by [A] X [B] 0X [C] O (alphabet) [D] 0(zero) Answer : D 905 A hexa constant is preceded by [A] 0X [B] O [C] HX [D] 0 Answer : A 906 Identify the invalid string constant [A] A + B [B] [C] [D] A Answer : D 907 Which is not a character constant? [A] \60 [B] \012 [C] \x24 [D] sum Answer : D 908 Identify the invalid constant? [A]
[B] [C] in [D] \b Answer : C 909 Which of the following is not an escape sequence? [A] \0 [B] \n [C] \f [D] \# Answer : D 910 Which of the following is not a white space character? [A] \f [B] \v [C] \0 [D] blank Answer : C 911 Identify the invalid string constants? [A] 5\t 10\t15\t [B] cost = 90\x24\n [C] \n Dont care condition [D] C is flexible Answer : D 912 If a constant is given a name it becomes [A] string constant [B] manifest [C] const declaration [D] invalid Answer : C 913 Symbolic constants are defined as [A] #define S1 S2 [B] #define S1 S2; [C] #define S1 = S2 [D] #define S1 = S2; Answer : A 914 The symbol # in #define must commence from [A] any where in a line [B] the first column of a line [C] the first column of the next line [D] the first line Answer : A
915 What is an object in C? [A] constant [B] variable [C] identifier [D] keyword Answer : B 916 Which of the following is not a token? [A] string [B] keywords [C] constants [D] operators Answer : A 917 Statement terminator is represented as [A] : [B] blank [C] ; [D] \n Answer : C 918 Identify the wrong statement related to tokens? [A] Token is an individual entity of a program [B] Tokens are identified during the compilation Compiler always constitutes the longest possible [C] token Tokens are similar to the comments that can be [D] neglected Answer : D 919 Identify the number of tokens in the following if (age = 21) [A] 4 [B] 5 [C] 6 [D] 7 Answer : C 920 Which is an invalid variable name? [A] int [B] Xx [C] net-salary [D] floating Answer : C 921 Identify the correct statement [A] The variable names VOLUME and volume are
identical The variable names Sum and sum are identical Variables are not declared before use variable names may be absent in the declaration
922 Identify the invalid identifier [A] NET_$ [B] BINGO [C] _ACCOUNT [D] _4 Answer : A 923 Which is the most appropriate variable initialization? [A] # define MAX 100 [B] int x, y; y = 15; [C] float y = 2.14 [D] char c; c = O Answer : C 924 Tokens are separated by using [A] : [B] . [C] ; [D] separator Answer : D 925 An escape sequence commences with [A] \ [B] / [C] ? [D] # Answer : A 926 Identify the wrong statement [A] #define is a preprocessor facility #define aids in modifying a constant value [B] throughout the program [C] #define uses a statement terminator [D] improves the readability of the program Answer : C 927 What is the maximum value of a signed data type that is 8 bits in size? [A] 27 [B] 28
[C] 27 1 [D] 28 1 Answer : C 928 Where does the execution of every C program starts? [A] Every C program starts with the main()function [B] Every C program starts with the begin() function Every C program starts in the initialize() [C] function [D] Every C program starts in the start() function Answer : A 929 Among the following escape sequences which do not have any specific meanings? [A] \t [B] \a [C] \b [D] \c Answer : D 930 The escape sequence character \x07 is equivalent to the character [A] \a [B] \b [C] \r [D] \f Answer : A 931 if int occupies 2 bytes and char occupies 1 byte
#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }
[A]
64
50 10 no value error
936 A finite set of steps, each of which may require one or more outputs and may have zero or more operations. This is called as ___ [A] Procedure [B] Algorithm [C] Program [D] Instruction
Answer : B 937 Algorithm is a _________ procedure about how to solve a problem. [A] Public [B] Private [C] General [D] Abstract Answer : C 938 _______ is an artificial and informal language that helps programs develop algorithms. [A] Pseudo code [B] Machine code [C] Object code [D] Source code Answer : A 939 Describing the process step by step is called [A] Flow chart [B] Algorithm [C] Program [D] Pseudo code Answer : B 940 Describing the process using diagrams is called [A] Flow chart [B] Algorithm [C] Program [D] Pseudo code Answer : A 941 Checking to see if our algorithm gives the desired result is called as ____ [A] Execution [B] Validation [C] Dry run [D] Compilation Answer : C 942 Making a choice from multiple available options is called as [A] Sequence. [B] Selection [C] Iteration [D] Validation Answer : B 943 Performing repetitive tasks is called as _________________
944 The process of removing an error from an algorithm is called as [A] Compiling [B] Debugging [C] Interpretation [D] Iteration Answer : B 945 The activity that does not form the building block of an algorithm. [A] Sequence [B] Selection [C] Iteration [D] Parallel computing Answer : D 946 The characteristic of an algorithm that describes that each instruction is clear and unambiguous is [A] Effectiveness [B] Finiteness [C] Definiteness [D] Input / output Answer : C 947 The characteristic of an algorithm that an algorithm must terminate after a finite number of steps is [A] Effectiveness [B] Finiteness [C] Definiteness [D] Input / output Answer : B 948 The characteristic of an algorithm that every instruction in an algorithm must be very basic is [A] Effectiveness [B] Finiteness [C] Definiteness [D] Input / output Answer : A 949 The characteristic of an algorithm in which zero or more items
to be given is called [A] input [B] Finiteness [C] Definiteness [D] Output Answer : A 950 The characteristic of an algorithm in which at least one item is produced is called [A] Input [B] Finiteness [C] Definiteness [D] Output Answer : D 951 The below algorithm describes
Step Step Step else Step 1: Start 2: Read a and b 3: If a > b then Write (a) Write (b) 5: Stop
Largest between two numbers Smallest between two numbers Adding of two numbers Subtraction of two numbers
Step 1: Start Step 2: Read N Step 3: Repeat while N > 0 Write (N) N = N - 1 Step 5: Exit
Displaying natural numbers in correct order Displaying natural numbers in reverse order Displaying odd numbers Displaying even numbers
Displays the number of odd digits exists in a given number Displays the odd numbers Displays the even numbers Displays the number of even digits exists in a given number
Evaluates Power (X, N) Evaluate Power (N, X) Evaluates square (X, N) Evaluates square (N, X)
955 Which property of an algorithm states that each step should be primitive and can be performed exactly in a finite amount of time? [A] Finiteness [B] Effectiveness [C] Definiteness [D] Generality Answer : A 956 main()
{ int a= 0;int b = 20;char x =1;char y =10; if(a,b,x,y) printf("hello"); }
hello 10 20 0
957 In the format specifier "%-d" - is used for which purpose in C [A] Left justifying a string [B] Right justifying a string [C] Removing a string from the console Used for the scope specification of a char[] [D] variable
Answer : A 958 int a=2,b=3,c=4; printf("a=%d,b=%d\n",a,b,c); [A] 2,3 [B] 2,3,4 [C] 2, 4 [D] Error Answer : A 959 What does the following code do
int a = b = a = a, b; a + b; a - b; a - b;
960 printf("%f", 9/5); prints [A] 1.8, [B] 1.0, [C] 2.0, [D] none Answer : B 961 The format specifier "-%d" is used for which purpose in C [A] Left justifying a string [B] Right justifying a string [C] Removing a string from the console Used for the scope specification of a char[] [D] variable Answer : A 962 n=7623;
result=0; while(n! = 0) { temp=n%10; result=temp+ result*10; n=n/10 } The value of result after execution.
[D] 2376 Answer : B 963 The format specified for hexa decimal is [A] %d [B] %o [C] %x [D] %u Answer : C 964 Among the choices given, the best definition of an "expression" is... [A] a series of steps which compute an answer [B] a mathematical formula [C] something in a program which has a value [D] an arithmetic operation Answer : A 965 int x = 4, y = 3;
double a, b; a = (double) (x / y); b = (int) (x / y * x); What are the values of a and b after the code fragment executes? [Double values are shown to 2 decimal places.]
966 Main ( ) { print f ( %d %d %d size of (&), size of ( & ), size of ( & )); } [A] 1, 2, 2 [B] 1, 1, 2 [C] 2, 2, 2 [D] 1, 1,1 Answer : C 967 Main ( )
{ int y = 128; const int x = y; print f ( %d, x );
[A]
128
[B] Garbage value [C] Error [D] 0 Answer : A 968 What would be the output of the following program
? Int x = 40; Main ( ) { int x = 20; printf ( \n%d, x); }
969 We want to round off x, a float, to an int value. The correct way to do so would be [A] y = (int) (x + 0.5); [B] y = int ( x + 0.5); [C] y = (*int) x + 0.5; [D] y = (int) ( (int) x + 0.5) Answer : A 970 By default any real number is treated as [A] a float [B] a double [C] a long double Depends upon the memory model that you are [D] using Answer : B 971 void main()
{ int i=5; printf(%*d,10,i); }
error 10 5 50 5
is
4 error 0 1
975 Maximum length of a variable in c language [A] 8 [B] 40 [C] 32 [D] 6 Answer : A 976 main()
{ int i= 012 ; printf(%d,i); } Output of the j is
0 10 12 012
is
12 0 18 012
is
0 8 error 08
is
0 8 error 08
980 char name = Ramu; printf(%c,name); What is the output ? [A] Ramu [B] R [C] Error [D] none Answer : C 981 C language was developed by [A] Ken Thompson [B] Martin Ritchie [C] Peter Norton [D] Dennis Ritchie
Answer : D 982 The maximum value that an integer variable can have [A] 32768 [B] 32767 [C] 32767 [D] 1.7014e+38 Answer : B 983 Which of the following statement is wrong [A] mes = 123.56; [B] con = T * A; [C] this = T * 20 [D] 3+a = b; Answer : D 984 main()
{ int i=5; printf(%c,i); } What is the output of the above program?
the above
program
error A 65 none
986 Which of the following is valid variable name [A] length_b [B] si_int* [C] 91 kiran [D] @statistics Answer : A 987 Number of keywords in Turbo C language [A] 40 [B] 32
[C] 28 [D] 26 Answer : B 988 A character occupies [A] 2 bytes [B] 1 byte [C] 4 bytes [D] 4 bits Answer : B 989 Identify the non-keyword from the following [A] auto [B] break [C] string [D] unsigned Answer : C 990 A variable can start with [A] alphabet [B] number [C] underscore [D] both a& c. Answer : D 991 Size of int is [A] 2 bytes [B] 4 bytes [C] 1word [D] none Answer : A 992 ASCII values of A-Z are [A] 97-122 [B] 58-90 [C] 65-90 [D] 64-90 Answer : C 993 Integer division results in [A] truncation [B] rounding [C] overflow [D] underflow Answer : A 994 printf() is a
995 scanf() is present in which header file [A] conio.h [B] stdio.h [C] stdlib.h [D] graphics.h Answer : B 996 Which of the format specifier is used to print characters [A] %d [B] %c [C] %s [D] none Answer : B 997 By default main() returns [A] nothing [B] int [C] float [D] none Answer : B 998 What will be the output of the following program
main() { printf(%c,7[subdaram]); }
No result 7 S m
[D] None Answer : C 1000 What would be the output of the following
program? main() { printf(5+Fascimile); }
1001 C programs are converted into machine language with the help of [A] An interpreter [B] A compiler [C] An operating system [D] None of the above Answer : B 1002 Any C function by default returns which value [A] Float [B] void [C] int [D] None of the above Answer : C 1003 What is the range of signed char [A] 128 to +127 [B] 0 to 255 [C] 255 to +255 [D] None of the above Answer : A 1004 What will be the output of processor compiler [A] Re locatable object code [B] Executable code in machine language [C] C source code fire [D] None of the above Answer : A 1005 Which of the following correctly formed # define statement [A] # define inch per feet 12 [B] # define SQR(x) x*x
[C] # define SQR(n); (n*n) [D] # define SQR(n) (n*n); Answer : B 1006 Which directive is used to remove the value which is defined with directly [A] # undefined [B] # del [C] # undel [D] a & c both Answer : C 1007 Which conversion specified is used to describe digits specifying precision [A] dd [B] d [C] dsp [D] c Answer : A 1008 In quick C which option is used to compile the program [A] Alt F9 [B] ctrl + Alt F9 [C] Alt Rcx [D] Alt R C F9 Answer : C 1009 What is the conversion character for unsigned hexadecimal [A] %lu [B] %u [C] %n [D] %0 Answer : C 1010 What is the value of i in the below program
main() { int i=3 printf(\n i=%u,&i) printf(\n i=%d,i) printf(\n I=%d,*(&I)); }
Main ( ) { printf ( %d%d%d, size of (3.14f), size of (3.14), size of (3.14l)); } [A] 444 [B] 4 Garbage value Garbage value [C] 4 8 10 [D] Error Answer : A 1012 ___ statement in the switch case statement skips all the remaining statements and exits the switch block. [A] end [B] exit [C] break [D] block Answer : C 1013 Switch case is _________ [A] option based [B] loop construct [C] unconditional statement [D] selective construct Answer : D 1014 When is default statement executed in switch case construct? [A] Whenever there is exactly zero matches Whenever break statement is omitted in all case [B] statements. [C] Whenever there is match with case labels. [D] Whenever there are multiple matches. Answer : A 1015 switch (s)
{ case 1: case 2: case 3: case 4: default: printf(Balan) printf(Elango) printf( Thiruvalluvan) printf(Kamban)
int ones, twos, threes, others; int c; ones = twos = threes = others = 0; while ((c = getchar ( )) ! = \n) { switch (c) { case 1: ++ ones; case 2 : ++ twos; case 3 : ++ threes; break; default : ++ others; break ; } } printf(%d%d, ones, others); } If the input is 1a1b1c what is the output?
[A]
13
1019 In the conditional statement, if the conditional operator is non zero which of the following expressions is executed first? [A] expression 1 [B] expression 2 [C] both the expressions only expression 1 even if conditional statement is [D] false Answer : A 1020 In the conditional statement, if the conditional operator is zero which of the following expressions is executed first? [A] expression 1 [B] expression 2 [C] both the expressions only expression 1 even if conditional statement is [D] false Answer : B 1021 Consider the evaluation of the following
function? y = 1.5 x + 3 for x 2 y = 2 x + 5 for x > 2 This can be evaluated using the conditional operator as
information is given as 4 x + 100 for x > 40 Salary = 300 for x = 40 4.5 x + 150 for x > 40
salary = (x! = 40) ? ((x < 40) ? (4 * x + 100) : (4.5 * x + 150)) : 300; salary = (x! = 40) ? (4 * x + 100) : (x < 40) ? (4.5 * x + 150)) : 300; salary = (x! = 40) ? (4 * x + 100) : 300 : (x < 40) ? (4.5 * x + 150) salary = (x! = 40) ? (4 * x + 100) : 300 : (x < 40) ? (4.5 * x + 150) : 300
1024 if (x < = 40) if (x < 40) salary = 4 * x + 100; else salary = 300; else salary = 4.5 * x + 150; The conditional expression for the following code is salary = (x! = 40) ? ((x < 40) ? (4 * x + 100) : (4.5 [A] * x + 150)) : 300; salary = (x! = 40) ? (4 * x + 100) : (x < 40) ? (4.5 [B] * x + 150)) : 300; salary = (x! = 40) ? (4 * x + 100) : 300 : (x < 40) ? [C] (4.5 * x + 150) salary = (x! = 40) ? (4 * x + 100) : 300 : (x < 40) ? [D] (4.5 * x + 150) : 300 Answer : A 1025 The expression 5 < 10 ? 6 > 8 ? 5 : 3 : 7 is reduced to
_____after evaluating the first expression in it [A] 5 > 10 : 3 ? 7 [B] 5 > 10 ? 3 : 7 [C] 5 > 10 : 3 : 7? [D] 5 > 10 ? 3 ? 7 Answer : B 1026 The conditional expression should be written within the parenthesis in any [A] control construct should not be written within the parenthesis in [B] any control construct [C] should be written within the control construct [D] should not be written within the control construct Answer : B 1027 What is the result of int variable result if x = 50, y = 75 and z = 100? result = (x + 50? y > = 75 ? z > 100 ? 1 : 2 : 3 : 4); [A] 1 [B] 2 [C] 3 [D] 4 Answer : B 1028 Identify the unconditional control structure. [A] do-while [B] switch-case [C] goto [D] if Answer : C 1029 main()
int a = - 4, r, num = 1; r = a % - 3; r = (r ? 0 : num * num); printf (%d, r); } What will be the output of the program?
1030 From the below conditional statement which is executed if the condition is false?
x < 0? x : x; [A] x [B] -x [C] 0 [D] x, -x Answer : A 1031 From the below conditional statement which is executed if the condition is true? x < 0? x : x; [A] x [B] -x [C] 0 [D] x, -x Answer : B 1032 What is the output :
void main() { int a,b=5,c=10; a = (b-c) > (c-b) ? b : c; printf(%d,a); }
10 5 0 Error
1 3 4 5
1034 If break statement is omitted in each case statement [A] the program executes the statements following the case statement where a match is found and exits the
switch case construct the program executes the statements following the case statement where a match is found and also all the subsequent case statements and default statements The program executes default statements only and continues with the remaining code Syntax error is produced
1035 If default statement is omitted and there is no match with case labels [A] no statement within switch case will be executed [B] syntax error is produced executes all the statements in the switch case [C] construct [D] executes the last case statement only Answer : A 1036 The break statement is used in [A] selective control structures only [B] conditional control structures only [C] unconditional control structures only [D] switch case control structures only Answer : A 1037 The break statement is used to [A] continue the next iteration of a loop construct exit the block where it exists and continues further [B] sequentially exit the outermost block even if it occurs inside the [C] innermost block and continues further sequentially [D] terminate the program Answer : B 1038 Omitting the break statement from the particular case [A] leads to a syntax error [B] causes execution to terminate after that case [C] causes execution to continue all subsequent cases causes execution to branch to the statement after [D] the switch statement Answer : C 1039 A multi way decision statement is known as
1040 The case labels should be ___________ [A] unique [B] generated as many as required [C] limited [D] two or three Answer : A 1041 The default statement in the switch case statement is ________ [A] optional [B] compulsory [C] based on the conditions [D] not used in switch case statement Answer : A 1042 In case of nested switch statements the switch may be a part of ________ block [A] switch [B] case [C] continue [D] conditional Answer : B 1043 The _________ statement which is at the end of each block signals the end of a particular case and causes an exit from the switch statement. [A] end [B] exit [C] break [D] block Answer : C 1044 The constant expressions in the switch statement are known as [A] expressions [B] integral constants [C] case labels [D] labels Answer : C 1045 When the default statement is present it will be executed if if the value of the expression does not match with [A] any of the case values
if at least one value of the expression does not match with any of the case values if all the conditions are true if at least one condition is not applicable
{ int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }
0 6 3 None of these
experience); case 2: printf ( \nFriction is a drag); break ; case 3: printf (\nIf practice makes perfect, then nobodys perfect); } }
A mouse is an elephant built by the Japanese Breeding rabbits is a hare raising experience Friction is a drag If practice makes perfect, then nobodys perfect
1049 When a break statement is encountered in the program [A] program terminates [B] control comes out of that loop [C] control comes out of the program [D] none Answer : B 1050 main()
{ int i=2; switch(i) { case 1: printf(Iam in case 1); case 2: printf(Iam in case 2); case 3: printf(Iam in case 3); Default: printf(Iam in default); } } What is the output of
the
above
code
1051 If switch statement is used then [A] default case must be present [B] default case should be last case [C] default case can be placed anywhere [D] none Answer : C
[B]
[C]
[D] Answer : A
1053 The while is [A] test condition controlled statement [B] entry controlled loop statement [C] entry controlled condition statement [D] test controlled statement Answer : B 1054 The while is executed [A] even if the test condition is false [B] at least once even if the test condition is false [C] only if the test condition is true [D] only once if the test condition is true Answer : C 1055 Identify the loop constructs? [A] goto [B] break [C] if else [D] while Answer : D 1056 Which of the following is not a unconditional construct? [A] goto [B] break [C] continue [D] while
Answer : D 1057 Which of the following is not a selective control structure? [A] if-else [B] if-else-if [C] switch-case [D] while Answer : D 1058 Which of the following is an infinite loop? [A] while (1){} [B] while (0) {} [C] while( ) {} [D] while (){} Answer : A 1059 Which of the following is an infinite loop? [A] while (!0){} [B] while (0) {} [C] while( ) {} [D] while (){} Answer : A 1060 while (a < 10) { printf(%d\n, a); a ++; } What is the output of the above statement? [A] numbers from 1 to 10 [B] numbers from 10 to 1 [C] even numbers from 1 to 10 [D] odd numbers from 10 to1 Answer : A 1061 What is the output of the following program? int count = 11; while (--count +1); printf (count down is %d\n, count); [A] -1 [B] count down is -1 [C] does not execute [D] gives an error Answer : B 1062 What is the output of the following program?
# define TRUE 0 main () {
The statements in the loop will be executed gives an error while executing This wont go into the loop as TRUE is defined as 0 the statements in the loop will not be executed
1063 The minimum number of times a while loop is executed is _________ [A] 0 [B] 1 [C] continues till the end of the loop [D] does not execute even if the loop is correct Answer : A 1064 while( x = 10)
{ } results in an _________ loop.
1065 A while is an __________ [A] selective construct [B] unconditional statement [C] loop construct [D] conditional construct Answer : C 1066 The minimum number of times the do-while loop executed is [A] 0 [B] 1 [C] 2 [D] cannot be predicted Answer : B 1067 The do-while loop is terminated when the conditional expression returns [A] zero [B] 1
[C] non-zero [D] -1 Answer : A 1068 Which of the following statements is correct? [A] while loop can be nested [B] while cannot be nested one type of loop cannot be nested into another [C] type of loop [D] for loop cannot be nested into while loop Answer : A 1069 Which of the following is an infinite loop for int x =10?
while (1) { if (!(x ! = 10)) continue; } while (!0) { --
[A]
[B]
---do { }
if (x = = 10) continue;
[A]
infinite loop
[B] Error [C] 99..99..99 [D] 3..2..1 Answer : C 1071 The process of detecting and correcting the errors in the program is called as [A] Correction [B] Verification [C] Debugging [D] Error detection Answer : C 1072 When is syntax errors in a program are found: [A] During execution [B] During compilation [C] Before compilation [D] After execution Answer : B 1073 Which of the following does not lead to run time errors? [A] Dividing by zero [B] Square root of the negative number [C] Logarithm of zero [D] Exceeding the system dependent limits Answer : C 1074 How many arithmetic operators are there? [A] 5 [B] 6 [C] 3 [D] 4 Answer : A 1075 Which of the following is an arithmetic operator? [A] < [B] | [C] || [D] + Answer : D 1076 The value of 14 % 3 is [A] 2 [B] -2 [C] 4 [D] -4
Answer : B 1077 If x = 6.0 and y = 7.0 then the value of x / y is [A] -0.857143 [B] 0.857143 [C] 0.857143 [D] 1 Answer : B 1078 The value of 2.0 / 3.0 = _______ [A] 0.666667 [B] - 0.666667 [C] 0.666667 [D] 0 Answer : B 1079 When a function has no arguments and no return values it does not receive any data from the calling [A] function [B] it returns a value [C] it receives data from the calling function data transfer takes place between calling function [D] and the called function Answer : A 1080 When a function with arguments and no return values it does not receive any data from the calling [A] function and returns a value [B] it only returns a value it receives data from the calling function and also [C] sends data to it data transfer takes place between calling function [D] and the called function in one way Answer : D 1081 When a function with arguments and with return values [A] it returns only one value [B] it only passes some arguments it is a two way communication between the calling [C] program and the function block [D] it returns the arguments as values Answer : C 1082 The actual arguments cannot be
a constant or a variable a different type from the formal arguments other functions expressions
1083 Parameters are used to [A] return values from the called function [B] return values from the calling function [C] send values to the called function [D] to specify the data type of the return value Answer : C 1084 Which of the following is not passed to a function [A] a constant [B] a variable [C] a structure [D] a identifier Answer : D 1085 When we pass array as a parameter to a function _____ is passed. [A] first element is passed [B] all elements are passed [C] address of first element is passed [D] error Answer : C 1086 main()
{ int a, b, c = 0; for (a = 1; a<=5; a ++) { b = f1(a++); c=c+b; } printf(%d,c); } f1 (int b) { return ++b; }
12 20 15 7
int a, b, c = 0; for (a = 1; a<=5; a ++); { b = f1(a++); c = c + b; } printf (%d, c); } f1 (int b) { return ++b; }
12 20 15 7
11 5 6 Error
1093 The program execution starts from [A] the function which is first defined [B] the main( ) function [C] the function which is last defined [D] the function other than main( ) Answer : B 1094 The data type that cannot be renamed by typedef is [A] function [B] structure
[C] pointer [D] double Answer : A 1095 How is a variable accessed from another file? The global variable is referenced via the global [A] specifier The global variable is referenced via the extern [B] specifier The global variable is referenced via the auto [C] specifier The global variable is referenced via the pointer [D] specifier Answer : B 1096 Which of the following is/are achieved using typedef facility? 1. increase the portability of the code 2.write more compact code [A] both the options 1 and 2 [B] only option 1 [C] only option 2 [D] neither option 1 nor option 2 Answer : A 1097 What does invoking the C compiler accomplish? [A] It links together object files [B] It creates machine code It only provides code evaluation. You must use the [C] linker to assemble and link programs [D] It interprets files at run time Answer : D 1098 The storage class allowed for parameters is [A] auto [B] static [C] Extern [D] register Answer : D 1099 Functions are assigned by default [A] auto storage class [B] static storage class [C] extern storage class [D] register storage class Answer : C
1100 The storage class specifiers are used to specify the ________ of the variables within the program. [A] scope [B] value [C] address [D] data type Answer : A 1101
#include void func() { int x = 0; static int y = 0; x++; y++; printf( "%d -- %d\n", x, y ); } int main() { func(); func(); return 0; } What will the code above print when it is executed?
[A] [B]
1-- 1 11 1 -- 1 1 -- 2 1 -- 1
[C] 2 -- 1 1 -- 0 [D] 1 -- 0 Answer : B 1102 The default value of the static and external variables is [A] 00 [B] 10 [C] 01 [D] Garbage value Garbage value Answer : A 1103 The default value of register and auto variables is [A] 00 [B] 10 [C] 01
[D] Garbage value Garbage value Answer : D 1104 The scope of the static and extern variable is [A] local local [B] local global [C] global local [D] global global Answer : B 1105 The scope of register and auto variables is [A] local local [B] local global [C] global local [D] global global Answer : A 1106 The scope of static and register variables is [A] local local [B] local global [C] global local [D] global global Answer : A 1107 The scope of register and auto variables is [A] local local [B] local global [C] global local [D] global global Answer : A 1108 The default value for static and register variables is [A] 00 [B] 0 Garbage value [C] Garbage value 0 [D] Garbage value Garbage value Answer : B 1109 The default value for extern and autos variables is [A] 00 [B] 0 Garbage value [C] Garbage value 0 [D] Garbage value Garbage value Answer : B 1110 char sub[10] = ????; Which of the following statements cannot be used to replace
the ???? in the above syntax to initialize sub with the string Maths? [A] {Maths} [B] {M, a, t, h, s, \0} [C] {M aths} [D] {Mat hs} Answer : C 1111 main()
{ char s1[100]; char s2[100]; gets(s1); fgets (s2, sizeof(s2), stdin); printf(%d\n, strlen(s1) strlen(s2));
} What will be printed when the above code is executed and the string abcd is entered twice on stdin?
-1 0 1 4
1112 A char array with the string value aeiou can be initialized as [A] char s[] = {a, e, i, o, u}; [B] char s[] = aeiou; [C] char s[] = {a, e, i ,o, u, \0}; [D] options a and b Answer : D 1113 main ()
{ char s[] = Focal Point; printf(%d\n, ????);
} Which of the following could replace the ???? in the code above to print the index of the first occurrence of the letter o in s (in this case the value would be 1)?
1114 Which of the following is false in case of external variable declaration [A] does not allocate memory [B] cannot be initialized
[C] uses keyword extern [D] allocates memory Answer : D 1115 External variable does not require [A] declaration [B] keyword [C] definition [D] initialization Answer : B 1116 Which of the following is false in case of external variable declaration [A] is specified outside main ( ) [B] reserves memory for storage [C] is defined only once [D] uses keyword Answer : B 1117 The storage class specifier __________ is a recommendation to the compiler to store a variable in one of the computers registers. [A] register [B] Auto [C] scope [D] function prototype Answer : A 1118 A variable declared outside any block or function is called an _____ variable. [A] global [B] external [C] both a, b [D] none Answer : C 1119 For a local variable in a function to retain its value between calls to the function, it must be declared with the _____ storage class specifier. [A] dynamic [B] static [C] auto [D] none Answer : B 1120 main()
{ printf("%d", out);
} int out=100;
main() { int x; for (x = 1; x < = 3; x++) fun(); } fun( ) { static int y = 0; y = y + 1; printf(y = %d\n, x); } The output of the above program is
fun(); } fun( ) { int y = 0; y = y + 1; printf(y = %d\n, x); } The output of the above program is
main () { int x = 80, a = -80; void swap(int , int); swap (x, a); printf(numbers are %d \t%d, a, x); } void swap (int y, int b) { int t = y; y = b; b = t; }
numbers are 80 -80 numbers are 80 80 numbers are -80 80 numbers are -80 -80
int x = 80, a = -80; void swap(int , int); swap (x, a); printf(numbers are %d \t%d, a, x); } void swap (int y, int b) { int t = y; y = b; b = t; } In the above code the formal parameters are
x, y x, a a, b y, b
main () int x = 80, a = void swap(int , swap (x, a); printf(numbers } void swap (int y, { int t = y; y = b; b = t; } In the above code -80; int); are %d \t%d, a, x); int b)
x, y x, a a, b y, b
1127 main () { int x = 80, a = -80; void swap(int , int); swap (x, a); printf(numbers are %d \t%d, a, x); } void swap (int y, int b) { int t = y; y = b; b = t; } The value of a is stored in _________ parameter [A] x [B] y [C] b [D] t Answer : B 1128 1
main () 2 { 3 int x = 80, a = -80; 4 void swap(int , int); 5 swap (x, a); 6 printf(numbers are %d \t%d, a, x); 7 } 8 void swap (int y, int b) 9 { 10 int t = y; 11 y = b; 12 b = t; 13 } The function prototype is in _______ line number
[A]
4 5 8 6
main () 2 { 3 int x = 80, a = -80; 4 void swap(int , int); 5 swap (x, a); 6 printf(numbers are %d \t%d, a, x); 7 } 8 void swap (int y, int b) 9 { 10 int t = y; 11 y = b; 12 b = t; 13 } The function call is in _______ line number
4 5 8 6
main () { int x = 80, a = -80; void swap(int , int); swap (x, a); printf(numbers are %d \t%d, a, x); }
8 void swap (int y, int b) 9 { 10 int t = y; 11 y = b; 12 b = t; 13 } The function definition is in _______ line number
4 5 8 6
1133 Which parameter of strcpy is destination? [A] 0 [B] 1 [C] 2 [D] 3 Answer : B 1134 strcmp returns zero in __________ condition [A] if two strings are not equal [B] if two strings are equal [C] if two characters are equal [D] if two characters are not equal Answer : B 1135 strcmp (RAM, ram) returns __________ [A] 0
[B] 32 [C] -32 [D] 1 Answer : B 1136 strcmpi (RAM, ram) returns __________ [A] 0 [B] 32 [C] -32 [D] 1 Answer : A 1137 The string related function supplied by C standard library is [A] strlen( ) [B] toupper ( ) [C] tolower( ) [D] all of the above Answer : A 1138 The function that is used to print the reverse of the string [A] strlen() [B] strcat() [C] strcpy() [D] strrev() Answer : D 1139 The following function is used to count and return the number of characters in a given string [A] strcat() [B] strlen() [C] strcmp() [D] strrev() Answer : B 1140 Which of the following statements copies Hello into string a [A] strcpy(Hello, Done); [B] strcpy(Hello, a); [C] strcpy(a, Hello); [D] strcpy(Hello, Hello); Answer : C 1141 The input function scanf ( ) can be used with __________ format specification to read in a string of characters [A] %c [B] %s [C] %d
[D] %f Answer : B 1142 We use generally ________ loop to copy the characters contained inside one string in to the other [A] goto [B] for [C] if [D] switch Answer : B 1143 For writing strings we use _________ function [A] printf( ) [B] scan f( ) [C] read( ) [D] write( ) Answer : A 1144 For reading strings we use _________ function. [A] printf( ) [B] scan f( ) [C] read( ) [D] write( ) Answer : B 1145 The printf( ) uses _________ format to print strings to the screen. [A] %c [B] %s [C] %d [D] %f Answer : B 1146 char x[5][5]; The above array can store [A] five strings each of length 4 [B] four strings each of length 4 [C] five strings each of length 5 [D] four strings each of length 5 Answer : C 1147 The ASCII value of \0 is [A] 0 [B] 1 [C] 2 [D] 3 Answer : A
1148 ________ is called as string terminator [A] character [B] null character [C] null string [D] new line character Answer : B 1149 Symbol of null character is [A] 0 [B] \0 [C] /0 [D] $0 Answer : B 1150 The ______ function will display only one character on the screen. [A] puts() [B] putchar() [C] gets() [D] getchar() Answer : B 1151 In C language the string is assigned to [A] char type of variable [B] string type of variable [C] conversion specification %s [D] integer type of variable Answer : A 1152 The length of the string NEW DELHI is [A] 9 [B] 10 [C] 8 [D] 7 Answer : A 1153 A string in C is ____of character [A] structure [B] list [C] array [D] function Answer : C 1154 Which among these is true when declaring a character array that holds a string? The length of the array should be exactly same as [A] that of the string
The length of the array should be one more than the original size of the string The length of the array should be one less than the original size of the string none of the above
char y[10]; for(int s = 0; x[s];s++) y[s] = x[s]; What is the error in the above statements for copying the contents of x into y?
In the declaration x has no dimension In for loop condition is not proper \0 is not copied to y No error
error 4 5 6
1157 int a[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, x = 4; printf(%d, a[x++]); What is the output? [A] error [B] 4 [C] 5 [D] 6 Answer : C 1158 int a[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, x = 4; printf(%d, a[--x]); What is the value of x? [A] error [B] 4 [C] 5 [D] 6 Answer : B 1159 int a[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, x = 4;
printf(%d, a[x--]); What is the value of x? [A] error [B] 4 [C] 5 [D] 6 Answer : C 1160 If you declare an array of 100 elements the elements have index. [A] 0 through 99 [B] 0 through 100 [C] 1 through 100 [D] 1 through 99 Answer : A 1161 The value with in the [ ] in an array declaration specifies [A] subscript value [B] index value [C] size of an array [D] value of an array element Answer : C 1162 The lower index of an array is called _______ [A] upper bound [B] lower bound [C] minimum value [D] minimum bound Answer : B 1163 The highest index is called ______ [A] upper bound [B] lower bound [C] maximum value [D] maximum bound Answer : A 1164 What is the output of the following program?
#include const int k = 100; main() { int a [100]; int sum = 0; for (k = 0; k < 100; k ++) * (a + k) = k; sum+ = a [ --k]; printf(%d, sum); }
[A]
[B] numbers from 100 to 1 [C] error in the loop [D] error since const value k cannot be modified Answer : D 1165 How can the word YES be stored in any array array[1] = 'Y' array[2] = 'E' [A] array[3] = 'S' array[4] = '\0' array[0] = "Y" array[1] = "E" [B] array[2] = "S" array[3] = "\0" array[1] = "Y" [C] array[2] = "E" array[3] = "S" array[0] = 'Y' array[1] = 'E' [D] array[2] = 'S' array[3] = '\0' Answer : D 1166 Array declaration [A] requires the number of elements to be specified does not require the number of elements to be [B] specified [C] assumes default size as 0 [D] is not necessary Answer : A 1167 If the size of an array is less than the number of initializes, [A] the extra values are neglected [B] it is an error [C] the size is automatically increased [D] the size is neglected Answer : C 1168 Identify the correct statement [A] float array can be read as a whole [B] integer array can be read as a whole [C] char array can be read as a whole [D] Double array can be read as a whole Answer : C 1169 Identify the correct statement [A] float array can be displayed by using single
printf() without using a loop integer array can be displayed by using single printf() without using a loop char array can be displayed by using single printf() without using a loop Double array can be displayed by using single printf() without using a loop
1170 Missing elements of partly initialized arrays are [A] set to zero [B] set to one [C] not defined [D] invalid Answer : A 1171 When should an array be used? [A] When we need to hold variable values [B] When we need to data of the same type When we need to obtain automatic memory [C] cleanup functionality [D] When we need to hold data of different types Answer : B 1172 The value within the [ ] in an array variable specifies? [A] subscript value [B] size of the array [C] value of the array element [D] array bound Answer : A 1173 A list of a finite number of similar data elements referenced respectively by a set of n consecutive numbers is _________ [A] array [B] linear array [C] structure [D] subscript Answer : A 1174 If int occupies 2 bytes then in int a[10] size of a is _________ bytes [A] 2 [B] 10 [C] 20
[D] 40 Answer : C 1175 int a [12] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} int i = 2; printf(%d, i[a]); prints ___________ value. [A] error [B] garbage value [C] 3 [D] address of second element Answer : C 1176 Static int a[]; When the above statement is executed the contents of the array are [A] garbage values [B] zeros [C] first element is zero [D] error Answer : D 1177 Array is used to represent [A] a list of data items of integer data type [B] a list of data items of real data type [C] a list of data items of different data type [D] a list of data items of same data type Answer : D 1178 Array name is [A] an array variable [B] a keyword [C] a common name shared by all elements [D] not used in a program Answer : C 1179 One dimensional array is known as [A] vector [B] table [C] matrix [D] an array of arrays Answer : A 1180 The array elements occupy [A] subsequent memory locations [B] random location for each element varying length of memory locations for each [C] element
[D] no space in memory Answer : A 1181 The array elements are represented by [A] index values [B] subscripted variables [C] array name [D] size of an array Answer : B 1182 The address of the starting element of an array is represented by subscripted variable of the starting [A] element [B] cannot be specified [C] represented by the array name [D] not used by the compiler Answer : C 1183 Identify the wrong statement? [A] Subscripts are also known as indices Array variables and subscripted variables are [B] same Array name and subscripted variables are [C] different [D] Array name and subscripted variables are same Answer : D 1184 Two-dimensional array elements are stored in [A] column major order [B] row major order [C] random order [D] in any order Answer : B 1185 In a multi dimensional array with initialization [A] the right most dimension may be omitted [B] the left most dimension may be omitted [C] nothing must be omitted [D] All may be omitted Answer : B 1186 Int a [3][4] a[1] refers to [A] error [B] address of first element [C] address of second row
[D] address of first row Answer : C 1187 Int a [3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} printf(%d, a[1][2]); prints ___________ value. [A] 7 [B] 4 [C] 5 [D] 6 Answer : A 1188 Int a [3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} printf(%d, a[2][2]); prints___________ value. [A] 7 [B] 11 [C] 5 [D] 6 Answer : B 1189 Int a [3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} printf(%d, a); prints ___________ value. [A] 1 [B] error [C] address of array [D] garbage value Answer : C 1190 Int a [3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} printf(%d, a); prints ___________ value. [A] 1 [B] error [C] address of first element [D] garbage value Answer : C 1191 Int a [3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} printf(%d, &a); prints ___________ value. [A] 1 [B] error [C] address of array [D] garbage value Answer : C 1192 Int a [3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} printf(%d, &a + 1); prints ___________ value. [A] error [B] address of second row
[C] address of array [D] address of second element Answer : B 1193 Int a [3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} printf(%d, &a[0] + 1); prints ___________ value. [A] error [B] address of second row [C] address of array [D] address of second element Answer : D 1194 Int a [3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} printf(%d, &a[0]); prints ___________ value. [A] error [B] address of second row [C] address of array [D] address of second element Answer : C 1195 Int a [3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} printf (%d, a + 1); prints ___________ value. [A] error [B] address of second row [C] address of array [D] address of second element Answer : B 1196 Static int a[5][5] ; When the above statement is executed the contents of the array are [A] garbage values [B] zeros [C] first element is zero [D] first row is zero Answer : B 1197 int a[5][5] ; When the above statement is executed the contents of the array are [A] garbage values [B] zeros [C] first element is zero [D] first row is zero Answer : A 1198 int booklet[3][2][2] = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} printf(%d, booklet[2][1][0]); What is the output?
5 7 9 11
1199 Consider that an integer occupies 4 bytes. Then size of integer array with dimensions 11, 4 (a two dimensional array) would be: [A] 60 [B] 176 [C] 48 [D] 120 Answer : B 1200 int a[3][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
Let base address of a is 65482 Printf(%u, &a); What is the output?
1201 int a[3][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; Let base address of a is 65482 Printf(%u, a[0] ); What is the output? [A] error [B] 65482 [C] garbage value [D] 1 Answer : B 1202 int a[3][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; Let base address of a is 65482 Printf(%u, &a[0][0] + 1); Let integer occupies 2 bytes. What is the output? [A] 65484 [B] 65482 [C] garbage value [D] 1 Answer : A 1203 int a[3][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; Let base address of a is 65482 Printf(%u, a[0] + 1); Let integer occupies 2 bytes. What is the output?
1204 int a[3][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; Let base address of a is 65482 Printf(%u, &a[0] + 1); Let integer occupies 2 bytes. What is the output? [A] 65484 [B] 65482 [C] 65488 [D] 65500 Answer : C 1205 int a[3][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; Let base address of a is 65482 Printf (%u, a + 1); Let integer occupies 2 bytes. What is the output? [A] 65484 [B] 65482 [C] 65488 [D] 65500 Answer : C 1206 int a[3][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; Let base address of a is 65482 Printf (%u, &a + 1); Let integer occupies 2 bytes. What is the output? [A] 65484 [B] 65482 [C] 65488 [D] 65500 Answer : D 1207 int a[3][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; Let base address of a is 65482 Printf (%u, a[0][0] + 1); Let integer occupies 2 bytes. What is the output? [A] 2 [B] 1 [C] 65488 [D] 65500 Answer : A 1208 An upper triangular array is an array in which [A] the elements that are above the diagonal are zeros [B] the elements that are below the diagonal are zeros [C] the elements in which all the elements in the
[D] Answer : B
1209 An lower triangular array is an array in which [A] the elements that are above the diagonal are zeros [B] the elements that are below the diagonal are zeros the elements in which all the elements in the [C] array are zeros [D] a single element is zero above the diagonal Answer : A 1210 A strictly triangular array (upper or lower) is an array in which [A] the elements that are above the diagonal are zeros [B] the elements that are below the diagonal are zeros the elements in which all the elements in the [C] array are zeros [D] the elements of the diagonal are also zero Answer : D 1211 A sparse array is an array in which [A] all the elements in the array are zero [B] all the upper diagonal elements are zero [C] all the lower diagonal elements are zero [D] the majority of elements are zeros Answer : D 1212 The output of the following program is
{ for (x = 0; x < N; x ++) for (y = 0; y < N ; y ++) a [x][y] = 0; a [x][x] = 1;
prints the matrix prints the N x N matrix prints the N x 2 matrix prints the 2 x N matrix
prints the matrix prints the N x N matrix prints the N x 2 matrix prints the 2 x N matrix
1214 The automatic storage class has [A] temporary storage [B] automatic variable [C] persistent storage [D] file scope Answer : A 1215 The register storage class has [A] temporary storage [B] automatic variable [C] persistent storage [D] file scope Answer : A 1216 The storage class type of internal static has [A] persistent storage [B] file scope [C] temporary storage [D] automatic variable Answer : A 1217 Which storage class may help in faster execution? [A] static [B] extern [C] register [D] auto Answer : C 1218 Which storage class does not specify local variables? [A] extern [B] auto [C] register [D] internal static Answer : A 1219 Which storage class does not specify global variables? [A] extern [B] external static [C] typedef [D] register
Answer : D 1220 External variable declaration uses [A] the keyword external [B] the keyword extern [C] no keyword such as extern or external [D] the keyword register Answer : B 1221 External variable definition uses [A] the keyword external [B] the keyword extern [C] no keyword [D] the keyword auto Answer : C 1222 External variable does not requires [A] declaration [B] definition [C] initialization only [D] keyword Answer : D 1223 What does extern means in a function declaration? [A] the function has global scope [B] the function need not be defined [C] nothing really the function has local scope only to the file it is [D] defined in. Answer : C 1224 Which of the following is false in case of external variable definition [A] creates a variable [B] allocates memory [C] does not use extern keyword [D] does not allocate memory Answer : D 1225 The ________ number of times function sq is
called #include main() { int a, b; for (a = 1; a<=5; a ++) { b = sq(a);
0 5 4 2
main() { int a, b; for (a = 1; a<=5; a ++); { b = sq(a); printf(%d,b); } } sq (int b) { return b * b; } What is the output of the above program?
main() { int a, b; for (a = 1; a<=5; a ++); { b = sq(a); printf(%d,b); } } sq (int b) { return b * b; } The number of times function sq is called is _____
0 5 1
1229 While passing a two dimensional array as a parameter number of rows and columns of 2D array must be [A] mentioned number of rows and columns of 2D array may not [B] be mentioned [C] only number of rows must be mentioned [D] only number of columns must be mentioned Answer : D 1230 ____ functions are predefined and are supplied along with the compiler. [A] library functions [B] user defined functions [C] built in functions [D] recursive functions Answer : C 1231 Function declaration always ends with [A] semi colon [B] does not any ending [C] closing braces [D] colon Answer : A 1232 #include
main() { int a, b; for (a = 1; a<=5; a ++); b = sq(a); printf(%d%d, a, b); } sq (int b) {
1, 2 5, 6 6, 7 4, 5
main() { int a, b; for (a = 1; a<=5; a ++) b = sq(a); printf(%d%d, a, b); } sq (int b) { b++; return b ; } The output of the above program is _____
1, 2 5, 6 6, 7 4, 5
main() { int a, b; for (a = 1; a<=5; a ++) b = sq(a); printf(%d%d, a, b); } sq (int b) { int x; for(x = 1;x <=b; x++) b = b*x; return b; } The output of the above program is _____
1235 #include
main() { int a, b; for (a = 1; a<=5; a ++); b = sq(a); printf(%d%d, a, b); } sq (int b) { int x; for(x = 1;x <=b; x++); b = b*x; return b; } The output of the above program is _____
main() { int a, b; for (a = 1; a<=5; a ++); b = sq(a); printf(%d%d, a, b); } sq (int b) { int x; for(x = 1;x <=b; x++) b = b*x; return b; } The output of the above program is _____
[A]
[B] 10 [C] 11 [D] 8 Answer : A 1238 In C which of the following statements are true about the way the arguments are passed? 1. The order of evaluation of arguments is compiler dependent 2. Arguments are passed by reference [A] both options 1 and 2 [B] only option 1 [C] only option 2 [D] neither option 1 nor 2 Answer : B 1239 The variables which are not used to transfer data between a sub program and its calling program is ___ [A] parameters [B] Global variables [C] Local variables [D] arguments Answer : C 1240 The variables which can be accessed by all of the programs modules in a computer program. [A] local variables [B] global variables [C] parameters [D] arguments Answer : B 1241 Which of the following can legitimately be passed to a function? [A] constant [B] variable [C] structure [D] All Answer : D 1242 The keyword __________ is used in a function header to indicate that a function does not return a value or to indicate that a function contains no parameters. [A] void [B] return [C] scope [D] auto
Answer : A 1243 The _________ allows the compiler to check the number, types and order of the arguments passed to a function. [A] void [B] return [C] scope [D] function prototype Answer : D 1244 Variables declared in a block or in the parameter list of a function are assumed to be of storage class ______ unless specified. [A] Rand [B] Auto [C] scope [D] function prototype Answer : B 1245 How many main ( ) functions can be defined in a C program? [A] 1 [B] 2 [C] 3 [D] any number of times Answer : A 1246 A function is identified by ___followed by open parenthesis [A] a keyword [B] an identifier other than keywords [C] an identifier including keywords [D] an operator Answer : B 1247 A function with no action [A] is an invalid function [B] produces syntax errors [C] is allowed and is known as dummy function [D] returns zero Answer : C 1248 Parameters are used [A] to return values from the called function [B] to accept values from the calling function to exchange the values between calling function [C] and called function [D] to specify the data type of the return value Answer :
C 1249 Identify the correct statement A function can be defined more than once in a [A] program [B] function definition cannot appear in any order [C] functions cannot be distributed in many files one function cannot be defined within another [D] function definition Answer : D 1250 The default return data type in function definition is [A] void [B] int [C] float [D] char Answer : B 1251 The parameters in the function call are [A] actual parameters [B] formal parameters [C] dummy parameters [D] optional Answer : A 1252 The parameters in the function definition are [A] actual parameters [B] formal parameters [C] dummy parameters [D] optional Answer : B 1253 The parameters passing mechanism used in C are [A] call by function [B] call by name [C] call by value [D] call by address Answer : C 1254 The storage class that can precede return data type in function declaration is [A] extern [B] intern [C] register [D] address Answer : C
1255 Recursive calls return when [A] a function calls itself [B] a function calls another function [C] a function is inside another function [D] two functions are embedded in another function Answer : A 1256 The main ( ) function calls in the C program [A] allows recursive calls [B] does not allow recursive calls [C] is optional [D] is a built in function Answer : A 1257 The function main( ) is [A] a built in function [B] a user defined function [C] optional [D] recursive function Answer : B 1258 The storage class allowed for parameters is [A] auto [B] static [C] extern [D] register Answer : D 1259 Functions are assigned by default [A] auto storage class [B] static storage class [C] extern storage class [D] register storage class Answer : C 1260 Functions have [A] file scope [B] local scope [C] block scope [D] function scope Answer : A 1261 The function defined in math.h file for returning the arc tangent of x is [A] tan_1(x) [B] a tan(x) [C] tanh(x)
[D] arctan(x) Answer : B 1262 The function ceil (x) defined in math.h returns the value rounded down to the next lower [A] integer returns the value rounded down to the next higher [B] integer [C] the next higher value [D] the next lower value Answer : B 1263 The function floor(x) defined in math.h returns the value rounded down to the next lower [A] integer returns the value rounded down to the next higher [B] integer [C] the next higher value [D] the next lower value Answer : A 1264 What function must all C programs have? [A] start ( ) [B] main( ) [C] return ( ) [D] exit () Answer : B 1265 Which of the following statements in C are true? 1. Two functions can have the same name in a single program 2. Function calls can be recursive [A] both options 1 and 2 [B] only option 1 [C] only option 2 [D] neither option 1 nor 2 Answer : C 1266 Which of the following would compute the square of x in C? [A] pow(2, x) [B] pow(x, 2) [C] x ** 2 [D] power(x, 2) Answer : B 1267 All standard C library functions return what data type? [A] decimal [B] float
[C] double [D] int Answer : C 1268 The variables which can be accessed only with in a particular program or sub program are ___ [A] parameters [B] Global variables [C] Local variables [D] arguments Answer : C 1269 Through return statement _______ number of values can be returned [A] 1 [B] 2 [C] 3 [D] 4 Answer : A 1270 _________ cannot be returned through return statement [A] integer [B] string [C] array [D] structure Answer : C 1271 For a local variable in a function to retain its value between calls to the function, it must be declared with _______ storage class specifier. [A] dynamic [B] fixed [C] static [D] none Answer : C 1272 A function which calls itself directly or indirectly again and again is known as the [A] Recursive function [B] public function [C] private function [D] protected function Answer : A 1273 A function is invoked by [A] function name [B] function class
[C] function call [D] arguments of the function Answer : C 1274 The ______ statement in a called function is used to pass the value of an expression back to the calling function. [A] void [B] return [C] scope [D] auto Answer : B 1275 The _______ qualifier is used to declare read only variables. [A] variable [B] constant [C] var [D] const Answer : D 1276 A function that does not return anything has return type _______ [A] scope [B] void [C] declaratory [D] none Answer : B 1277 A function can [A] perform a task [B] return a value change value of actual arguments in call by [C] reference [D] all of the above Answer : D 1278 Which of the following statements is TRUE with respect to function declaration? [A] Prototype is required for all functions [B] Prototype is not required for all functions Prototype is required for functions returning [C] integers Prototype is required for functions returning [D] pointers Answer : D 1279 ________ statement causes an immediate exit from the function and to give a value.
1280 The program execution starts from [A] the function which is first defined [B] main() function [C] the function which is last defined [D] the function which comes first in the main () Answer : B 1281 What is true about the following C Functions [A] Need not return any value [B] Should always return an integer [C] Should always return a float [D] Should always return more than one value Answer : A 1282 Which of the following about automatic variables within a function is correct? Its type must be declared before using the [A] variable [B] They are local [C] They are not initialized to zero [D] They are global Answer : C 1283 Write one statement equivalent to the following two statements x=sqr(a); return(x); Choose from one of the alternatives [A] return(sqr(a)); [B] printf("sqr(a)"); [C] return(a*a*a); [D] printf("%d",sqr(a)); Answer : A 1284 Storage class does not control [A] life time of a variable [B] scope of a variable [C] linkage of a variable [D] block scope Answer : D
1285 Longevity of a variable refers to the duration for which the variable retains the [A] given value during the execution of the program the portion of a program in which the variable may [B] be visible [C] internal linkage of a variable [D] external linkage of a variable Answer : A 1286 Scope of a variable refers to the duration for which the variable retains a given [A] value during the execution of a program the portion of a program in which the variable may [B] be visible [C] the value of the variable [D] linkage of the variable Answer : B 1287 A variable with external linkage refers to the duration for which the variable retains a given [A] value during the execution of a program the same value for every occurrence of that [B] variable in a particular file the Same value in every source file where source [C] program spans over multiple files [D] block scope Answer : C 1288 A variable with internal linkage refers to the duration for which the variable retains a given [A] value during the execution of a program the same value for every occurrence of that [B] variable in a particular file the Same value in every source file where source [C] program spans over multiple files [D] block scope Answer : B 1289 A variable with no linkage refers to the duration for which the variable retains a given [A] value during the execution of a program [B] the same value for every occurrence of that
variable in a particular file the Same value in every source file where source program spans over multiple files block scope
1290 Which is not a storage class? [A] auto [B] struct [C] static [D] extern Answer : B 1291 The typedef statement is used to [A] create a new data type [B] rename the existing data type [C] to define a storage class [D] create a structure Answer : B 1292 Identify the correct statement? [A] typedef int HOST [B] typedef int HOST; [C] typedef int = HOST [D] typedef int = HOST; Answer : B 1293 The typedef statement does not [A] create new data type [B] backward refer [C] rename the data type [D] reserves memory for storage Answer : A 1294 If the definition of an external variable does not contain an initializer it is known as [A] forward declaration [B] tentative declaration [C] backward reference [D] backward definition Answer : B 1295 main ()
{ } char s[6] = HELLO; printf(%s, s[5]);
0 48 nothing unpredictable
1296 char name [] = {n, a, m, e}; printf(name = %s\n, name); What will be the output? [A] name = name [B] name = name followed by junk characters [C] name = \nname [D] option a or b Answer : B 1297 What would be the result of the following
program? main( ) {char p[] = string; char t; int x, y; for (x = 0, y = strlen(p); x < y; x + +) { t = p[x]; p[x] = p[y x]; p[y x] = t; } printf(%s, p); }
will print: string will not print anything since p will be pointing to a null string will print:gnirts will result in a complication error
1298 char x [] = Hello; if character occupies 1 byte size of x is [A] error [B] 5 [C] 6 [D] 1 Answer : C 1299 If we want to store a string of n characters then we require an array of ____ size? [A] n
[B] 10 [C] n+1 [D] garbage Answer : C 1300 char x [] = HELLO; printf(%d, x[5]); What is the output? [A] error [B] 79 [C] 6 [D] 0 Answer : D 1301 char x [] = Hello; printf(%d, strlen (x)); What is the output? [A] error [B] 5 [C] 6 [D] 1 Answer : B 1302 char x [] = Hello; printf(%d, x[strlen (x)]); What is the output? [A] error [B] 5 [C] 6 [D] 0 Answer : D 1303 Char x[10] = GOOD; Char y[10] = HELLO; Strcpy (x, y); The contents of x and y are [A] GOOD GOOD [B] HELLO HELLO [C] GOOD HELLO [D] HELLO GOOD Answer : B 1304 Char x[10] = GOOD; Char y[10] = HELLO; Strcat (x, y); The contents of x and y are [A] GOODGOOD, HELLO
[B] HELLOHELLO, GOOD [C] GOODHELLO, HELLO [D] HELLOGOOD, HELLO Answer : C 1305 Char x[10] = GOOD; Char y[10] = HELLO; x [0] = y[4]; printf(%s, x); [A] GOOD [B] HOOD [C] OOOD [D] Null Answer : C 1306 Char x[10] = GOOD; Char y[10] = HELLO; x [0] = y[5]; printf(%s, x); [A] GOOD [B] HOOD [C] OOOD [D] Null Answer : D 1307 static char city[][] = {Chandigarh, Madras, Ahmedabad, Hyderabad, Bombay}; If char occupies 1 byte then size of city is [A] 40 [B] 45 [C] 55 [D] 50 Answer : C 1308 static char city[][] = {Chandigarh, Madras, Ahmedabad, Hyderabad, Bombay}; printf(%s, city[2] ); prints [A] error [B] andigarh [C] Ahmedabad [D] Madras Answer : C 1309 static char city[][] = {Chandigarh, Madras, Ahmedabad, Hyderabad, Bombay}; printf(%s, city[0][2] ); prints
1310 static char city[][] = {Chandigarh, Madras, Ahmedabad, Hyderabad, Bombay}; printf(%c, city[0][2] ); prints [A] error [B] andigarh [C] Ahmedabad [D] a Answer : D 1311 char x[] = hello; printf( %d, x[0] x[1] ); What is the output? [A] garbage value [B] error [C] 0 [D] 3 Answer : D 1312 char x[] = hello; printf( %d, x[2] x[3] ); What is the output? [A] garbage value [B] error [C] 0 [D] 3 Answer : C 1313 What is the output of the below program?
main() { char name; name = x ; putchar (name); }
name x x x
1316 The function strcpy(s1, s2) in string.h [A] copies s1 to s2 [B] copies s2 to s1 [C] appends s1 to the end of s2 [D] appends s2 to the end of s1 Answer : B 1317 The function strcat(s1, s2) in string.h [A] copies s1 to s2 [B] copies s2 to s1 [C] appends s1 to the end of s2 [D] appends s2 to the end of s1 Answer : D 1318 The function strcmp(s1, s2) returns zero [A] if s1 is lexicographically less than s2 [B] if s1 is lexicographically greater than s2 [C] if both s1 and s2 are equal [D] if s1 is empty string Answer : C 1319 The function toupper(ch) in ctype.h [A] returns the uppercase alphabet ch [B] returns the lower case alphabet ch [C] returns uppercase if ch is lower case, and lower
[D] Answer : A
1320 The function tolower(ch) in ctype.h [A] returns the uppercase alphabet ch [B] returns the lower case alphabet ch returns uppercase if ch is lower case, and lower [C] case if ch is uppercase [D] is a user defined function Answer : B 1321 The string function strcat( ) [A] concatenates two strings [B] compares two strings [C] copies one string over the other [D] finds the length over the other Answer : A 1322 The string function strcmp( ) [A] concatenates two strings [B] compares two strings [C] copies one string over the other [D] finds the length over the other Answer : B 1323 The string function strcpy( ) [A] concatenates two strings [B] compares two strings [C] copies one string over the other [D] finds the length over the other Answer : C 1324 The string function strlen( ) [A] concatenates two strings [B] compares two strings [C] copies one string over the other [D] finds the length over the other Answer : D 1325 The string related function supplied by C standard library is [A] strcpy( ) [B] strcat ( ) [C] strcmp ( ) [D] all of the above
Answer : D 1326 strcpy has _______ number of parameters [A] 0 [B] 1 [C] 2 [D] 3 Answer : C 1327 Which parameter of strcpy is source? [A] 0 [B] 1 [C] 2 [D] 3 Answer : C 1328 char x[20]; scan f(%s, x); printf(%s, x); When the above code is executed and NEW DELHI is entered from the key board the output is _____ [A] NEW DELHI [B] Error [C] NEW [D] DELHI Answer : C 1329 char x[20]; gets(x); printf(%s, x); When the above code is executed and NEW DELHI is entered from the key board the output is _____ [A] NEW DELHI [B] Error [C] NEW [D] DELHI Answer : A 1330 To read multiple words from the key board ____ input function is used. [A] scanf() [B] read() [C] gets() [D] getchar() Answer : C 1331 Which of the following statement is TRUE?
Delimiter for scanf() is space only Delimiter for scanf() is Enter key only Delimiter for gets() is space only Delimiter for gets() is Enter key only
1332 Which of the following input functions will echos the input onto the screen? [A] getchar() [B] getch() [C] getche() [D] gets() Answer : C 1333 What is the output of the following program?
#include const int k = 100; main() { int a [100]; int sum = 0; for (k = 0; k < 100; k ++) * (a + k) = k; sum+ = a [ --k]; printf(%d, sum); }
numbers from 1 to 100 numbers from 100 to 1 error in the loop error since const value k cannot be modified
for (i = 0; i < 6; i = i + 2) a[i+2] = a[i]; What is the contents of a after this program fragment executes?
[A]
010123456
[B] 234567878 [C] 2 3 4 5 6 7 8 9 10 [D] 010305078 Answer : D 1336 What would be the output of the following programs ? Main ( ) { int arr [ ] = { 12, 13, 14,15, 16}; print f ( \ n %d %d %d, size of (arr), size of (* arr ), size of (arr[o] ) ) ; } [A] 2, 2, 2 [B] 10, 2, 2 [C] 2, 10, 2 [D] 4, 2 Answer : B 1337 Suppose the array begins at address 1500, then what would be output of the following program ?
Main ( ) { int a [ ] = { 4,5,1,2,3,7}; print f ( %d , size of (a) ) ; }
15, 12 12 1500 2
1338 Suppose the array begins at address 1200, then the output of the following program :
Main ( ) { int x [ ] = { 1,2,3,4}; print f ( %d, x + size of (x)); }
1339 What is the output of the following program, if the array begins at address 65486? Main ( ) { int x [ ] = { 10, 15, 20, 1, 0};
print f ( %u %u, x, &x); } [A] 65486, 65486 [B] 65486, 2 [C] 10, 65486 [D] 10, 2 Answer : A 1340 What would be the output of the following program ?
Main ( ) { char x [ ] = Sir ; char y [ ] = Sir ; if (x = = y) print f ( Equal ); else print f ( Unequal) }
1341 Main ( ) { print f( % c, abcd [ 2 ] ); } [A] Error [B] B [C] C [D] D Answer : C 1342 What would be the output of the following program
? Main ( ) { int a [5] = {2,3}; printf ( \n%d %d %d, a[2], a[3], a[4] ) ; }
Garbage values 2, 3, 3 3, 2, 2 0, 0, 0
int arr[] = {12,13,14,15,16} printf(\n%d%d%d, size of (arr), size of (*arr), size of (arr[0] )); }
1345 What will happen it you put too few elements in an array when you initialize it [A] nothing [B] possible system malfunction [C] error mnage form the compiler unused elements will be filled with 0s or [D] garbage Answer : D 1346 What would be the output of the following program assume that the begins at location 1002?
main() { int a[3][4] = { 1,2,3,4, 5,6,7,8, 9,10,11,12 }; printf(\n%u%u%u, a[0]+1,*(a[0]+1),*(*(a+0)+1)); }
[D] None of the above Answer : B 1347 In three dimensional arrays the outer array has ____ elements [A] 9 [B] 2 [C] 3 [D] 6 Answer : C 1348
#include void inc_count (int count) { Count ++; } int main() { int count = 0; /* number of times through */ while (count < 10) inc_count(count); return count ; } What will be the value returned by the function main?
0 10 9 Null
void func() { int x = 0; static int y = 0; x++; y++; printf( "%d -- %d\n", x, y ); } int main() { Func(); func (); return 0; } What will the code above print when it is executed?
11 1 --1 1 -- 1 1 -- 2 1 -- 1
2 -- 1 1 -- 0 [D] 1 -- 0 Answer : B 1350 What does the following function print? func(int i) { if(i %2)return 0; else return 1;} main() { int =3; i=func(i); i=func(i); printf("%d",i); } [A] 3 [B] 1 [C] 0 [D] 2 Answer : B 1351 Main ( )
{ const int x = get ( ); print f ( %d, x );
27 64 4 3
1353 What is true about the following C Functions [A] Need not return any value [B] Should always return an integer [C] Should always return a float
[D] Should always return more than one value Answer : A 1354 Main must be written as [A] The first function in the program [B] Second function in the program [C] Last function in the program [D] Any where in the program Answer : D 1355 In the following code in which order the functions would be called ? a = f1(23,14) *12(12/4) + f3( ); [A] f1, f2, f3 [B] f3, f2, f1 [C] The order may vary from compiler to compiler [D] None of the above Answer : A 1356 What error would the following function give on
compilation ? f ( int a, int b) { int a; a = 20; return a; }
Missing parentheses in return statement The function should be defined as int f ( int a, int b) Re declaration of a None of the above
5 6 3 4
1358 For x = 2, y = 3, z = 1
the following function return int fun(int x; int y; int z) { int sum = 0; for(i = x; i < = y; i + +) for(j = 1; j < = z; z + +) sum = sum + z; return sum; }
2 3 4 5
the following function return int fun(int x; int y; int z) { int sum=0; for(i = x; i < = y; i + +) for(j = 1; j < = z; z + +) sum = sum + z; return sum; }
2 3 1 5
{ int sum = 0; int i; for(i = 0;i < = 5; i + +) sum + = x; return(sum); } the above function value for x = 150
int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+zap(n-1); } then the call zap(6) gives the values of zap
8 9 6 12
1362 Write one statement equivalent to the following two statements x=sqr(a); return(x); Choose from one of the alternatives [A] return(sqr(a)); [B] printf("sqr(a)"); [C] return(a*a*a); [D] printf("%d",sqr(a)); Answer : A 1363 Which of the following about automatic variables within a function is correct? Its type must be declared before using the [A] variable [B] They are local [C] They are not initialized to zero [D] They are global Answer : A 1364 Regarding the scope of the varibles;identify the incorrect statement: automatic variables are automatically initialized [A] to 0 [B] static variables are automatically initialized to 0 [C] the address of a register variable is not accessible static variables cannot be initialized with any [D] expression Answer : A 1365 Which storage class for only these variables, which are being used very often in a program [A] Static [B] Alto [C] Extern [D] Register Answer : D 1366 Which storage class is used for only those variables which are being used by almost all the functions in the program.
1367 If you want the value of a variable to persist between different function calls [A] static [B] register [C] extern [D] auto Answer : A 1368 What would be the output of the following program
? Main ( ) { extern int I; i = 20; printf ( %d,size of (i)); }
be the output of the following program ? Main ( ) { extern int a; printf ( \n%d, a); } int a = 20;
1370 Suppose that x and y are two strings. Which expression will return true whenever x and y contain the same sequence of characters? [A] (x = y) [B] (x == y) [C] (x != y) [D] (strcmp(x, y))
1372 Which one of the following function not standard string library function [A] Strnicmp [B] Strdyp [C] Strnset [D] Strstrr Answer : D 1373 char str[6];
strcpy(str, "BLACK"); strcpy(str, "RED); What are the values of str[3], str[4], str[5] after the two calls to strcpy?
\0, \0, \0 \ 0 , K , \ 0 C , K , \ 0 C , K , R
1, 1 1, 2 2, 2 2, 1
[B] 0 [C] 1 [D] any value Answer : B 1376 Maximum number of elements in the array declaration int x[10]; is [A] 9 [B] 10 [C] 11 [D] undefined Answer : B 1377 Array declaration [A] requires the number of elements to be specified does not require the number of elements to be [B] specified [C] assumes default size as 0 [D] is not necessary Answer : A 1378 If the size of an array is less than the number of initializes [A] e extra values are neglected [B] it is an error [C] e size is automatically increased [D] e size is neglected Answer : B 1379 Identify the correct statement [A] float array can be read as a whole [B] integer array can be read as a whole [C] char array can be read as a whole [D] Double array can be read as a whole Answer : C 1380 Identify the correct statement float array can be displayed by using single [A] printf() without using a loop integer array can be displayed by using single [B] printf() without using a loop char array can be displayed by using single [C] printf() without using a loop Double array can be displayed by using single [D] printf() without using a loop Answer : C
1381 Missing elements of partly initialized arrays are [A] set to zero [B] set to one [C] not defined [D] invalid Answer : A 1382 When should an array be used? [A] When we need to hold variable values [B] When we need to hold data of the same type When we need to obtain automatic memory [C] cleanup functionality [D] When we need to hold data of different types Answer : B 1383 The value within the [ ] in an array variable specifies? [A] subscript value [B] size of the array [C] value of the array element [D] array bound Answer : A 1384 A list of a finite number of similar data elements referenced respectively by a set of n consecutive numbers is _________ [A] array [B] linear array [C] structure [D] subscript Answer : A 1385 If int occupies 2 bytes then in int a[10] size of a is _________ bytes [A] 2 [B] 10 [C] 20 [D] 40 Answer : C 1386 int a [12] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} int i = 2; printf(%d, i[a]); prints ___________ value. [A] error [B] garbage value [C] 3 [D] address of second element
Answer : C 1387 Static int a[]; When the above statement is executed the contents of the array are [A] garbage values [B] zeros [C] first element is zero [D] error Answer : D 1388 Static int a[] = { 1, 2, 3} ; When the above statement is executed the size of array is ______ bytes if int occupies 2 bytes [A] error [B] 0 [C] 3 [D] 6 Answer : D 1389 Static int a[] ; When the above statement is executed the size of array is ____ bytes if int occupies 2 bytes. [A] error [B] 0 [C] 3 [D] 6 Answer : A 1390 To read the values into an array minimum number of loops required are _______ [A] 0 [B] 1 [C] 2 [D] 3 Answer : B 1391 int a[6], x;
for (x = 1; x <= 5; x++) a[x] = x; ________ value is stored in a[0]
0 garbage value 5 6
1393 int n = 5; int a[n] = {1, 2, 3, 4, 5} printf(%d, a[0]); What is the output? [A] 1 [B] 5 [C] error [D] garbage value Answer : C 1394 const int n = 5; int a[n] = {1, 2, 3, 4, 5} printf(%d, a[0]); What is the output? [A] 1 [B] 5 [C] error [D] garbage value Answer : A 1395 #define n 5 int a[n] = {1, 2, 3, 4, 5} printf(%d, a[0]); What is the output? [A] 1 [B] 5 [C] error [D] garbage value Answer : A 1396 int a[10], x;
for(x = 1; x < 10; x + +) { if (x % 3) a[x] = x; } if the above code is executed, array contains ________ number of garbage values
0 10 3 4
numbers from 1 to 100 numbers from 100 to 1 error in the loop error since const value k cannot be modified
1398 Identify the correct declaration [A] int a[10] [10]; [B] int a[10 , 10]; [C] int a(10) (10); [D] int a(10,10); Answer : A 1399 Maximum number of elements in the array declaration int x[5] [8]; is [A] 28 [B] 40 [C] 32 [D] 35 Answer : B 1400 The fseek feature [A] Needs two arguments [B] Makes the rewind feature unnecessary Is meant for checking whether a given file exists [C] or not [D] Need no arguments Answer : B 1401 enum x {a=1,b,c,d,f=60,y}; printf("%d",y); What is the value of y? [A] 5 [B] 61 [C] 6 [D] 6
Answer : B 1402 struct { int len; char *str }*p; ++p -> len; The above program shows? [A] increments p [B] increments len [C] compilation error [D] nothing happens with either of p and len Answer : B 1403 enum day { jan = 1 ,feb=4, april, may}; What is the value of may? [A] 4 [B] 5 [C] 6 [D] 11 Answer : C 1404 struct a{ int x; float y; char c[10]; }; union b{ int x; float y; char c[10]; }; Which is true? [A] sizeof(a)!=sizeof(b); [B] sizeof(a)=sizeof(b); [C] compilation error [D] run time error Answer : A 1405 struct code
{ int i; int t; } /* some code */ main() {} What is wrong ?
Semicolon is missing after structure declaration No wrong mian cannot be after struct none