Computer Science

Computer Science MCQ-4

FontSize

Q.46 What would be output of the following program, if the array begins at 65486?
main()
{
int arr[ ] = {12, 14, 15, 23, 45};
printf(“%u%u”, arr+1, &arr+1);
}

(A) 65486, 65486 (B) 65488, 65488
(C) 65488, 65496 (D) None of the above
Ans:C

Array begins at address 65486 so arr+1=65488 as size of int is 2 bytes and
&arr+1=65486+10=65496 as there are 5 elements in array.


Q.47 Given the statement, maruti.engine.bolts=25;
which of the following is true?

(A) Structure bolts is nested within structure engine
(B) Structure engine is nested within structure maruti
(C) Structure maruti is nested within structure engine
(D) Structure maruti nested within structure bolts
Ans:B

Q.48 Which amongst the following is not a keyword?
(A) external (B) int
(C) float (D) double
Ans:A

Q.49 If a = 5 and b = 7 then the statement p = (a > b) : a ? b
(A) assigns a value 5 to p (B) assigns a value 7 to p
(C) assigns a value 8 to p (D) gives an error message
Ans:D

Q.50 The expression P >> 6 shifts all bits of P six places to right. What is the value of P >> 6 if
P = 0× 6db7 ?

(A) 0×1234 (B) 0× 0001
(C) 0× 0000 (D) 0×1B6
Ans:D

Q.51 If an integer occupies 4 bytes and a character occupies 1 bytes of memory, each element of the
following structure would occupy how many bytes?
struct name
{
int age;
char name [20];
}

(A) 5 (B) 24
(C) 21 (D) 22
Ans:B

Q.52 If an array is used as function argument, the array is passed
(A) by value. (B) by reference
(C) by name. (D) the array cannot be used as a function argument.
Ans:B

Q.53 To access a structure element using a pointer, ___________ operator is used
(A) dot (.) (B) pointer (&)
(C) pointer (*) (D) arrow (®)
Ans:D

Q.54 The library function sqrt( ) operates on a double precision argument. If, i is an integer
variable, which one of the following calls would correctly compute sqrt(i)?

(A) sqrt((double)i) (B) (double) sqrt(i)
(C) (double) (sqrt(i)) (D) sqrt(i)
Ans:A

Q.55 What will happen if the following loop is executed?
int num = 0;
do
{
--num;
printf(“%d”, num);
num++;
}while (num >= 0);
}

(A) The loop will run infinite number of times.
(B) The program will not enter the loop.
(C) There will be a compilation error.
(D) There will be runtime error.
Ans:C

Q.56 The break statement causes an exit
(A) Only from the innermost loop.
(B) Only from the innermost switch.
(C) From the innermost loop or switch.
(D) From the program.
Ans:C

Q.57 It is necessary to declare the type of function in the calling program if
(A) Function returns an integer.
(B) Function returns a non-integer value.
(C) Function is not defined in the same file.
(D) Function is called number of times.
Ans:B

Q.58 The function fprintf is used in a program
(A) When too many printf calls have been already used in the program.
(B) In place of printf, since printf uses more memory.
(C) When the output is to be printed on to a file.
(D) When the type of variables to be printed are not known before.
Ans:C

Q.59 The following statement displays
float x = 2000.53;
printf (“%e”, x);

(A) 2.00053e+04 (B) 2.00053e+03
(C) 2.00053+e04 (D) 2.0005e+03
Ans:B

Q.60 The output of the following is
int a = 75;
printf (“%d%%”, a);

(A) 75 (B) 75%%
(C) 75% (D) None of the above
Ans:D


Please Donate






RSS Feeds

SiteTranslation



Copyright © 2024 ashkerala.com. All Rights Reserved.
Google+ Click to listen highlighted text! Powered By GSpeech