Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

1) What is the output of this C code?

#include

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

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

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

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

#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
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
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
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
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
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

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

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

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 int main()
{
printf("%c\n", ~('C'*-1));

return 0;

}

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

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M91705134

Have any Question?


Related Questions in C/C++

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As