C Programming and Problem Solving
Questions 301 to 310
Which of the following puts program in the memory?
(a) preprocessor (b) compiler (c) linker (d) loader (e) editor.
|
|
int z, x = 5, y = -10, a = 4, b = 2;
z
= x++ - --y * b / a;
What number will z in the sample code above contain?
(a) 5 (b) 6 (c) 10 (d) 11 (e) 12.
|
|
With every use of a memory allocation function, what
function should be used to release allocated memory which is no longer
needed?
(a) unalloc() (b) dropmem() (c) dealloc() (d) release() (e) free().
|
|
Which escape character can be used to begin a new line in
C?
(a) \a (b) \n (c) \l (d) \m (e) \t.
|
|
char* myFunc (char *ptr)
{
ptr += 3; return (ptr); } int main() { char *x, *y; x = "HELLO"; y = myFunc (x); printf ("y = %s \n", y); return 0;
}
What is the output when the sample code above is executed?
(a) y = HELLO (b) y = ELLO (c)
y = LLO (d) y = LO (e) x = O.
|
|
What is the associativity of the conditional operator
(a) left
to right (b) right to left (c) top to bottom
(d) bottom
to top (e) left to left.
|
|
What function will read a specified number of elements
from a file?
(a) fileread() (b)
getline() (c) readfile() (d) fread() (e) gets().
|
|
"My salary was increased by 15%!"
Select
the statement which will EXACTLY reproduce the line of text above.
(a)
printf("\"My salary was
increased by 15/%\!\"\n");
(b)
printf("My salary was increased
by 15%!\n");
(c)
printf("My salary was increased
by 15'%'!\n");
(d)
printf("\"My salary was
increased by 15%%!\"\n");
(e)
printf("\"My salary was
increased by 15'%'!\"\n");
|
|
What is the difference between a declaration and a
definition of a variable?
(a)
Both can occur multiple times, but a
declaration must occur first
(b)
There is no difference between them
(c)
A definition occurs once, but a
declaration may occur many times
(d)
A declaration occurs once, but a
definition may occur many times
(e)
Both can occur multiple times, but a
definition must occur first.
|
|
What is the meaning of self-referential structure?
(a) Array of structures
(b) Single structure
(c) Structure calling it’s parent structure
(d) Structure calling another structure
(e) list of structures.
|
Answers
Answer : (d)
Reason : Loader puts
the program into memory whereas others functionality is different.
|
|
Answer : (c)
Reason : based on the
hierarchy of operations in c 10 is the correct answer.
|
|
Answer : (e)
Reason : Remaining
all are irrelevant methods.
|
|
Answer : (b)
Reason : \n is for
new line character and \t for tab space and remaining are not appropriate.
|
|
Answer : (d)
Reason : LO is the
correct choice because when myfunc is called and hello is passed as an
argument.
LO is extracted as address is increased by 3 bytes.
|
|
Answer : (b)
Reason : Right to
left is the correct associativity remaining all don’t match.
|
|
Answer : (d)
Reason : free() is
the correct method to read specified number of element s from a file.
|
|
Answer : (d)
Reason : Choice d
produces the required output.
|
|
Answer : (a)
Reason : Remaining
all are contradictory according to c language
|
|
Answer : (c)
Reason : Self
referential structure stands for
structure calling its parents structure but not array of structures,
etc.,
|
thank you.
ReplyDeletec++ tutorial
java tutorial
What is the answer for question
ReplyDelete305