Click To Get Off-Campus Placement Jobs Info !!!

# C Programming :: Floating Point Problems

NA
SHSTTON
1
Solv. Corr.
5
Solv. In. Corr.
6
Attempted
0 M:0 S
Avg. Time

1 / 6

Choose the correct option.

Member function of a class template should be defined

Awithin the class template definition

Boutside class template definition

Ceither (a) or (b)

Din the derived class

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
0
Solv. Corr.
6
Solv. In. Corr.
6
Attempted
0 M:0 S
Avg. Time

2 / 6

What would be the value of c?
#include<stdio.h>
void main()
{
int c;
float a,b;

a= 245.05;
b = 40.02;
c =a+ b;
}

A285.07

B285

C2850

D285

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
3
Solv. Corr.
3
Solv. In. Corr.
6
Attempted
0 M:0 S
Avg. Time

3 / 6

What would be the value of i and k in below C program?
#include<stdio.h>
void main() {
int i,j,k;
j = 5;
i = 2 *j/2;
k = 2 *(j/2);
}

Ai = 5, k = 5

Bi=4,k=4

Ci = 5, k = 4

Di = 4, k = 5

Explanation:

at first, glance looks like i value will be 4 and k value will be 4 too.

but if you see in second statement () has been used. why?

###### An answer will be i = 5 and k = 4.

Workspace

NA
SHSTTON
3
Solv. Corr.
3
Solv. In. Corr.
6
Attempted
0 M:0 S
Avg. Time

4 / 6

Choose the correct option.

If a = -11 and b = -3 what is the value of a%b?

A-3

B3

C2

D-2

Explanation:

Note: % is a reminder operator in c programming (and programming language). For the remainder operator, the sign of the result is the same as the sign of the dividend.

C define % operator operation for a%b as below:

a = (a/b) * b + a%b

Here dividend is negative so the answer will be -2

Important Points:

=> The answer will be -2 in the scenario where a = -11 and b = 3

=> The answer will be 2 in the scenario when a = 11 and b = -3 or 3

Workspace

NA
SHSTTON
8
Solv. Corr.
18
Solv. In. Corr.
26
Attempted
0 M:0 S
Avg. Time

5 / 6

What is the output of the following 'C' program ?
#include <stdio.h>
# pragma pack(2)
struct SIZE {
int i;
char ch ;
double db ;
} ;
main ()  {
printf ( "%d\n",sizeof(struct SIZE) );
}

A12

B14

C16

D8

Explanation:

