Test: Cross Compiler


15 Questions MCQ Test Compiler Design | Test: Cross Compiler


Description
This mock test of Test: Cross Compiler for Computer Science Engineering (CSE) helps you for every Computer Science Engineering (CSE) entrance exam. This contains 15 Multiple Choice Questions for Computer Science Engineering (CSE) Test: Cross Compiler (mcq) to study with solutions a complete question bank. The solved questions answers in this Test: Cross Compiler quiz give you a good mix of easy questions and tough questions. Computer Science Engineering (CSE) students definitely take this Test: Cross Compiler exercise for a better result in the exam. You can find other Test: Cross Compiler extra questions, long questions & short questions for Computer Science Engineering (CSE) on EduRev as well by searching above.
QUESTION: 1

A system program that combines separately compiled modules of a program into a form suitable for execution is

Solution:

Explanation: The definition of cross compiler.

QUESTION: 2

A compiler for a high-level language that runs on one machine and produces code for a different machine is called

Solution:

Explanation: So done by the definition.

QUESTION: 3

Cross-compiler is a compiler

Solution:

A compiler for a high-level language that runs on one machine and produces code for a different machine is called a cross compiler.

QUESTION: 4

Cross compiler is used in Bootstrapping.

Solution:

Explanation: Bootstrapping to a new platform. When a software is developed for a new platform, a cross compiler is used to compile necessary tools such as the OS and a native compiler.

QUESTION: 5

Is GCC a cross Complier

Solution:

Explanation:
GCC, a free software collection of compilers, also can be used as cross compile. It supports many languages and platforms.

QUESTION: 6

The __________ is a technique for building cross compilers for other machines

Solution:

Explanation: The Canadian Cross is a technique for building cross compilers for other machines. Given three machines X, Y, and Z, one uses machine X (e.g. running Windows XP on an IA-32 processor) to build a cross compiler that runs on machine Y (e.g. running Mac OS X on an x86-64 processor) to create executables for machine Z.

QUESTION: 7

_________ was developed from the beginning as a cross compiler

Solution:

Explanation: Free Pascal was developed from the beginning as a cross compiler. The compiler executable (ppcXXX where XXX is target architecture) is capable of producing executables for all OS of the same architecture.

QUESTION: 8

If we compile the sam.c file with the command “gcc -o sam sam.c”, then the executable file will be

Solution:

Explanation: This is how the GCC is designed to take names of executable files.

QUESTION: 9

What will be output of the following code?

#include<stdio.h>
int main()
{
printf("%d\t",sizeof(6.5));
printf("%d\t",sizeof(90000));
printf("%d",sizeof('A'));
return 0;
}

Solution:

Explanation: GCC compilers (32 bit compilers) size of:
double is 8 byte
long int is 8 byte
Character constant is 2 byte.

QUESTION: 10

What will be output of the following c code? ( according to GCC compiler)

#include<stdio.h>
int main()
{
signed x;
unsigned y;
x = 10 +- 10u + 10u +- 10;
y = x;
if(x==y) printf("%d %d",x,y);
else if(x!=y) printf("%u %u",x,y);
return 0;
}

Solution:

Explanation: Consider on the expression:
x = 10 +- 10u + 10u +- 10;
10: It is signed integer constant.
10u: It is unsigned integer constant.
X: It is signed integer variable.
As we know operators enjoy higher precedence than binary operators. So
x = 10 + (-10u) + 10u + (-10);
= 10 + -10 + 10 + (-10);
= 0
So, Corresponding signed value of unsigned 10u is +10.

QUESTION: 11

What will be output of the following c code?

#include<stdio.h>
int main()
{
const int *p;
int a=10;
p=&a;
printf("%d",*p);
return 0;
}

Solution:

Explanation: In the following declaration
const int *p;
p can keep address of constant integer.

QUESTION: 12

What will be output of the following c code?

#include<stdio.h>
int main()
{
int a= sizeof(signed) +sizeof(unsigned);
int b=sizeof(const)+sizeof(volatile);
printf("%d",a+++b);
return 0;
}

Solution:

Explanation: Default data type of signed, unsigned, const and volatile is intSo, a = 4 and b =4
Now, a+++b
= a++ + b
= 4 + 4 //due to post increment operator.
=8
But in Linux gcc compiler size of int is 4 byte so your out will be 16.

QUESTION: 13

Which of the following is integral data type?

Solution:

Expanation:
In c char is integral data type. It stores the ASCII value .

QUESTION: 14

 What will be output of the following c code?

#include<stdio.h>
int main()
{
volatile int a=11;
printf("%d",a);
return 0;
}

Solution:

Explanation: Value of volatile variable can’t be predicted because its value can be changed by any microprocessor interrupt.

QUESTION: 15

 What will be output of the following c code?

#include<stdio.h>
const enum Alpha { X, Y=5, Z }p=10;
int main()
{
enum Alpha a,b;
a= X; b= Z;
printf("%d",a+b-p);
return 0;
}

Solution:

Explanation: Default value X is zero and
Z = Y + 1 = 5 + 1 = 6
So, a + b – p
=0 + 6 -10 = -4.