C++

1 class Dog: public X, public Y is an instance of




Answer is A)


2 Which of the following specifiers is NOT a format flag of a stream ?




Answer is D)


3 Which of the following operators have the same precedence and group left of right ?




Answer is C)


4 Which of the following mode arguments to the function open tells it not to create a file if the named file is not found ?




Answer is A)


5 Which of the following operators has right to left associativity ?




Answer is D)


6 Which of the following statement is TRUE in view of a private member of any given class ?




Answer is C)


7 Which of the following statements is TRUE ?




Answer is B)


8 Identify the operator that cannot be overloaded in C++




Answer is A)


9 Which of the following storage class specifiers can be used in the declaration of class members ?




Answer is B)


10 Which of the following manipulators is not- parameterized ?




Answer is C)


11 The function fwrite returns




Answer is C)


12 A function which is automatically invoked when an object is created is known as




Answer is D)


13 Which of the following statements is FALSE in view of polymorphism in C++




Answer is C)


14 Assuming that n is an integer variable, identify a legal declaration of a reference from the following options




Answer is B)


15 Which of the following operators cannot be overloaded ?




Answer is D)


16 Which of the following statements is TRUE ?




Answer is A)


17 Which of the following functions can be called before any objects are instantiated ?




Answer is A)


18 Which of the following calls is one of the possible ways to change a stream’s format flags ?




Answer is C)


19 What is the maximum number of constructors a class may have ?




Answer is D)


20 Which header file must be included to use the operator delete in a C++ program ?




Answer is A)


21 Which of the following function prototype is in-correct ?




Answer is C)


22 Which of the following statements is FALSE in view of reference ?




Answer is D)


23 A derived class inherits all members of its base class, but can only use the




Answer is A)


24 In C++, the keyword auto can be used for




Answer is B)


25 Which of the following is a parameterized manipulator ?




Answer is C)


26 An exception is processed using




Answer is C)


27 Which of the following operator is used to access a structure member through a pointer ?




Answer is A)


28 In n is initialized to 7, the expression n<<4>>3<<2 evaluates to




Answer is A)


29 What is the return type of a constructor ?




Answer is D)


30 When an object of a derived class is destroyed then




Answer is D)


31 Let “i” be a public static integer member of a class “X” and “a”,”b” are objects of type “X”. Which of the following statements is not a valid way to access “i” ?




Answer is D)


32 A private member function of a class can be called by




Answer is D)


33 A variable declared within a block { } has the following scope




Answer is B)


34 C++ provides signed and unsigned character data type because




Answer is C)


35 A value that is automatically passed to function when no explicit argument is specified in the function call is called




Answer is B)


36 Reference to an object behaves like




Answer is B)


37 Which of the following declarations of reference type variables is flawless ?




Answer is C)


38 Which is true ?




Answer is B)


39 Which is true ?




Answer is A)


40 A function can




Answer is A)


41 When a nonmember function needs to refer to instances of two different classes, then




Answer is B)


42 A forward reference




Answer is A)


43 When a function tries to access an object’s private data member




Answer is A)


44 The prototypes for all functions that are friends of a class are listed with the other function prototypes




Answer is C)


45 A class may




Answer is D)


46 you use data hiding when you create




Answer is B)


47 Creating a class definition when one class is granting friendship to a function that is a member of another class requires first




Answer is B)


48 If MyClass is a friend of Your-Class, which is true ?




Answer is C)


49 If MissysClass is a friend of HarryClass, then which is true ?




Answer is A)


50 You need to multiply two private data members of two separate objects that are of the same class. You would




Answer is D)


51 When you declare a member of another class to be a friend, you must use




Answer is C)


52 You need to display two private data members from one object of a class. You would




Answer is A)


53 Forcing a variable type to become another type before accessing an appropriate function is known as




Answer is D)


54 Without overloading of the +operator,




Answer is D)


55




Answer is )


56 The name of the operator function that overloads the * symbol is




Answer is A)


57 Assuming you have properly overloaded the *operator to perform multiplication for a Number class, and that a,b and c are three members of the Number class, which expression is legal ?




Answer is C)


58 Which of the following is the best function prototype for an overloaded — for a Number class ?




Answer is A)


59 When you overload an operator for use with you classes, you




Answer is C)


60 When you overload operators, you may change




Answer is C)


61 Assuming you have properly overloaded the ! Operator for a Number class, and that a and b are two members of the Number class, which expression is legal ?




