Amazon Coding Placement Paper
Amazon Coding Placement Paper
m/
● Int – Represent number (integer)
● Float – Number with a fraction part.
co
● Double – Double-precision floating point value
w.
● Char – Single character
no
● Void – Special purpose type without any value.
rs
Q 3) What is the description for syntax errors?
he
es
Ans) The mistakes when creating a program called syntax errors. Misspelled commands or
fr
/function, data type mismatches can identify as common examples for syntax errors.
ww
Ans) When there is a pointer with pointing to a memory address of any variable, but after
some time the variable was deleted from the memory location while keeping the pointer
pointing to that location.
m/
co
Ans) A function, which has a function definition prefixed with a static keyword is defined as
w.
a static function. The static function should call within the same source code.
no
Q 8) What is the difference between abs() and fabs() functions?
rs
he
Ans) Both functions are to retrieve absolute value. abs() is for integer values and fabs() is
for floating type numbers. Prototype for abs() is under the library file < stdlib.h > and fabs()
es
Ans) Uninitialized pointers in the C code are known as Wild Pointers. These are a point to
//
some arbitrary memory location and can cause bad program behavior or program crash.
s:
tp
Ans) ‘++a” is called prefixed increment and the increment will happen first on a variable.
‘a++’ is called postfix increment and the increment happens after the value of a variable
used for the operations.
Ans) ‘==’ is the comparison operator which is use to compare the value or expression on
the left-hand side with the value or expression on the right-hand side.
‘=’ is the assignment operator which is use to assign the value of the right-hand side to the
variable on the left-hand side.
m/
co
w.
In this example Name of the function is Sum, the return type is integer data type and it
no
accepts two integer parameters.
rs
Q 13) What is the explanation for cyclic nature of data types in C?
he
es
Ans) Some of the data types in C have special characteristic nature when a developer
assign value beyond the range of the data type. There will be no any compiler error and the
fr
value change according to a cyclic order. This is called as cyclic nature and Char, int, long
w.
int data types have this property. Further float, double and long double data types do not
ww
This is called as cyclic nature and Char, int, long int data types have this property. Furtherfloat,
s:
double and long double data types do not have this property.
tp
Ans) The file contains the definitions and prototypes of the functions being used in the
program are called a header file. It is also known as a library file.
Example– The header file contains commands like printf and scanf is the stdio.h.
Q 15) There is a practice in coding to keep some code blocks in comment symbols than
delete it when debugging. How this affect when debugging?
Ans) This concept called as commenting out and is the way to isolate some part of the code
which scans possible reason for the error. Also, this concept helps to save time because if
the code is not the reason for the issue it can simply uncomment.
Q 16) What are the general description for loop statement and available loop types in C?
Ans) A statement that allows executing statement or group of statements in repeated way is
defined as a loop. Following diagram explains
m/
co
w.
no
rs
he
es
fr
w.
ww
//
s:
tp
ht
● While loop
● For Loop
● Do…While Loop
● Nested Loop
m/
co
● Return Type -> Data type of the return value of the function.
w.
● Function Name -> The name of the function and it is important to have a
no
meaningful name that describes the activity of the function.
rs
● Parameters -> The input values for the function that need to use perform the
he
required action.
● Function Body -> Collection of statement that needs to perform the required
es
action.
fr
w.
Ans) A pointer variable that contains the address of another pointer variable is called pointer
//
on a pointer. This concept de-refers twice to point to the data held by a pointer variable.
s:
tp
ht
Ans) The purpose of the Break keyword is to bring the control out of the code block which is
executing. It can appear only in Looping or switch statements.
Q 21) What is the behavioral difference when include header file in double quotes (“”) and
angular braces (<>)?
Ans) When Header file include within double quotes (“”), compiler search first in the working
directory for the particular header file. If not found then in the built in the include path. But
when Header file include within angular braces (<>), the compiler only search in the working
directory for the particular header file.
Ans) In general programs store data into files and retrieve existing data from files. With the
sequential access file such data saved in a sequential pattern. When retrieving data from
such files each data need to read one by one until required information find.
Q 23) What is the method to save data in stack data structure type?
m/
Ans) Data is stored in Stack data structure type using First in Last out (FILO) mechanism.
co
Only top of the stack is accessible at a given instance. Storing mechanism is referred as a
w.
PUSH and retrieve is referred as a POP.
no
Q 24) What is the significance of C program algorithms?
rs
he
Ans) The algorithm needs to create first and it contains step by step guidelines on how the
solution should create. Also, it contains the steps to consider and the required
es
Q 25) What is the correct code to have following output in C using nested for loop?
ww
//
s:
tp
ht
m/
co
w.
no
rs
he
es
Q 26) Explain the use of function toupper() with and example code?
fr
Ans) Toupper() function is use to convert the value to uppercase when it uses with
w.
characters.
ww
//
Code –
s:
tp
ht
m/
co
w.
Result –
no
rs
he
es
fr
w.
Q #27) What is the code in while loop that returns the output of given code?
ww
//
s:
tp
ht
m/
co
Q 28) What is the incorrect operator form following list(== , <> , >= , <=) and what is the
w.
reason for the answer?
no
Ans) Incorrect operator is ‘<>’.This is the format correct when writing conditional
rs
statements, but it is not a correct operation to indicate not equal in C programming and it
he
Code –
fr
w.
ww
//
s:
tp
ht
Error –
Q 29) Is it possible to use curly brackets ({}) to enclose single line code in C program?
m/
Ans) Yes, it is working without any error. Some programmers like to use this to organize the
co
code. But the main purpose of curly brackets is to group several lines of codes.
w.
no
Q 30) Describe the modifier in C?
rs
Ans) Modifier is a prefix to the basic data type which is used to indicate the modification for
he
Example– In 32-bit processor storage space for int data type is 4.When we use it with
fr