Pragma pack instructs the compiler to pack structure members with particular alignment. Most compilers, when you declare a struct, will insert padding between members to ensure that they are aligned to appropriate addresses in memory (usually a multiple of the type's size). This avoids the performance penalty (or outright error) on some architectures associated with accessing variables that are not aligned properly. For example, given 4-byte integers and the following struct:

## struct SIZE { int i; char ch ; double db ; } ;

The compiler could choose to lay the struct out in memory like this:

 1 byte 2nd byte 3rd byte 4th byte int i i(1) i(2) i(3) i(4) char ch ch(1) padding padding padding double db db(1)db(5) db(2)db(6) db(3)db(7) db(4)db(8)

the size of this structure will be 16.

with pragma pack (1)

1 byte

int i(1)

int i(2)

int i(3)

int i(4)

char ch(1)

double db(1)

.

.

double db(8)

and the size of strut will be 13.

with pragma pack (2)

1st byte        2nd byte

int i(1)             int i(2)

int i(3)             int i(4)

char ch(1)        double db(1)

.                         .

double db(6)    double db(7)

the size of struct will be 14  (Answer). if pragma pack (4) is given then in 32 bit size of sruct will be 16.

pragma pack tells the compiler the boundary to align objects in a structure to in order to improve access times.

Workspace

NA
SHSTTON
1
Solv. Corr.
12
Solv. In. Corr.
13
Attempted
0 M:0 S
Avg. Time

6 / 6

Choose the correct option.

#include

#define mysizeof(a) (&a+1) - &a
void main()
{
float d;
printf("%d\n", mysizeof(d) );
}
Note: assume sizeof float is 8 bytes

A8

B4

C1

Dcompiler error

Explanation:

Tricky ... little bit .. basically in below line &a (address of float variable d) getting subtracted from address of variable + 1 i.e incrementing it with 1 gives the address where the next variable of the type d can be stored, the answer is 1 instead of 8 (as given float size is 8 byte).

## #define mysizeof(a) (&a+1) - &a

The difference gives the result that how many variables of type of d can be stored in that amount of memory which will obviously be 1 for the type d. The result of pointer subtraction is in elements and not in bytes. so, that the below expression evaluates to 1. instead of 8.

If you above statement put like below, the answer will be 8.

## #define mysizeof(a) (char*)(&a+1) - (char*)&a

typecasting it int char* and taking the difference will tell us how many variables of type char can be stored in the given memory space (the difference). Since each char requires only 1 Byte of memory therefore (amount of memory)/1 will give the number of bytes between two successive memory locations of the type of variable passed on to the macro and hence, the amount of memory that the variable of type d requires i.e 8 bytes.

Workspace

## C Programming Floating Point Problems Questions and Answers pdf

At C Programming topic Floating Point Problems, you will get multiple online quiz difficulty wise, which will have a total of 6 quizzes, categorized as easy, medium, and moderate level. While preparing for any Floating Point Problems, take all the list quiz and check your preparation level for that topic. Each quiz have 10 different question, which needs to be answered in 20 min., all the listed quiz here is free, however, you will get only one chance for each quiz to attempt(Take Quiz seriously), so it is always recommended to take one quiz in each section before you start solving Floating Point Problems MCQs practice question, and one after solving all the question of the respective level, you can refer back your Floating Point Problems quiz result any time or you can download it as pdf for reference.

## C Programming Floating Point Problems Customize Online Mock Test

This is own type of mock test, where At this C Programming Floating Point Problems MCQs mock test section, you will able to attempt only the questions related to Floating Point Problems, in that question will be a different level, important, and all the questions will be part of some of the mock tests across Q4interview FREE Mock test. You need to choose the topic as Floating Point Problems, and click on Double click to generate your customize mock test. While attempting the mock test you need to choose any of the one options out of given option. It is recommended to go through the direction given along with each question, as these questions will be randomly and so that same direction will not be applicable across the entire test. Once you submit your mock test, the result will be generated for Floating Point Problems Customize mock test, where your performance point points will be highlighted. Q4interview analysis every single point which helps you to improve your topic understanding and help you to know your type of mistakes and way to improve Floating Point Problems questions, by providing the same type of practice questions from practice exercise. The best part of this Floating Point Problems, all these mock tests listed here are free and you can take as Many time, as many you want. When you continue to give Floating Point Problems Customize Online Mock Test here regularly, then you will understand how much you have developed your accuracy on a topic, after that you will be able to decide how much attention you need to focus on. Your continued practice will increase your confidence, speed and thinking ability intensely, the Floating Point Problems Customize topic on which you will practice more will beneficial for you in future during campus placement.

## C Programming Floating Point Problems Quiz Online Test

The details of the C Programming Floating Point Problems quiz are as follows. There are 10 questions for you. You have to answer them in 20 minutes. Within 20 minutes you have to see the errors in the sentences given as a question. Four options are also given to you, and you have to choose your opinion. You must be confident in your answer that the choices are difficult. Therefore, below we provide you with some information about C Programming Floating Point Problems that you see and keep them in mind while answering questions.

## C Programming Floating Point Problems MCQs Practice Questions with Answer

On this Floating Point Problems section of page you will find the easiest quickest ways to solve a question, formulas, shortcuts and tips and tricks to solve various easiest methods to solve Floating Point Problems Question Quickly. It contains all the C Programming topic Floating Point Problems questions which are common in any of the preliminary exams of any company. The solution is provided along with the questions. The practice of these questions is a must as they are easy as well as scoring and asked in all the exams They will confirm the selection if all the questions attempted wisely with little practice. It is recommanded to Take Mock test based on C Programming topic and Floating Point Problems topic based quiz.

## C Programming Floating Point Problems solved examples question

You can get here fully solved Floating Point Problems examples with a detailed answer and description. You can solve Floating Point Problems problems with solutions, the questions by companies wise by filtering the questions, additionally, you can check what type of questions are being asked in IT companies Written Round from Floating Point Problems. Floating Point Problems became one of the most important sections in the entire competitive exams, Companies Campus, and entrance online test. Go through Floating Point Problems Examples, Floating Point Problems sample questions. You can Evaluate your level of preparation in Floating Point Problems by Taking the Q4Interivew Floating Point Problems Online Mock Test based on most important questions. All the Floating Point Problems practice questions given here along with answers and explanations are absolutely free, you can take any number of time any mock Test.

## Why C Programming Floating Point Problems?

In this practice section, you can practice C Programming Questions based on "Floating Point Problems" and improve your skills in order to face the interview, competitive examination, IT companies Written exam, and various other entrance tests (CAT, GATE, GRE, MAT, Bank Exam, Railway Exam etc.) with full confidence.

## Where can I get C Programming Floating Point Problems questions and answers with explanation?

Q4Interview provides you lots of fully solved C Programming (Floating Point Problems) questions and answers with Explanation. Solved examples with detailed answer description, explanation are given and it would be easy to understand. You can download C Programming Floating Point Problems quiz questions with answers as PDF files and eBooks.

## Where can I get C Programming Floating Point Problems Interview Questions and Answers (objective type, multiple-choice, quiz, solved examples)?

Here you can find objective type C Programming Floating Point Problems questions and answers for interview and entrance examination. Multiple choice and true or false type questions are also provided.