Answer is A)


62 if the >> operator is overloaded properly for use for input with a Number class, and a and b are member of the Number class, which of the following statements is allowed ?




Answer is A)


63 If the << operator has been overloaded appropriately for the class Number, and a and b are members of the Number class, then which statement is legal ?
Answer is C)


64 Which of the following is the best prototype to overload the << operator for a Number class ?




Answer is B)


65 If the subscript operator has been correctly overloaded for a Number class to accept an integer value, and num is a member of the number class, which of the following statements is correct ?




Answer is C)


66 Which of the following statement is true ?




Answer is B)


67 When the >> operator is overloaded for input, one parameter that should be passed to the function is a




Answer is A)


68 If you use a filename as an argument when calling an ofstream constructor,




Answer is A)


69 In the statement if (x) cout<<"File opened!",, X must be a




Answer is A)


70 If you create an array of objects, the write( ) function can work with




Answer is C)


71 if you don’t provide a filename as an argument when you instantiate an ofstream object then




Answer is C)


72 Inheritance is the principle that




Answer is B)


73 To be called object-oriented, a programming language must allow




Answer is C)


74 Which is a correct class definition for class Child, which inherits from Mother and Father classes ?




Answer is D)


75 You may override the class access specifier for




Answer is C)


76 The prototype for a derived class constructor may include arguments for




Answer is C)


77 A default constructor




Answer is C)


78 If you want to override constructor default values for an object you are instantiating, you must also override




Answer is B)


79 Reference variables and const class member




Answer is C)


80 In heritance is a way to




Answer is D)


81 In an exception is thrown and no catch block matches the type of the thrown parameter, then




Answer is A)


82 If two types of errors may be thrown, you should write




Answer is D)


83 A function can make




Answer is D)


84 The primary purpose of exception specification is




Answer is A)


85 A default exception block must be placed




Answer is B)


86 The program can access the private members of the class




Answer is C)


87 To hide a data member from the program, you must declare the data member in the section of the class




Answer is D)


88 The best-written classes have




Answer is D)


89 If you declare two objects as Customer firstCust, secondCust: which of the following must be true




Answer is C)


90 The feature in object-oriented programming that allows the same operation to be carried out differently, depending on the object, is




Answer is B)


91 The function printDataMembers( ) is most likely a(n)




Answer is A)


92 Which of the following is a good guideline for creating function names ?




Answer is D)


93 A function’s purpose is to print customer data. Which of the following is the best name for this function ?




Answer is C)


94 Reserving memory during program execution is known as reserving it




Answer is A)


95 With communicational cohesion




Answer is C)


96 Which of the following is true ?




Answer is B)


97 If a derived class uses the public access specifier, then




Answer is A)


98 When a class serves as a base class to others,




Answer is B)


99 Which of the following constructor function prototypes would be correct in the declaration section of a class named Product that contains one data member, prodNum ?




Answer is D)


100 The most common operation used in constructors is




Answer is C)


101 A constructor initialization list is preceded by




Answer is B)


102 The statement double total = 0.0; performs




Answer is B)


103 Static variables are sometimes called




Answer is A)


104 you must precede the destructor name with




Answer is D)


105 The dot operator (or class member access operator) connects the following two entities (reading from left to right):




Answer is D)


106 When you create a derived class and instantiate on object




Answer is A)


107 Advantages of inheritance include




Answer is D)


108 A derived class override attributes of a parent class




Answer is A)


109 A function in a derived class that has the same name as a function in the parent class




Answer is A)


110 Before object-oriented exception handling was practiced




Answer is C)


111 One drawback to returning an error code from a function is




Answer is C)


112 The difference between a return and a throw is that




Answer is D)


113 The general principle underlying object- oriented error handling is that a called function should




Answer is B)


114 Another drawback to returning an error code from a function is that any error code returned by the function




Answer is A)


115 If a class object is thrown with a throw statement, then a subsequent catch block has a usable match if the type of the catch argument is




Answer is A)


116 Any exception specification appears in




Answer is D)


117 When the function int someFunction(char c) throw( ) is executed,




Answer is D)


118 If you want to use a class to define objects in many different programs, you should define the class in a C++ file




Answer is A)


119 The name of the constructor function for a class named animal is




Answer is A)


120 Which of the following creates an animal object named dog ?




Answer is B)


