What will be the output of the program

Assignment Help C/C++ Programming
Reference no: EM13996294

1) What is the output of this C code?

#include <stdio.h>

int main()
{
int i = 0, j = 0; while (i < 2)
{
11: i++;
while (j < 3)
{
printf("loop\n");

goto 11;

}}}

a) Loop loop
b) Compile time error
c) loop loop loop loop
d) Infinite loop

2) What is the output of this C code?

#include <stdio.h>

int main()
{
int i = 0, j = 0;
while (11: i < 2)
{
i++;
while (j < 3)
printf("loop\n");

goto 11;

}}

a) loop loop
b) compile time error
c) loop loop loop loop
d) Infinite loop

3) The output of the code below is(When 1 is entered)

#include <stdio.h>
void main()

{

char *th;
printf("enter a value btw 1 to 3:");
scanf("%s", ch);

switch (th)

{ case 1:
printf ("1");

break.
case 2:
printf("2");

break; }}

a) 1
b) 2
c) Compile time error
d) No Compile time error

4) When 2 is entered, The output of the code below is?

#include <stdio.h>

void main() {
int ch;
printf("enter a value btw 1 to 2:");

scanf("%d", &ch);
switch (ch)

{
printf ("hi");
printf ("hello");
case 1:printf("1\n");

break;

printf("Hi");

default:printf("2\n");

}}

a) 1
b) Hi 2
c) Run time error
d) 2

5) When 1 is entered, The output of the code below is?

#include <stdio.h>

void main() {

int ch;
printf("enter a value btw 1 to 2:");

scanf("%d", &ch);
switch (ch, ch + 1,ch<=2)
printf("hi");

case 1:print-F("1\ n");break;
case 2:printf("2");break;

}}

a) 1
b) 2
c) 3
d) Run time error

6) What is the output of this C code?

#include <stdio.h>
int main() {
int 1= 0, j = 0;
11: while (i < 2)

{
i++;
while (j < 3) {
printf("loop\n");

goto 11;}}}

a) loop loop
b) Compile time error
c) loop loop loop loop
d) Infinite loop

7) What will be the output of the program?

#include<stdio.h>
int main()
{
const int 1=0;
Printf("%d\n", i++);

return 0;
}

a) 0
b) 1
c) error: can't modify constant object
d) Error: ++ needs a value

8) What will be the output of the program?

#include<stdio.h>

#define SQUARE(x) x*x
int main()
{
float s=10, u=30, 1=2, a;

a = 2*(s-u*W tat* attf "Result = %f", a);

return 0;
}

a) Result = -100.000000
b) Result = -25.000000
c) Result = 0.000000
d) Result = 100.000000
.

9) What will be the output of the program?

#include<stdio.h>
int main()
{
unsigned int res;
res= (64 >>(2+1-2)) & (~(1<<2));

printf("%d\n", res);
return 0;
}

a) 32
b) 64
c) 0
d) 128

10) what will be the output of the program?

void main()
{
int 1=2,j=3,k,l;

float a b;
k=i/j*j;
l=j/i*j;

a= i/j*j;
b=j/i*i;
printf("%d %d %f %f" k,l,a,b);
}

a) 3,0,0,0
b) 0,3,0.000000,2.000000
c) 0,0,0,0
d) error

11) what will be the output of the following program?

void main()
{
int a, b;
a=3--25;
b= -3 --(-3);
printf(" %d b= %d", a,b);
}

a) a=22,b=-6
b) a=-6,b=22
c) a=3,b=3
d) error

12) What will be output when you will execute following c code?

Choose all that apply:

#include<stdio.h>
void main(){
int x=-1,y=-1.;
if(++x=++y)
printf("R.I. ponting");

else

printf("C.H. Gayle");
}

a) R.T Ponting
b) C.H. Gayle
c) Warning: x and y are assigned a value that is never used
d) Warning: Condition is always true
e) Compilation error

13) What will be the output of the program?

#include<stdio.h>
int main()
{
int i=4, j=-1, k=0, w, x, y, z;
w= i || j || k;
x= i && j && k;

y = i || j && k;
z= i &&j || k;

printf("%d, %d, %d, %d\n", w, x, y, z);

return 0;
}

a) 1, 1, 1, 1
b) 1, 1, 0, 1
c) 1, 0, 0, 1
d) 1, 0, 1, 1

14) Comment on the following code below

#include <stdio.h>
void main()
{
int x = 5;
if (true);
printf("hello");
}

a) It will display hello
b) It will throw an error
c) Nothing will be displayed
d) Compiler dependent

15) The output of the code below is

#include <stdio.h>
void main()
{
int x = 5;
if (x < 1);
printf("Hello");
}

a) compile time error
b) Run time error
c) Hello
d) Varies

16) what is the output of the program?

void main()
{
printf("hai");
}
int main()
{
printf("hello");
return 0;
}

a) Hi
b) Hello
c) Compile time error
d) Nothing

17) The output of the code below is(when 1 is entered)

#include <stdio.h>

void main()
{
double ch;
printf("enter a value btw 1 to 2:");

scanf("%lf", &ch);
switch (ch)
{
case 1:printf("1");break;
case 2:printf("2");break;
}
}

a) Compile time error
b) 1
c) 2
d) Varies

18) What is the output of this C code?

#include <stdio.h>

void main()
{
int h = 8;
intb=4*6+3*4<3*4:3;

printf("%d\n", b);
}

a) 3
b) 33
c) 34
d) Run time error

19) What is the output of this C code?

#include <stdio.h>

void main()
{
char a = 'A'; char b = 'B';

int c = a + b %3 - 3 * 2;
printf("%d\n", c);
}

a) 65
b) 58
c) 64
d) 59

20) What is the output of this C code?

#include<stdio.h> int main()
{
printf("%c\n", ~('C'*-1));

return 0;

}

a) A
b) B
c) C
d) D

Reference no: EM13996294

Questions Cloud

Explain your own basis for making ethical decisions : Write a paper in which you explain your own basis for making ethical decisions. You are welcome to employ what you have learned from your study of traditional approaches, but you may also develop your own distinctive approach
What is the ratio of the frequency you hear : What is the ratio of the frequency you hear while the car is approaching to the frequency you hear while the car is moving away?
Are there vital ethical principles that it fails to mention : Summarize the features of this code and examine it critically. Are there vital ethical principles that it fails to mention? Does it overemphasize elements that are not really important? What large- or small-scale revisions might improve the code
What justifies the imposition of governmental authority : Should the government provide security by overcoming the selfish desires of the individual citizen, or should citizens cooperate voluntarily in service of the general welfare of all? What justifies the imposition of governmental authority on indivi..
What will be the output of the program : what will be the output of the program?
How far in meters does she fall in four seconds : The force due to air resistance is constant throughout the fall and is (0,10,0) N. How far (in meters) does she fall in 4 seconds?
Preparing a pro forma income statement : What specific prices, sales volumes, market shares, per pair costs, and profit margins it will probably take to achieve the strategic and financial objectives the company's management team has set.
Earnings as a result of this investment? : What pretax amounts did S&L include in its 2011 and 2012 earnings as a result of this investment?
Advantages and disadvantages of normative theories : Finally, discuss the advantages and disadvantages of these normative theories as methods for making moral decisions in practical cases. Use what you have written about the application of each theory to your example as evidence of the merits of eac..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd