Computer Programming MCQ Question Answer


Hello friends, in this post we are going to discuss about Computer Programming MCQ with Answer | Computer Programming Multiple choice question answer | Computer Programming Objective type question answer | Computer programming Simple Question answer

Q1.Consider the code fragment, Is “success” printed?

int x = 10;
int y = 20;
int z = 30;
if(x >= y <= z)
  printf("success\n");

a. Yes
b. NO OUTPUT
c. ERROR
d. NO

Ans: A

Q2.Binary Equivalent for octal number 43

a. 100011
b. 011111
c. 010010
d. 101100

Ans: A

Q3.Machine level language is represented in the form of

a. None of the above
b. Mnemonics
c. alphabets
d. binary

Ans: D

Q4.What is the output of following code:
void main()
{ int i=5;
switch(i)
{
case 3: printf(“three”);
case 4: printf(“four”);
case 5: printf(“five”);
case 6: printf(“six”);break;
case 7: printf(“seven”);
default: printf(“default”);
}}

a. Five
b. Fivesix
c. None of the above
d. fivesixsevendefault

Ans: B

Q5.Decimal equivalent of Hexa decimal number E34

a. 6785
b. 3636
c. 3434
d. 512

Ans: B

Q6.What is the output of the following statement?

int a=10; float b=2.5; int c=30;
printf(“%d%d%f”,a,c,b);

a. 10 30 2.5
b. 10 2.5 30
c. 10 2 30
d. 10 30 2

Ans: A

Q7.Binary equivalent of FA12

a. 1111111111111111111
b. 1000000000
c. 1111101000010010
d. 1111000000111111

Ans: C

Q8.Find out the invalid identifier declaration:

a. int total-value;
b. int _totalvalue;
c. int totalvalue;
d. int total_value;

Ans: A

Q9.Select the operating system softwares from the following

a. DOS, Java
b. Chrome OS and VB
c. DOS, Windows, Ubuntu
d. Fedora, C++

Ans: C

Q10.Consider the code fragment, What is printed?

int x = (char)((int)'C' + 2);
char y = (char)x;
printf("The value of y is %c\n", y);

a. A
b. E
c. C
d. D

Ans: D


Q11.Hexa decimal equivalent for 67 is

a. 45
b. 56
c. 44
d. 43

Ans: D

Q12.What is the output?

void main()
{
 int x = 0;
 if (x == 0)
  printf(“hi”);
 else
  printf(“how are u”);
  printf(“hello”);
}

a. Hihello
b. Hi
c. Hello
d. how are you

Ans: A

Q13.Evaluate the following expression and write the correct answer of the s S=2*10/2/5+20-4+6/3-1*1

a. 19
b. 20
c. 7
d. 18

Ans: A

Q14.Format specifier for Signed Integer (Short) in C is –

a. %hi
b. %i
c. %ld
d. %hu

Ans: A

Q15.What is the output? void main()
{
if(-100)
  printf(“Negative number”);
else
  printf(“Positive number”);
}

a. Error
b. Random Behavior
c. Negative number
d. Positive number

Ans: C

Q16.The __ function returns the number of bytes used in representing a data type

a. sizeof()
b. size
c. size_byte()
d. byte_size()

Ans: A

Q17.Hexa decimal equivalent for octal number 45 is

a. 56
b. 44
c. 43
d. 25

Ans: D

Q18.Convert the below decimal value into signed binary number using the sign-magnitude format: -5610 as a 8-bit number

a. 101111012
b. 001110002
c. None of the Above
d. 101110002

Ans: D

Q19.What is the resultant binary value of -12 using 4 bits in 2’s compliment representation

a. 0100
b. 0000
c. 0011
d. 1000

Ans: A

Q20.Step by step procedure to write set of instructions

a. algorithm
b. None of the above
c. Pseudocode
d. flowchart

Ans: A


Leave a Reply

Your email address will not be published. Required fields are marked *