121 Which of the following tells C++ that the displayBreed function is a member of the animal class ?




Answer is D)


122 You place the constructor’s prototype in the section of the class




Answer is C)


123 Making class members inaccessible to nonmember functions is an example of




Answer is B)


124 Which (if any) of the following is NOT a programmer-defined type ?




Answer is D)


125 To use the this pointer with a member function, you




Answer is D)


126 An auxiliary function




Answer is C)


127 A data member holds a 1 or 0 depending on whether taxes have been paid. The best identifier for this member is




Answer is B)


128 Many programmers separate a class into two files:




Answer is A)


129 C++ allows you to define the same functions more than once in the same program




Answer is D)


130 If you create a class named SaleItem and each instantiation of the class requires 50 bytes, which of the following allocates enough memory for one SaleItem object, assuming that ptr is properly defined ?




Answer is D)


131 Procedural cohesion is similar to sequential cohesion, except that with procedural cohesion




Answer is D)


132 The best functions have




Answer is B)


133 Which of the following statements is true ?




Answer is C)


134 The weakest form of cohesion is




Answer is A)


135 The code class Desendant : virtual public Ancestor indicates that




Answer is B)


136 A program that predicts the exact sequence in which events will take place is said to be




Answer is C)


137 Which of the following are good reasons to use an object-oriented language




Answer is D)


138 When two types are used in a function template and one is labeled T, the other




Answer is A)


139 The compiler determines the type uses in a template function via




Answer is C)


140 Each generic type in a template function definition is preceded by the keyword




Answer is A)


141 If you create an instantiation of a class template with an int, and then create a second instantiation with a double, then




Answer is A)


142 With a template class, type is generic




Answer is C)


143 Variable names known only to the procedure in which they are declared are




Answer is A)


144 Paying attention to the important properties while ignoring inessential details is know as




Answer is C)


145 In C++, a function contained within a class is called




Answer is A)


146 You overload function templates




Answer is B)


147 Function templates




Answer is C)


148 Before you code a template function, you include a




Answer is A)


149 A function that is prototyped as double calculate(int num); may




Answer is C)


150 Overloading involves writing two or more functions with




Answer is C)


151 A major advantage of inheritance is




Answer is A)


152 The rules to any programming language are its




Answer is C)


153 If container classes are carefully constructed, then these tools are available to work with structures that are not




Answer is C)


154 A function that can access private members of a class, even though it is not a member of the class itself, is




Answer is A)


155 In C++ a function contained within a class is called




Answer is A)


156 the break statement causes an exit




Answer is D)


157 A list of data items, usually words or bytes, with the accessing restriction that elements can be added or removed at one end of the list only, is known as




Answer is A)


158 Consider a linked list of n elements. What is the time taken to insert an element after an element pointed by some pointer ?




Answer is A)


159 Which of the following sorting method is stable?




Answer is A)


160 A widget is to the blueprint for a widget as an object is to




Answer is B)


161 A search procedure whichassociates an address with a key value and provides a mechanism for dealing withtwo or more values assigned to the same address is called




Answer is C)


162 A variable defined within a block is visible




Answer is C)


163 The liabrary function exit() causes an exit from




Answer is D)


164 The extra key inserted at the end of the array is called a




Answer is C)


165 The function scanf() reads




Answer is D)


166 The basic unit of informatiion is the




Answer is B)


167 The most widely used method for interpreting bit settings as nonnegative integers is the




Answer is D)


168 The method used by computers to represent real number is




Answer is A)


169 The vaiables which can be accessed by all modules in a program, are known as




Answer is D)


170 The postfix from of (A+B)*C is




Answer is A)


171 The goto statement causes control to go to




Answer is B)


172 The postfix form of A-B/(C*D$E) is




Answer is A)


173 The prefix form of A-B/(C*D$E) is




Answer is C)


174 The prefix of (A+B) *(C-D) is




Answer is C)


175 A sort whichrelatively passwes through a list to exchange the first element withany element less than if and then repeats with a new first element is called




Answer is B)


176 A sort which compares adjacent elements in a list and swithces where necessary is a




Answer is D)


177 A characertistic of the data that binary search uses but the linear search ignores is the




Answer is A)


178 The postfix form of A+(B*C) is




Answer is B)


179 the directive required in any program that useseither cin or cout is;




Answer is B)


180 Which of the following is a valid identifier?




Answer is C)


