Home
Current Affairs January 2024

What is the correct answer?

4

The output of the following code is:
void main() 
{
int a = 0;
while (a<=50) for(;;) if(++a % 50==0) break;
printf("a = %d", a);
}

A. a = 100

B. a = 50

C. compilation error

D. runtime error

Correct Answer :

A. a = 100


Related Questions

What is the correct answer?

4

The output of the following code is:
main() 
{
int a = 5, b = 6;
(a == b? printf("%d", a));
}

A. 0

B. 5

C. Error

D. None of the above

What is the correct answer?

4

Which of the following is not an infinite loop

A. int i =1;
while (1)
{i++;}

B. for( ; ; );

C. int true=0< false;
while (true)
{false = 1;}

D. int y, x = 0;
do
{y = x;}
while (x==0);

What is the correct answer?

4

The output of the following code is:
void main() 
{
int a = 0;
while (a<=50) for(;;) if(++a % 50==0) break;
printf("a = %d", a);
}

A. a = 100

B. a = 50

C. compilation error

D. runtime error

What is the correct answer?

4

char *s[10] defines an array of ------------------------

A. pointers to strings

B. string to pointer

C. both

What is the correct answer?

4

p++ executes faster than p + 1.

A. True

B. False

What is the correct answer?

4

Which one of the following is not a fundamental data type in C++

A. float

B. string

C. int

D. wchar_t

What is the correct answer?

4

Which of the following is not true about preprocessor directives

A. They begin with a hash symbol

B. They are processed by a preprocessor

C. They form an integral part of the code

D. They have to end with a semi colon

What is the correct answer?

4

Only one break can be used in one loop.

A. True

B. False

What is the correct answer?

4

Which of the following is allowed in a C Arithmetic instruction

A. []

B. {}

C. ()

D. None of the above

What is the correct answer?

4

An array declared as A[100][100] can hold a maximum of 100 elements.

A. True

B. False

What is the correct answer?

4

Variables declared as register storage type gets stored in CPU registers.

A. True

B. False

What is the correct answer?

4

What's wrong? (x = 4 && y = 5) ? (a = 5) ; (b = 6);

A. the question mark should be an equal sign

B. the first semicolon should be a colon

C. there are too many variables in the statement

D. the conditional operator is only used with apstrings

What is the correct answer?

4

Which options shows the correct hierarchy of arithmetic operators

A. **, * or /, + or -

B. **, *, /, +, -

C. **< /< *< +<-

D. / or *, - or +

What is the correct answer?

4

Bitwise operators can operate upon?

A. double and chars

B. floats and doubles

C. ints and floats

D. ints and chars

What is the correct answer?

4

The value of an enumerated datatype can be read using scanf() function.

A. True

B. False

What is the correct answer?

4

Which of the following is the most preferred way of throwing and handling exceptions?

A. Throw by value and catch by reference.

B. Throw by reference and catch by reference.

C. Throw by value and catch by value

D. Throw the pointer value and provide catch for teh pointer type.

What is the correct answer?

4

It is necessary to initialize the array at the time of declaration.

A. True

B. False

What is the correct answer?

4

Left shift operator rotates the bits on the left and places them to the right.

A. True

B. False

What is the correct answer?

4

What is the right way to access value of structure variable book{ price, page }?

A. printf("%d%d", book.price, book.page);

B. printf("%d%d", price.book, page.book);

C. printf("%d%d"< price::book< page::book);

D. printf("%d%d", price>book, page>book);

What is the correct answer?

4

= and = = have the same operation.

A. True

B. False

What is the correct answer?

4

unsigned char has a range from 0 to ------------

A. 253

B. 254

C. 255

D. 256

What is the correct answer?

4

C programming language was developed by

A. Dennis Ritchie

B. Ken Thompson

C. Bill Gates

D. Peter Norton

What is the correct answer?

4

What is Keywords?

A. Keywords have some predefine meanings and these meanings can be changed.

B. Keywords have some unknown meanings and these meanings cannot be changed.

C. Keywords have some predefine meanings and these meanings cannot be changed.

D. None of the above

What is the correct answer?

4

The output of the following code is:
main() 
{
xyz: goto abc;
printf("Hello");
abc: printf("World");
goto xyz;
}

A. Infinite loop

B. Hello World

C. World Hello

D. Compilation error

What is the correct answer?

4

The output of the following code is:
void main() 
{
int a = 1, b=2;
int *ip;
ip=&a;
b=*ip;
printf("%d", b);
}

A. 2

B. 1

C. 100

D. 0

What is the correct answer?

4

The-------------------- statement helps immediate exit from any part of the loop

A. break

B. continue

C. exit

D. All of the above

What is the correct answer?

4

Which of the following keyword supports dynamic method resolution?

A. abstract

B. Virtual

C. Dynamic

D. Typeid

What is the correct answer?

4

struct stud
{
int roll;
char name[20];
float marks;
} *p;
What will be the byte size of p?

A. 24

B. 2

C. 26

D. None

What is the correct answer?

4

Which header file is essential for using strcmp() function?

A. string.h

B. strings.h

C. text.h

D. strcmp.h

What is the correct answer?

4

/* The C language.
/* is a procedural language .*/*/
The above statement is valid.

A. True

B. False