[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Declarations and Initializations Questions

NA
SHSTTON
133
Solv. Corr.
296
Solv. In. Corr.
429
Attempted
0 M:33 S
Avg. Time

41 / 54

What will be the result of the following program?
#include <stdio.h>
void main()
      {
       unsigned short a=-1;
       unsigned char b=a;
       printf("%d %d ",a,b);
      }
What is output of the program?

A65535 -1

B65535 65535

C65535 255

D-1 -1

ENone of above

Answer: Option C

Explanation:

The value range for unsigned short  is from 0 to 65,535.

Clearly, a cannot be assigned with -1, as -1 is not in the range of unsigned short. So, when we try to assign -1 to a, automatically 65535 gets assigned to a, as it follows a cyclic pattern.

Same is the result when we try to assign -1 to b, which is an unsigned char. The value range for unsigned char is from 0 to 255. So, automatically, 255 gets assigned to b.

Hence, the output is 65535 255.

Workspace

NA
SHSTTON
72
Solv. Corr.
244
Solv. In. Corr.
316
Attempted
0 M:2 S
Avg. Time

42 / 54

What will be the result of the following program?
#include <stdio.h>
int main()
{
static int i;
int j;
for(j=0;j<10;j++)
{
i= i+2;
i = i-j;
}
printf("%d",i);
return 0;
}

A25

B-25

C20

D-20

ENone of these

Answer: Option B

Explanation:

i=0 as it is static variable,for first iteration 

i=i+2 will be 0+2 =2;

i = i - j will be 2-0 = 2;

second iteration i=2

j=1;

i=i+2 will be 4

i =i-j will be 4-1 =3

third iteration i=3

j=2;

i=i+2 will be 5

i= i-j will be 5-2 =3

fourth iteration i=3

j=3;

i=i+2 will be 5

i= i-j will be 5-3 =2

fifth iteration i=2

j=4;

i=i+2 will be 4

i =i-j will be 4-4=0

sixth iteration i=0

j=5;

i=i+2 will be 2

i= i-j will be 2-5 =-3

seventh iteration i=-3

j=6;

i=i+2 will be -1

i =i-j will be -1-6 =-7

eighth iteration i=-7

j=7;

i=i+2 will be -5

i =i-j will be -5-7 =-12

ninth iteration i=-12

j=8;

i=i+2 will be -10

i =i-j will be -10-8 =-18

tenth iteration i=-18

j=9;

i=i+2 will be -16

i =i-j will be -16-9 =-25

printf("%d", i); will be -25



Workspace

NA
SHSTTON
78
Solv. Corr.
195
Solv. In. Corr.
273
Attempted
0 M:0 S
Avg. Time

43 / 54

What is the output of the following 'C' program ?
#include<stdio.h>
long unsigned static const ddlg(){
    static const long unsigned a=0101;
    return a;
}
int main(){
    long number;
    number=ddlg();
    printf("%X",number);
    return 0;
}

A41

B43

CCompilation error

DNone of the above

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
60
Solv. Corr.
216
Solv. In. Corr.
276
Attempted
0 M:0 S
Avg. Time

44 / 54

Choose the correct option.

Which is the valid declaration?


A#typedef struct { int i;}in;

Btypedef struct in {int i;};

C#typedef struct int {int i;};

Dtypedef struct {int i;} in;

Answer: Option D

Explanation:

Option B is also correct. Type it out @ideone.com and check yourself.

Workspace

NA
SHSTTON
118
Solv. Corr.
148
Solv. In. Corr.
266
Attempted
1 M:1 S
Avg. Time

45 / 54

What is the output of the following 'C' program ?
#include<stdio.h>
printd (int n)
{
if (n < 0)
{
printf ("-");
n = -n;
}
if (n % 10)
printf ("%d", n);
else
printf ("%d", n/10);
printf ("%d", n);
}

If initially n = -24;

A-24

B24

C-2424

DNone of the above

Answer: Option C

Explanation:

Let us discuss the code line by line-

Initially, n=24

Line 3 =>    if(n<0), is true because -24<0.

Line 5 =>    "-" get printed.

Line 6 =>    n=-n, or n=-(-24), or n=24

Line 8 =>    if(n%10), or if(24%10), or if(4), which is true as "4 is not equal to 0" is true.

Line 9 =>    "24" gets printed

Here, the else block won't get executed as if block has already executed.

Finally, Line 12 =>    "24" gets printed.

Hence, the complete output is -2424

Workspace

NA
SHSTTON
271
Solv. Corr.
35
Solv. In. Corr.
306
Attempted
0 M:8 S
Avg. Time

46 / 54

What is the output of the following 'C' program ?
#include<stdio.h>
int main()
 {
 int i = 10 ; 
 printf("%d\n", i/2 );
 
 }

A10

B5

Cerror

Dwarning

Answer: Option B

Explanation:

Clearly, value of i=10, and we are printing value of 'i/2'.

Hence, the output is 5.

Workspace

NA
SHSTTON
69
Solv. Corr.
232
Solv. In. Corr.
301
Attempted
0 M:0 S
Avg. Time

47 / 54

What is the output of the following 'C' program ?
#include<stdio.h>
int main()
{
 char c = 255; 
 printf ("%d",c);
 return 0;
}

Aillegal character assignment

Bprints -1

Cprints 2

Dprints 255

Answer: Option B

Explanation:

255 in binary can be represented as 11111111. What does this number represent?

Before that, we should know that char can store numbers only -128 to 127. The most significant bit is kept for the sign bit. Clearly, 11111111 represents a negative number. To check which number it represents we find the 2’s complement of it, which is 00000001, which is nothing but 1 in decimal.

Hence, 11111111 represents -1, which is the required output.

 

Workspace

NA
SHSTTON
251
Solv. Corr.
28
Solv. In. Corr.
279
Attempted
0 M:0 S
Avg. Time

48 / 54

What will be output of the following "C" code?
#include <stdio.h>
main()
{
100;
printf("%d",100);
}

AError

B100

CGarbage value

D100100

Answer: Option B

Explanation:

Here, the only thing that's getting executed is line no. 5, so 100 gets executed.

Line no. 4 is basically of no is use. You may write any number you want, but it's practically of no use, it's still going to print 100.

Workspace

NA
SHSTTON
157
Solv. Corr.
130
Solv. In. Corr.
287
Attempted
0 M:0 S
Avg. Time

49 / 54

Predict the output of following code:
#include <stdio.h>
void main()
{
float a=1.1;
double b=1.1;
if(a==b)
printf("equal");
else
printf("not equal");
}

A? equal

Bnot equal

CError

Dequal not equal

Answer: Option B

Explanation:

datatype is different cant be compared; hence result will be 0

Workspace

NA
SHSTTON
139
Solv. Corr.
157
Solv. In. Corr.
296
Attempted
0 M:41 S
Avg. Time

50 / 54

Predict the output of following code:
#include <stdio.h>
void main()
{
int sum;
char ch1='a';
char ch2='b';sum=ch1+ch2;
printf("%d",sum);
}

AError

B195

C201

D"ab"

Answer: Option B

Explanation:

ascii sum;
sum = 97+98 = 195

Workspace

C Programming Declarations and Initializations Questions and Answers pdf

At C Programming topic Declarations and Initializations page No: 5 you will find list of 10 practice questions, tips/trick and shortcut to solve questions, solved questions, quiz, and download option to download the whole question along with solution as pdf format for offline practice. You can practice all the listed C Programming Declarations and Initializations topic questions offline too, by downloading the MCQs practice question of Declarations and Initializations with detail solution, with formula/Tips & Tricks, with Solved examples and with top-rated users answers, which will give you best answer ascross webs. It is one of the perfect Declarations and Initializations e-book pdf covering all types of questions in detail. These C Programming test with answers pdf cover all types of question asked in IIFT, XAT, SNAP, GRE, GMAT, NMAT, CMAT, MAT or for IT companies written exam like Wipro, HCL, Infosys, Accenture, Government exams, IBPS Exams etc. There are multiple formats to download your online free C Programming Declarations and Initializations e-book, like fully solved, unsolved questions with Answers sheet. Even you can customize your ebook format by adjusting the given options in the download section to make it your one of the best C Programming topic-based ebook. It is recommended to bookmark this page C Programming Declarations and Initializations for your preparation. Most of the students and fresher candidates finding it hard to clear the C Programming section in exams. Here Given Declarations and Initializations practice questions, quiz, fully solved questions, tips & trick and Mock tests, which include question from each topic will help you to excel in Declarations and Initializations. Each test has all the basics questions to advanced questions with answer and explanation for your clear understanding, you can download the test result as pdf for further reference.

At C Programming topic Declarations and Initializations, 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 Declarations and Initializations, 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 Declarations and Initializations MCQs practice question, and one after solving all the question of the respective level, you can refer back your Declarations and Initializations quiz result any time or you can download it as pdf for reference.

C Programming Declarations and Initializations Customize Online Mock Test

This is own type of mock test, where At this C Programming Declarations and Initializations MCQs mock test section, you will able to attempt only the questions related to Declarations and Initializations, 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 Declarations and Initializations, 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 Declarations and Initializations 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 Declarations and Initializations questions, by providing the same type of practice questions from practice exercise. The best part of this Declarations and Initializations, all these mock tests listed here are free and you can take as Many time, as many you want. When you continue to give Declarations and Initializations 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 Declarations and Initializations Customize topic on which you will practice more will beneficial for you in future during campus placement.Declarations and Initializations Mock Tests

C Programming Declarations and Initializations Quiz Online Test

The details of the C Programming Declarations and Initializations 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 Declarations and Initializations that you see and keep them in mind while answering questions.

C Programming Declarations and Initializations MCQs Practice Questions with Answer

On this Declarations and Initializations 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 Declarations and Initializations Question Quickly. It contains all the C Programming topic Declarations and Initializations 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 Declarations and Initializations topic based quiz.

C Programming Declarations and Initializations solved examples question

Clarity of concepts is a must if you want to master the skill of solving C Programming problems. This page contains sample C Programming Declarations and Initializations questions and answers for freshers and competitive exams. Declarations and Initializations Questions with the detailed description, the explanation will help you to master the topic. Here solved examples with detailed answer description, explanations are given and it would be easy to understand. How to solve qDeclarations and InitializationsC Programming? Here are some examples solved with the Common Rules/tricks/tips of C Programming. Enhance your chance to score maximum marks in C Programming sections through. Error Spotting Grammar Questions Online Test for Free. Fully solved Sentence Formation MCQs questions with detailed answer description. C Programming is an important topic for any exams but most aspirants find it difficult. You need to learn various tricks tips, rules, etc to solve quickly. At this page, you will find frequently asked Declarations and Initializations questions or problems with solutions, shortcuts, formulas for all-important competitive exams like IT companies exams, interviews. It is always a best practice to go through the example and understand the types of question and way to solve it, so let's do some examples to calculate efficiency, read through all the given here solved examples. You can post your solution, tips, trick and shortcut if you have any in respect to questions.

You can get here fully solved Declarations and Initializations examples with a detailed answer and description. You can solve Declarations and Initializations 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 Declarations and Initializations. Declarations and Initializations became one of the most important sections in the entire competitive exams, Companies Campus, and entrance online test. Go through Declarations and Initializations Examples, Declarations and Initializations sample questions. You can Evaluate your level of preparation in Declarations and Initializations by Taking the Q4Interivew Declarations and Initializations Online Mock Test based on most important questions. All the Declarations and Initializations 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 Declarations and Initializations?

In this practice section, you can practice C Programming Questions based on "Declarations and Initializations" 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 Declarations and Initializations questions and answers with explanation?

Q4Interview provides you lots of fully solved C Programming (Declarations and Initializations) 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 Declarations and Initializations quiz questions with answers as PDF files and eBooks.

Where can I get C Programming Declarations and Initializations Interview Questions and Answers (objective type, multiple-choice, quiz, solved examples)?

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