181 Write a single C++ statement that subracts the sum of x and y from z and then increments y.




Answer is B)


182 Write a single C++ statement that decrementsthe variable h and then adds it tio total




Answer is A)


183 In m *= n ++; expressioin, assume that m ahs the value 5 and n has the value 2 before the statement executes. Tell what the the values of m and n will be after the statement executes.




Answer is C)


184 The most C++ progtrammers




Answer is D)


185 The symbols used with input stream cin I.e. “console input” are:




Answer is B)


186 If you wanted to sort many large objects or structutres it would be most efficient to




Answer is B)


187 In C++ programming, which of the following operator is used for “not equal to”




Answer is C)


188 The function abort() is declare in the header file




Answer is B)


189 The fput() function is declare in the header file




Answer is D)


190 The function isalpha() is declare in the header file




Answer is A)


191 In m +=–n; expression assume that ma has the value 5 and n has the value 2 before the statement executes. Tell what the values of m andn will be after the statement executes.




Answer is B)


192 A default arguments hasa value that




Answer is D)


193 When according a structure members, the identifier to the left of the dot operator is the name of




Answer is C)


194 A function’s single most important role is to




Answer is D)


195 A function argument is




Answer is C)


196 Which of the following is not a valid identifier?




Answer is D)


197 The expression *test can be said to




Answer is D)


198 The type of variable a pointer points to mustbe part of gthe pointer’s definition so that




Answer is D)


199 The first element in a string is




Answer is B)


200 The new operator




Answer is D)


201 In a linked list




Answer is D)


202 In linked lists with multiple pointers,




Answer is B)


203 The comma operator(,) is primarily used in conjunction with




Answer is C)


204 The ‘continue’ statement is used to




Answer is A)


205 The traditional way to create an infinite loop in C is




Answer is B)


206 The difference between the declaration of an external variable and its definition is




Answer is A)


207 The comma operator(,) is used to




Answer is D)


208 In the library of standard I/O function definitions, data structure of a file is defined as




Answer is A)


209 In a circular linked list




Answer is D)


210 The malloc () function




Answer is A)


211 While incrementing a pointer, its values get increased by the length of the dta type to which its points. This length is called




Answer is C)


212 The process of calling a function using pointers to pass the addresses of variable is known as




Answer is D)


213 C inclueds two types of modifiers(access modifiers) that affect the way variables are accessed by both user’s program and the compiler. These modifiers are




Answer is D)


214 Which one of the following I/O functions can be used to write a set of data values to a file?




Answer is C)


215 The function ftell()




Answer is A)


216 The operators<< (left shift) and >> (right shift) are




Answer is A)


217 Which of the folowing is not a linked data structure?




Answer is B)


218 Any program in c has access to three standard files:




Answer is B)


219 A single character input from the keyboard can be obtained by using the function




Answer is A)


220 The string containing certain required formatting information is called




Answer is D)


221 ‘The’ meaning of conversion character h for data input is




Answer is D)


222 The conversion character for data input which indicates that the data item is a floating-point value is




Answer is C)


223 The conversion character ‘i’ for data output means that the data item is displayed as




Answer is D)


224 In printf()’ the appearance of the output can be affected by




Answer is D)


225 The advantage of a ‘switch’ statement over an ‘else-if’




Answer is A)


226 The general form of the conditional expression is




Answer is C)


227 In which statement does a to directly to the test condition and then conditue the loopeing process?




Answer is B)


228 In C, the NULL statement which does nothing is just




Answer is C)


229 The general form of do while statement is




Answer is A)


230 The two statements that can be used to change the flow of control are




Answer is C)


231 In a simple ‘if’ statement with no ‘else’ what happens 9 if he condition following the ‘if’ is fasle




Answer is B)


232 A while loop is more appropriate than a for loop when




Answer is A)


233 The statement following else in an ‘if -else’ construct are executed when




Answer is A)


234 The newline character is always included between




Answer is C)


235 Which of the following statements is incorrect for the gets() and put () functions?




Answer is A)


236 If c and y are int type of variables and y is a member of astructure x, then the statement c=x.(y);




Answer is C)


237 in the following pair of statement in a program char x; x-65;




Answer is B)


238 If a =5 and b=7 then the statement p= (a>):a?b;




Answer is C)


239 Between an if statement and the corresponding else clausem we should have




Answer is C)


240 The number of relational operator in C language is




