C Programming Questions & Answers: part7



Software Programming : C Programming QUESTIONS AND ANSWERS :: part7 : 6 to 10

Following Software Programming language Entrance Multiple choice objective type questions and answers will help you in Software Programming 2024 examinations :

6.What is the correct output of the following program? #include void main() { char str[] = �ISIT�, rev[5]; int i = strlen(str), j=0; for(;i>=0;rev[i++] = str[i--]); rev[j]=�\0�; puts(rev); }

Syntax error
ISIT
Nothing
ITSI
TIIS.

7.int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; What value does testarray[2][1][0] in the sample code above contain?

3
5
7
9
11.

8.What is the result of the following code? x=0;switch(x) { case 1: cout<<"One"; case 0: cout<<"Zero"; case 2: cout<<"Hello World"; }

ZeroHello World
Zero
Hello World
One
OneHello World.

9.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 will print when the sample code above is executed?

y = HELLO
y = ELLO
y = LLO
y = LO
x = O.

10.What is the difference between a declaration and a definition of a variable?

Both can occur multiple times, but a declaration must occur first
There is no difference between them
A definition occurs once, but a declaration may occur many times
A declaration occurs once, but a definition may occur many times
Both can occur multiple times, but a definition must occur first.

More C Programming QUESTIONS AND ANSWERS available in next pages

    Health is the greatest gift, contentment is the greatest wealth -Buddha
If your ship doesn’t come in, swim out to meet it!-Jonathan Winters