[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.

Variables & Data Types Questions

NA
SHSTTON
22
Solv. Corr.
16
Solv. In. Corr.
38
Attempted
0 M:0 S
Avg. Time

1 / 51

What will be output of the following "c" code?
#include<stdio.h>
int main()
{
float i, j;
scanf(%f  %f, &i, &j);
printf(%.2f %.3f, i, j);
return 0;
}

What will be the output for the give input 12.342 and 123.4568

A12.34 123.456

B12.342 123.4568

C12 123

DCompilation Error

ENone of these

Answer: Option A

Explanation:

I see couple of issues with question.



1. there should be compliation issue with this statement - printf(%.2f %.3f, i, j);



I have tried to complie 



$ gcc -o q8 q8.c

q8.c: In function ‘main’:

q8.c:6:8: error: expected expression before ‘%’ token

  scanf(%f %f,

Workspace

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

2 / 51

What will be output of the following "c" code?
#include<stdio.h>
void main()

{
float me = 1.1; 
double you = 1.1; 
if(me==you)
printf("I love U"); 
else
printf("I hate U"); 
}

AI hate U

BI love U

CCompiler Error

DNone of these

Answer: Option A

Explanation:

For floating point numbers (float, double, long double) the values cannot be predicted exactly. Depending on the number of bytes, the precession with of the value represented varies. Float takes 4 bytes and long double takes 10 bytes. So float stores 0.9 with less precision than long double.

Important Note:
Never compare or at-least be cautious when using floating point numbers with relational operators (== , >, <, <=, >=,!= ) .

Workspace

NA
SHSTTON
12
Solv. Corr.
58
Solv. In. Corr.
70
Attempted
0 M:0 S
Avg. Time

3 / 51

What will be output of the following "c" code?
#include<stdio.h>
int main(){
    int a=5;
    static int b=a;
    printf("%d %d",a,b);
    return 0;
}

A5 5

B5 0

C5 null

D5 Garbage

ECompilation error

Answer: Option E

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
24
Solv. Corr.
97
Solv. In. Corr.
121
Attempted
0 M:0 S
Avg. Time

4 / 51

What will be output of the following "c" code?
#include<stdio.h>
void main()
{
static int var = 5; 
printf("%d ",var--); 
if(var)
main();
}

A5 4 3 2 1 0

BInfinite loop

CCompiler Error

D5 4 3 2 1

ENone of these

Answer: Option D

Explanation:

When static storage class is given, it is initialized once. The change in the value of a static variable is retained even between the function calls. Main is also treated like any other ordinary function, which can be called recursively.

Workspace

NA
SHSTTON
7
Solv. Corr.
34
Solv. In. Corr.
41
Attempted
0 M:0 S
Avg. Time

5 / 51

What will be output of the following "c" code?
#include<stdio.h>
int main(){
    float x;
    x=(int)5.6f*3.2f/sizeof((int)6.6);
    printf("%f",x);
    return 0;
}

A8.96

B9.6

C8

D2

ECompilation error

Answer: Option C

Explanation:

Variable x is initially declared as float.

In line 4-

x=(int)5.6f*3.2f/sizeof((int)6.6);

or, x=(int)5.6f*3.2f/sizeof(6);        [Since, we are typecasting 6.6 to int]

or, x=(int)5.6f*3.2f/4;                    [Since, 6 is integer type, and size of int is 4 bytes]

or, x=(int)4.48;

or, x=4;                                         [Since, 4.48 is typecasted to int]

In line 5, we are converting int x=4 to float type and we are printing it.

Hence, the output is 4.000000.

Workspace

NA
SHSTTON
24
Solv. Corr.
83
Solv. In. Corr.
107
Attempted
0 M:0 S
Avg. Time

6 / 51

What will be output of the following "c" code?
#include<stdio.h>
int main(){
    float **(*ptr)[4]=(float **(*)[4])0;
    ptr+=5;
    printf("%d  %d",ptr,sizeof ptr);
    return 0;
}

A0 2

B5 2

C4 2

D40 2

ECompilation error

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
18
Solv. Corr.
17
Solv. In. Corr.
35
Attempted
0 M:24 S
Avg. Time

7 / 51

What will be output of the following "c" code?
#include<stdio.h>
int main() { 
extern out; 
printf("%d", out); 
return 0;
} 
int out=100;

AUndefined reference symbol out

BCompiler Error

C100

Dgarbage Value

Answer: Option C

Explanation:

This is the correct way of writing the previous program.

Workspace

NA
SHSTTON
11
Solv. Corr.
23
Solv. In. Corr.
34
Attempted
0 M:0 S
Avg. Time

8 / 51

What will be output of the following "c" code?
#include<stdio.h>
void main()
{
extern int i;
i=20; 
printf("%d",i);
}

A20

Bgarbage Value

CLinker Error : Undefined symbol "I"

DNone of these

Answer: Option C

Explanation:

extern storage class specifies to the compiler that the memory for "i" is allocated in some other program and that address will be given to the current program at the time of linking.

But linker finds that no other variable of name "i" is available in any other program with memory space allocated for it.

Hence a linker error has occurred .

Workspace

NA
SHSTTON
59
Solv. Corr.
202
Solv. In. Corr.
261
Attempted
1 M:18 S
Avg. Time

9 / 51

What will be output of the following "c" code?
Note: 32 bit compiler

#include<stdio.h>
int main(){
    float **(*ptr)[4]=(float **(*)[4])0;
    ptr+=5;
    printf("%d  %d",ptr,sizeof ptr);
    return 0;
}

A0 2

B160 8

C40 2

D80 4

ECompilation error

Answer: Option D

Explanation:

ANSWER is wrong...should be 80,4
because size of float ** is 4 bytes

Workspace

NA
SHSTTON
41
Solv. Corr.
47
Solv. In. Corr.
88
Attempted
0 M:0 S
Avg. Time

10 / 51

What will be output of the following "c" code?
#include<stdio.h>
int main(){
    float x;
    x=(int)5.6 * 3.2/sizeof((int)6.6);
    printf("%f",x);
    return 0;
}

A8.96

B9.6

C4

D2

ECompilation error

Answer: Option C

Explanation:

Variable x is initially declared as float.

In line 4-

x=(int)5.6*3.2/sizeof((int)6.6);

or, x=(int)5.6*3.2/sizeof(6);        [Since, we are typecasting 6.6 to int]

or, x=(int)5.6*3.2/4;                    [Since, 6 is integer type, and size of int is 4 bytes]

or, x=(int)4.48;

or, x=4;                                         [Since, 4.48 is typecasted to int]

In line 5, we are converting int x=4 to float type and we are printing it.

Hence, the output is 4.000000.

Workspace

C Programming Variables & Data Types Questions and Answers pdf

At C Programming topic Variables & Data Types page No: 1 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 Variables & Data Types topic questions offline too, by downloading the MCQs practice question of Variables & Data Types 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 Variables & Data Types 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 Variables & Data Types 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 Variables & Data Types for your preparation. Most of the students and fresher candidates finding it hard to clear the C Programming section in exams. Here Given Variables & Data Types practice questions, quiz, fully solved questions, tips & trick and Mock tests, which include question from each topic will help you to excel in Variables & Data Types. 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 Variables & Data Types, 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 Variables & Data Types, 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 Variables & Data Types MCQs practice question, and one after solving all the question of the respective level, you can refer back your Variables & Data Types quiz result any time or you can download it as pdf for reference.

C Programming Variables & Data Types Customize Online Mock Test

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

C Programming Variables & Data Types Quiz Online Test

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

C Programming Variables & Data Types MCQs Practice Questions with Answer

On this Variables & Data Types 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 Variables & Data Types Question Quickly. It contains all the C Programming topic Variables & Data Types 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 Variables & Data Types topic based quiz.

C Programming Variables & Data Types 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 Variables & Data Types questions and answers for freshers and competitive exams. Variables & Data Types 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 qVariables & Data TypesC 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 Variables & Data Types 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 Variables & Data Types examples with a detailed answer and description. You can solve Variables & Data Types 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 Variables & Data Types. Variables & Data Types became one of the most important sections in the entire competitive exams, Companies Campus, and entrance online test. Go through Variables & Data Types Examples, Variables & Data Types sample questions. You can Evaluate your level of preparation in Variables & Data Types by Taking the Q4Interivew Variables & Data Types Online Mock Test based on most important questions. All the Variables & Data Types 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 Variables & Data Types?

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

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

Where can I get C Programming Variables & Data Types Interview Questions and Answers (objective type, multiple-choice, quiz, solved examples)?

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