Answer is A)


241 The switch variable can be of




Answer is C)


242 The function that sets the position to desired point in the file is




Answer is C)


243 An array of structures is




Answer is B)


244 The following statement where T is true and F is false T&&T II F&&T




Answer is C)


245 Auto type of variables




Answer is C)


246 The global variables by default belong to




Answer is C)


247 The scope of a variable is




Answer is A)


248 In the following declaration enum metal { gold=2, silver, brass iron}; brass represents the value




Answer is B)


249 The void type of variable




Answer is B)


250 We can declare thefollowing type of variable as the extern variables




Answer is B)


251 Typedef is a




Answer is B)


252 The use of the break statement in a switch statement is




Answer is A)


253 The symbol for the address operator is




Answer is C)


254 If a printf() function contains more than one control strings




Answer is C)


255 One of the valied escape sequences used in C language




Answer is B)


256 The include the double quotes as part of the control sring we use the symbol




Answer is A)


257 The int tyupe of constants are whole numbers in the range




Answer is C)


258 The lvalue is the value




Answer is B)


259 Out of the following, thecorrect name of a variable of the int type is




Answer is A)


260 The conversion specification for int type of data is




Answer is A)


261 The tetchar function is used to




Answer is C)


262 The first argument of a scamf()function is




Answer is A)


263 The outcome of a false statement is




Answer is B)


264 The preprocessor directive always ends with




Answer is A)


265 The cast operator for the float type is




Answer is B)


266 The print a percent % sign in the control string we use symbol




Answer is A)


267 In the C language, the Character type of constant is delimited by using




Answer is B)


268 If p=5 and q=6 then the following expression p<-q




Answer is A)


269 One of the logical operators in the C language is represented by the symbol




Answer is B)


270 An expresion contains relationsal, assignemnt and arithmetic operators. In the absence of prentheses, the order of evaluation will be




Answer is C)


271 The conversion specification is




Answer is B)


272 In C, how many parameters can be passed to a function?




Answer is D)


273 All of the following are disadvantage of RPG except




Answer is D)


274 Which of the following is not one of the processes that a high-level langauage program must go through before it is ready tobe exectued?




Answer is B)


275 Which of the following is not true of FORTRON




Answer is C)


276 All of the following are division of the COBOL program except




Answer is A)


277 In C Programming language, which of the following type of operators have the highest precedence




Answer is D)


278 In C, What is the the effect of a negative number in a field width specifier?




Answer is C)


279 In C language, the bit wise operators can c applied to which of the following operands




Answer is D)


280 One disadvantage of a direct access file is




Answer is A)


281 In C, what would be the effect of passing a parameter of type float to a function whose dummy parameter is declared tobe type int




Answer is D)


282 Which of the following statements provide a means of immediately terminating the execution of a loop?




Answer is B)


283 C Programming langage provides operations which deal directly with object such




Answer is C)


284 C programming language by itself provides




Answer is D)


285 Which of the following are not provided inC




Answer is A)


286 Which of the following relational operators in C means ” not equal to”?




Answer is B)


287 The values that can legally appear to the right of the assignment operator are called




Answer is D)


288 In C programming lanuage, if the first and the second operands of operator+are of types int and float, respectively, the result will be of type




Answer is B)


289 Write a statement to do the following ” Make list point to empy list”




Answer is B)


290 Convert the following infix expression to postfix notation ((A+2)*(B+4))-1




Answer is A)


291 Which fo the followng can describe as a pointer




Answer is A)


292 Which of the following can be describe as a array?




Answer is C)


293 Which of the following can be describe as an integer?




Answer is D)


294 Which of the following is most oriented to scientific programming?




Answer is A)


295 Write a statement to dothe following “make list point to the node containing 45”




Answer is A)


296 All computer execute




Answer is C)


297 Write a statement to do the following “set the key value of the node containing 45 to 46”




Answer is B)


298 Electronic speradsheets are most useful in a situation where relatively data must be input, and but calculations are required




Answer is D)


299 The two basic types of record-access method are




Answer is A)


300 Sequential file organisation is most appropriate for which of following applications?




Answer is C)


301 Which of the following file organisationis most efficient for a file with a high degree of file activitiy?




Answer is A)


302 The language generally used for scientific engineering and mathematical engineering




Answer is B)


303 Whichof the following can be describe as a pointer?




Answer is A)


304 The statement i*-3 is equivalent to




Answer is C)


305 Declaring varibales is advantageous because it




Answer is D)


306 A comment




Answer is B)


307 The first digit of a decimal constant must be




Answer is B)


308 Floating point numbers are used instead of integers to




Answer is C)


309 Assume that your version of C can recognize only the first 8 character of an identifier name, though identifier names may be arbitrarily long. Which of the following identifier names is not distinet




Answer is D)


310 Which of the following are valied characters constants?




Answer is A)


311 In C language, if numbe of singel character information is being entered by means information is being entered by means the scant function, what symbols must precede the corresponding variable name?




Answer is B)


312 A field width specifier in a printf() function




Answer is D)


313 The math library is set up for the user by the file




Answer is D)


314 Which of the following does not have an unary operator?




Answer is C)


315 The library files that come with C are




Answer is D)


316 Assume x,y and z are floating point variable and they have been assigned the values x=8.8, y=3.5and z=-5.2. The value of arithmetic expression 2*x/(3*y)is




Answer is B)


317 The single character input/output functions are




Answer is A)


318 Precedence determines which operator




Answer is B)


319 A computer programming language often used by children is




Answer is A)


320 Egoless programming means that




Answer is B)


321 The computer langauge generally unsuitbale for a programmers is




Answer is A)


322 What is no true about FORTRAN




Answer is B)


323 The statement for I – I to N’ belongs to the language




Answer is C)


324 Which of the following langauge uses Do Statement to create a loop




Answer is B)


325 Which of the following is not a very useful langauge for business applications




Answer is B)


326 # directives must be present




Answer is C)


327 Programs written in COBOL are organised into




Answer is D)


328 An identifier in C




Answer is A)


329 A required entry within the IDENTIFICATION DIVISION IS




Answer is D)


330 The READ INTO statement involves




Answer is C)


331 Almost every c program begins with the statement




Answer is B)


332 The commands that send or “redirect” output of a program to a disk file or another system device such as the printer are




Answer is C)


333 The structured data types that are built in to Pascal are:




Answer is D)


334 Two computer programs A and B give same results. A takes much more time to execute




Answer is D)


335 Arrays can be initialized provided they are




Answer is D)


336 Arrays are passed as arguments to a function by




Answer is B)


337 Which of the fillowing statements is true after execution of the program int a[10], I, *p; a[0] = 1; a[1] = 2; p = a (*p)++;




Answer is B)


338 It is necessary to declare the type of a function in the calling program if




Answer is B)


339 The declaration void function1(int) indicates the function1 is a function which




Answer is B)


340 Recursive functions are executed in a




Answer is A)


341 When a function is recursively called, all automatic variables




Answer is A)


342 A static variable is one




Answer is C)


343 An external variable is one




Answer is D)


344 Consider the following program fragment main( ) { int a,b,c; b=2 a=2*(b++); c=2*(++b); } which one of the given answers is correct?




Answer is D)


345 Given the following program fragment, which one of the alternatives is correct? main() { char status; int balance; balance=1000; status=(balance>=1000)? ‘C’ : ‘O’; }




Answer is B)


346 What will be value of count after the following program is executed? Main() { int count, digit=0; count=1; while(digit<=9){ printf("%d\n,++count); ++digit:} }




Answer is D)


347 If the following loop is implemented {int num; num=0; do {- – num; printf(“%”,num); num++; }while (num > 0) }




Answer is A)


348 What is the final value of digit? Main() { int digit; for (digit=0; digit<=9;++digit) printf("%d\n",digit); digit=2*digit; --digit; }




Answer is A)


349 What is the final value of sum? Main() { int sum=1; for (;sum <=9;) printf("%d\n,++sum); }




Answer is A)


350 What is the value of variable POLYGON? Main( ) { int POLYGON,L, B; L=B=2; POLYGON=(L==b)?1:0; }




Answer is B)


351 # define max(x,y)x=(x>y)?x:y is a macro defination. Which can find the maximum of two numbers x and y if




Answer is D)


352 Consider the macro definitions #define square(x) x*x and # define square (x) (x*x) when used in a program statement B= ++ square(C)




Answer is B)


353 #define two(x) 2*x #define ddouble(x) x+x main() { int num,sum,product; num=1; sum=-two(num); -sum; product=-ddouble(num); priintf(“%d%d\n”, sum,(product); } The output of the above program is




Answer is D)


