1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
koban [17]
2 years ago
12

Write a c program to print all possible marking schemes of 15 questions each with 3.

Computers and Technology
1 answer:
andrey2020 [161]2 years ago
3 0

Answer:

#include <math.h>

#include <stdio.h>

#include <string.h>

#define BASE 3

#define NRQUESTIONS 15

void toABC(int n, char* buf, int base, int size) {

   memset(buf, 'A', size);

   buf[size] = 0;

   while (n && size) {

       buf[--size] = 'A' + (n % base);

       n /= base;

   }    

}

int main()

{

   char buf[16];

   for (int i = 0; i < pow(BASE, NRQUESTIONS); i++) {

       toABC(i, buf, BASE, NRQUESTIONS);

       printf("%s\n", buf);

   }

}

Explanation:

Assuming 3 is the number of possible answers to choose from for each question.

I tackled this by having an integer counter enumerate all values from 0 to 3^15, and then convert each integer to a base-3 representation, using ABC in stead of 012.

You might be interested in
Provide an example of a question that could NOT be answered with a binary message. Explain why this is the case, making referenc
solong [7]
This is a question with a much simpler answer given its open ended ness - a representation merely means, given binary data, we can determine what 'thing' that binary data corresponds to.

<span>That makes the question unanswerable, because words can all be represented in binary data, and the question cannot be answered without those. Thus, all answers we can convey have a binary representation of some form (that form being the translation of the words we used to communicate the answer into binary data).</span>
7 0
3 years ago
What is cryptocurrency ? I need to do a research one it please help!
icang [17]

A cryptocurrency is a digital asset designed to work as a medium of exchange that uses strong cryptography to secure financial transactions, control the creation of additional units, and verify the transfer of assets.

8 0
3 years ago
Your sister is starting 9th grade next year and is thinking about going to college. What step would you recommend she take first
lozanna [386]

think about what she wants to do with her life and what collage is best fit for that


5 0
2 years ago
Read 2 more answers
What careers are most likely to require business skills
olchik [2.2K]

i would say maybe an accountant, entrepreneur, business reporter, or something like that.

8 0
2 years ago
What is Microsoft word<br>​
Snowcat [4.5K]

Answer:

A software where you can document letters, essays or anything really.

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • A blue line, called a ____ line, that appears when you are dragging a GUI object on a Windows Form object indicates that the obj
    10·1 answer
  • If you wanted to create a graph that showed how much each value contributed to the whole value, you would use a _____.
    15·2 answers
  • How do you read a column
    8·1 answer
  • Nick’s computer has been restarting on its own. what action should he take to solve this issue?
    14·1 answer
  • Write a Python program to do the following: (a)Use a for loop and a random integer generator to generate 5 random integers in 1
    10·1 answer
  • Jennifer recently bought a new computer to type a new manuscript she’s been working on. She also stored a lot of movies on it to
    10·1 answer
  • Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative intege
    10·1 answer
  • The following program segment is designed to compute the product of two nonnegative integers X and Y by accumulating the sum of
    9·1 answer
  • A computer reads a sequence from top to bottom and left to right.
    13·1 answer
  • Is a device used to test the network connection.
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!