# C/C Sample Test,Sample questions

## Question: ``` Which of the following statement correctly assigns a value 33 to a variable c? byte a = 11, b = 22, c;```

1.c = (byte) (a + b);

2.c = (byte) a + (byte) b;

3.c = (int) a + (int) b;

4.c = (int)(a + b);

1.1, 3

2.2,5

3.1,4

4.3,4

1.4 byte

2.8 byte

3.16 byte

4.32 byte

1.0.1

2.1

3.1.1

4.11

1.1, 2, 5

2.1, 3, 5

3.2, 4

4. 3, 5

1.Short

2.Integer

3.Long

4.Byte

1.Char

2.Long

3.Short

4.Byte

1.Char

2.Byte

3.Integer

4.Long

1.0

2.1

3.TRUE

4.FALSE

1.8 Bytes

2.4 Bytes

3.10 Bytes

4.16 Bytes

## Question: `Which of the following is the correct ways to set a value 3.14 in a variable pi such that it cannot be modified?`

1. float pi = 3.14F;

2.#define pi 3.14F;

3.const float pi = 3.14F;

4.const float pi; pi = 3.14F;

1.1,3,5

2.2,4

3.3,5

4.2,3,5

1.1, 3, 5

2.2,4

3.3,5

4.1,2,5

1.2,5

2.1,5

3.3,4

4.2,3

## Question: ```Which of the following statements is correct about the C#.NET code snippet given below? short s1 = 20; short s2 = 400; int a; a = s1 * s2;```

1.A value 8000 will be assigned to a.

2.A negative value will be assigned to a.

3.During arithmetic if the result exceeds the high or low value of the range the value wraps around till the other side of the range.

4. An error is reported as widening conversion cannot takes place.

## Question: `Which of the following statements is correct?`

1.Information is never lost during narrowing conversions.

2. The CInteger() function can be used to convert a Single to an Integer.

3.Widening conversions take place automatically.

4.Assigning an Integer to an Object type is known as Unboxing.

## More MCQS

##### R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!