354 The following program fragment { int sum,index; index=50; while(index>=0) { sum=sum/index; -index; } }




Answer is A)


355 main() { float balance, loan; balance = 1000.0; laon=balance/10; if((balance>500) || (loan<500)) printf("good account\n"); if(balance,500) || (loan<500) printf("caution !\n"); } What is the output of ht above program?




Answer is C)


356 The following lines, if included in a program, will cause one of the following errors, Indicate the correct one. {double c; scanf(“%c”,c); }




Answer is A)


357 A “switch” statement is used do




Answer is C)


358 If the following variables are set to the values as shown below, then what is the value of the expression following it? answer=2; marks=10; !((anser<5) || 9marks>2))




Answer is B)


359 What is the following program doing? main( ) { int digit=0; do printf(“%d\n”.digit++); while (digit<=9);




Answer is D)


360 Consider the program fragment switch (choice){ case ‘R’ : printf(“RED”); case ‘W’ : printf(“WHITE”); case ‘B’ : printf(“BLUE”); dafult’ : printf(“ERROR”); break; } What would be the output if choice =’R’?




Answer is C)


361 If c is a variable initialised to 1, how many times will the following loop be executed? While((c>0)&&(c<60)){ loop body c++;}




Answer is B)


362 The statement # include is written at the top of a program to indicate




Answer is C)


363 if x and y are variables as declared below double x = 0.005, y=-0.01; What is the value of ceil(x+y), where ceil is a function to computing ceiling of a number?




Answer is B)


364 The for statement which can precede a loop to be executed 50 times or till a boolean variable “found” becomes false is given by




Answer is C)


365 The declarations typedef float height [100]; heigh men, women;




Answer is A)


366 Consider the following declarations typedef strut{ char name[20]; char middlename[5]; char surname[20]; }NAME NAME class [20];




Answer is B)


367 what would be the values assigned to a,b,c if the statement scanf(“%d %d %d”, &a,&b,&c) is extended with inpur data item 123456?




Answer is C)


368 What would be the values assigned to a,b and c if the statement scanf(“%3d,%3d,% 3d”, &a,&b,&c) is executed with inputn data as 1234b5678b9(b denotes blank)?




Answer is A)


369 What would be the values of i, x and c if scanf(“%3d, %5f, %c”,&I, &x, &c) is executed with input data 10b256.875bT ?




Answer is D)


370 What would be the assignments if char s[100]; int d; float f; scanf(“%s, %*d, %f, s &d, &f) is executed with input data fastner b12345b5




Answer is C)


371 What would be the output of the following program fragment? { int I=12345; float x=145.678; printf(“3d,%5d,%8d”,,i,i,i); }




Answer is B)


372 The function fprintf is used in a program




Answer is C)


373 In the following satement fprintf(fpt, “%n”,I), the variables fpt is




Answer is C)


374 Consider the following declaration stru list{ int x; struct list *next; }*head; The statement head.x=100




Answer is D)


375 How many times will the following loop be executed? C1=’a’; while (c1>=’a’ && c1<='z') { c1++; }




Answer is B)


376 What is the following function computing? Test(n) int n; { int I; long int prod =1; if (n>1) for (I=2; I<=n;I++) prod * =I; return(prod); }




Answer is B)


377 What is the following function doing? test(a,b) int a,b; { int z=(abs(a)>=abs(b)) ? a:b; return (z); }




Answer is C)


378 void summation(n) int n; { int I; sum =0; I=1; for (I=1;I<=n;I++) sum +=1; } The above program returns




Answer is D)


379 void Test(void) { char c; if ((c=getchar()!=EOLN) Tes t(); putchar©; return; } The above function




Answer is D)


380 What will be the output of the following program? { int I=1234; j=0177, k=0xa08c; printf(“%8d %80x\n”,I,j,k); }




Answer is A)


381 What is the following function doing ? Main () { char line [80]; gets (line); puts (line); }




Answer is D)


382 If i,j,k are integers, the scanf function to enter i,j,k such that i is decimal, j is octal and k is hexadecimal would be




Answer is C)


383 How many times will the following loop be executed if the input data item is 01234? Whil (c=getchar() ! =0) { }




Answer is A)


384 The declaration ” unsigned u” indicates




Answer is B)


385 A declaration “short int” is used for variables




Answer is C)


386 In case of ordinary int variables




Answer is A)

Leave a Comment