Programming for Problem Solving - Unit-3
ATo write the entire program in one function.
BTo start coding immediately without planning.
CTo break a complex problem into smaller, more manageable subproblems.
DTo focus on optimizing the code for speed from the beginning.
Correct Answerc
ADisplay the values of variables during execution.
BShow the hierarchical relationship between program modules (functions).
CList all the library functions used in the program.
DDraw the flow of data in memory.
Correct Answerb
AcalculateAverage()
Bmy_print()
Cscanf()
DgetUserInput()
Correct Answerc
Correct Answerd
AIndirection operator
BAddress-of operator
CMultiplication operator
DValue-of operator
Correct Answerb
ATo allow the function to modify the original argument's value.
BTo send a value from the caller into the function for processing.
CTo return multiple values from the function.
DTo point to a memory location.
Correct Answerb
AThe memory address of y
BThe value 5
CThe memory address of ptr
DAn undefined value
Correct Answerb
AIt uses a return statement to send back a value.
BIt takes one or more arguments as pointers, allowing it to modify the variables in the caller's scope.
CIt can only be called once from the main function.
DIt does not accept any arguments.
Correct Answerb
AIt performs a logical AND operation.
BIt dereferences the pointers num1 and num2.
CIt passes the addresses of num1 and num2 so the swap function can modify them.
DIt ensures the values of num1 and num2 are not changed.
Correct Answerc
AThe entire program.
BOnly from the point of declaration to the end of that function's block.
COnly inside the main function.
DGlobal and can be accessed by any function.
Correct Answerb
Avoid process(int data);
Bint process(int *data);
Cvoid process(int *data);
Dvoid process(int &data);
Correct Answerc
AThe function's code is duplicated for each call.
BThe same function code is executed, but it can manipulate different memory locations each time it is called.
CIt can only be used with global variables.
DIt becomes an inline function automatically.
Correct Answerb
AIt will always point to zero.
BIt may cause a segmentation fault or access unintended memory locations.
CIt automatically initializes to NULL.
DThe program will compile but run slowly.
Correct Answerb
AThey make the program faster.
BThey improve the modularity and reusability of functions.
CThey can lead to code that is difficult to debug and maintain because any function can change them.
DThey have a very limited scope.
Correct Answerc
AThe called function is a parent of the caller.
BThe caller is a subordinate module to the called function.
CThe caller is a higher-level module that delegates a task to the called (lower-level) function.
DThey are unrelated.
Correct Answerc
AThere is no difference; they are syntactically the same.
BA return statement can send back one value, while output parameters can be used to return multiple values.
COutput parameters are used for input, and return is used for output.
DA return statement modifies the argument directly.
Correct Answerb
AThe value 10 will be stored at memory address 0.
BThe program will compile and run without any issues.
CIt will typically result in a runtime error, such as a segmentation fault.
DThe pointer will automatically be assigned a new address.
Correct Answerc
Correct Answerb
Aint arr[]={10,20,30};
Bint arr[2]={10,20,30};
Carr={10,20,30};
Dint arr={10,20,30};
Correct AnswerAnswer:A
Aauto
Bstatic
Cregister
Dextern
Correct Answerc
AFunction avoids rewrite same code in multiple times.
BFunction breakdown complex problem to smaller parts.
CFunctions provide easy debugging.
DAll the above.
Correct Answerd
AFunction definition.
BFunction declaration.
CFunction call.
DNone of the above.
Correct Answerb
AReturn statement terminate function execution.
BReturn statement execute anything after it.
CReturn statement is a result of function.
DAll the above
Correct Answerd
AWhile writing a function actual parameters must be equal to formal parameters.
BWe can call a function multiple times.
CFunction wonβt provide limited access to local variable.
DFunction declaration is optional while writing a function.
Correct AnswerC
AIn call by value method, different memory will be allocated to actual parameters and formal parameters.
BIn call by value method, if we do modification in formal parameters that change actual parameters.
CIn call by value method, we modification in formal parameters that wonβt change actual parameters.
DNone of the above.
Correct AnswerB
AFunction declaration is optional while writing a function.
BFunction call must be inside main ().
CWe can write function anywhere in a program.
DAll the above.
Correct AnswerD
AParameters which are passed to function definition is called formal parameters.
BParameters which are passed to function call is known as actual parameters.
CParameter which are passed to function definition is known as actual parameters.
DParameter which are passed to function definition is known as formal arguments.
Correct AnswerC
AThe default value of auto storage class variable is 0.
BThe scope of auto storage class variable is local.
CThe life of auto storage class variable is with in function or block
DNone of the above
Correct AnswerA
AThe default value of static storage class variable is garbage value.
BThe static storage class variable stored in CPU RAM.
CThe scope of static variable is global.
DNone of the above.
Correct AnswerD
Aextern storage class variable stored in RAM.
BRegister storage class variable stored in CPU register.
CAuto storage class variable stored in RAM.
DAll the above.
Correct AnswerD
AArgument or actual parameter
BVariable
CIdentifier
DFunction name
Correct AnswerArgument or actual parameter
AGet the address of a variable
BAccess the value stored at the address pointed by a pointer
CDeclare a variable
DMultiply two numbers
Correct AnswerAccess the value stored at the address pointed by a pointer
AA set of statements performing a specific task
BA preprocessor directive
CA variable
DA keyword
Correct AnswerA set of statements performing a specific task
AStores value 20 in pointer
BStores address of x in p
CCreates a new variable
DGives an error
Correct AnswerStores address of x in p
Aby value
Bby reference
Cby pointer
Dby address
Correct Answerby value
AA function in C can return more than one value.
BEvery C program must have at least one function named main().
CA function must always take at least one parameter.
DFunctions in C cannot call other functions.
Correct AnswerEvery C program must have at least one function named main().
AFormal arguments
BActual Arguments
CDefinite Arguments
DIdeal Arguments
Correct AnswerActual Arguments
Correct Answerreturn
Fill in the Blanks
39A function declaration also called as_____________
Correct Answerprototype
40A parameter is known as______________. Which are passed to function call.
Correct AnswerArgument or Actual parameter or Actual argument
41A parameter is known as ________ which is passed to function definition.
Correct Answerformal parameter
42Pointer is variable which stores___________ of variable.
Correct AnswerAddress/reference
43In ___________method different memory will be allocated to actual parameter and formal parameters.
Correct AnswerCall by value
44In____________ Method similar memory will be allocated to actual parameters and formal parameters.
Correct AnswerCall by reference
45___________ block statements to perform specific task.
Correct AnswerFunction
46In________ method if we do modification in formal parameters that does not impact in actual parameters.
Correct AnswerCall by value
47In____________ method if we do modification in formal parameters that will change in actual parameters.
Correct Answercall by reference
48____________ Method address of actual parameter is copy into formal parameter.
Correct Answercall by reference
49__________is default return type of function.
Correct Answerint
50In pointers "*" is called ______________.
Correct Answerindirection operator/Dereferencing operator
51_____ is the default value of auto storage class?
Correct AnswerGarbage value
52Default value of static storage class variable is ________.
Correct Answer0
53_______storage class variable is available at multiple source files.
Correct Answerextern
54_______ storage class variable is stored is CPU register.
Correct Answerregister
55_______ storage class initialize only time and exists till end of the program.
Correct Answerstatic
56_______ storage class variable scope is global.
Correct Answerextern
57Array index position starts from __________.
Correct Answerzero
58A function declaration is also known as a function ________________________
Correct Answerprototype
59The part of a function where code is written is called the __________ of the function.
Correct AnswerFunction defination
60A ___________________ is a block of code that performs specific task.
Correct AnswerFuntion
61The process of dividing a program into smaller modules or functions is called __________.
Correct Answermodularity
62The variable that receive values from calling functions are called______________
Correct Answerfunction defination
63In C, function can be categorized as library functions and ___________function.
Correct Answeruser defined functions
64A function that does not return any value must have the return type___________.
Correct Answervoid
65Variables within a block have global scope.(T/F)____
Correct AnswerFalse
66The function that returns square root of a given number is _______
Correct Answersqrt(x);
67scanf () is a _________ function in C program.
Correct Answerinput
68The syntax for function call is ______________.
Correct Answerfunction_name(argument)
69Default value of Register variable is = ___________________
Correct AnswerGarbage value
70How many values can a C Function return at a time = ___________________
Correct Answerone value
71A ___________________ is a block of code that performs specific task.
Correct Answerfunction