I am new to PHP. I am developing an online examination system. In an HTML page I have arranged questions and for selecting answers I have used four radio buttons for 4 options. Similarly for all the 20 questions. Now what is problem with this is. I want to get the selected value from radio buttons and i want to store it in avariable and i need to calculate the score i.,e no of correct options. Finally i want to store it into database. Can anyone please give me the example code to do this... this is my html code
<html>
<head>
<body>
<font size=+1 color=blue><u><h1>C Language exam</h1></u></font><p>
<form method="POST" action="validate1.php">
<pre>
<font face="verdana">
1.In C, if you pass an array as an argument to a function, what actually gets passed?
<p>
<input type=radio name=1 value=a>A. Value of elements in array<br>
<input type=radio name=1 value=b>B. First element of the array<br>
<input type=radio name=1 value=c>C. Base address of the array<br>
<input type=radio name=1 value=d>D. Address of the last element of array<br>
2.How will you print
on the screen?<p>
<input type=radio name=2 value=a>A. printf("
");<br>
<input type=radio name=2 value=b>B. echo "\
";<br>
<input type=radio name=2 value=c>C. printf('
');<br>
<input type=radio name=2 value=d>D. printf("\
");<br>
3.C is what type of language?<p>
<input type=radio name=3 value=a>A. Low leval language<br>
<input type=radio name=3 value=b>B. high level language<br>
<input type=radio name=3 value=c>C. middle level language<br>
<input type=radio name=3 value=d>D. medium language<br>
4.Integer type char storage size.<p>
<input type=radio name=4 value=a>A. 2 bytes<br>
<input type=radio name=4 value=b>B. 1 byte<br>
<input type=radio name=4 value=c>C. 4 byte<br>
<input type=radio name=4 value=d>D. 8 bytes<br>
5.What is the output of given program
#include <stdio.h>
int main()
{ /* my first program in C */
printf("Hello, World!
");
return 0;
}<p>
<input type=radio name=5 value=a>A. first program<br>
<input type=radio name=5 value=b>B. world<br>
<input type=radio name=5 value=c>C. hello world<br>
<input type=radio name=5 value=d>D. hello<br>
6.How many times the program will print "welcome" ?
#include<stdio.h>
int main()
{
printf(“welcome”);
main();
return 0;
}<p>
<input type=radio name=6 value=a>A. Infinite times<br>
<input type=radio name=6 value=b>B. 32767 times<br>
<input type=radio name=6 value=c>C. 65535 times<br>
<input type=radio name=6 value=d>D. Till stack overflows<br>
7.Symbol of LOGICAL AND operation<p>
<input type=radio name=7 value=a>A. &<br>
<input type=radio name=7 value=b>B. &&<br>
<input type=radio name=7 value=c>C. ><br>
<input type=radio name=7 value=d>D. == <br>
8.What are the different types of real data type in C ?<p>
<input type=radio name=8 value=a>A. float, double<br>
<input type=radio name=8 value=b>B. short int, double, long int<br>
<input type=radio name=8 value=c>C. short int, double, long int<br>
<input type=radio name=8 value=d>D. double, long int, float<br>
9.Which statement will you add in the following program to work it correctly?
#include<stdio.h>
int main()
{
printf(“%f
”, log(36.0));
return 0;
}<p>
<input type=radio name=9 value=a>A. #include<conio.h><br>
<input type=radio name=9 value=b>B. #include<math.h><br>
<input type=radio name=9 value=c>C. #include<stdlib.h><br>
<input type=radio name=9 value=d>D. #include<dos.h><br>
10.What will be the output of the program?
#include<stdio.h>
int main()
{
int i=-3, j=2, k=0, m;
m = ++i && ++j || ++k;
printf(“%d,%d,%d,%d
”, i, j, k, m);
return 0;
}<p>
<input type=radio name=10 value=a>A. 1,2,0,1<br>
<input type=radio name=10 value=b>B. -3,2,0,1<br>
<input type=radio name=10 value=c>C. -2,3,0,1<br>
<input type=radio name=10 value=d>D. 2,3,1,1<br>
11.C closely associated with the which operating system?<p>
<input type=radio name=11 value=a>A. windows<br>
<input type=radio name=11 value=b>B. linux<br>
<input type=radio name=11 value=c>C. unix<br>
<input type=radio name=11 value=d>D. mac<br>
12.C was developed at Bell Laboratories in which year?<p>
<input type=radio name=12 value=a>A. 1943<br>
<input type=radio name=12 value=b>B. 1954<br>
<input type=radio name=12 value=c>C. 1972<br>
<input type=radio name=12 value=d>D. 1975<br>
13.In the following code, the P2 is Integer Pointer or Integer?
Typedef int *ptr;
ptr p1, p2;<p>
<input type=radio name=13 value=a>A. Integer<br>
<input type=radio name=13 value=b>B. Integer pointer<br>
<input type=radio name=13 value=c>C. Error in declaration<br>
<input type=radio name=13 value=d>D. None of above<br>
14.In the following code what is 'P'?
Typedef char *charp;
Const charp P;<p>
<input type=radio name=14 value=a>A. P is a constant<br>
<input type=radio name=14 value=b>B. P is a character constant<br>
<input type=radio name=14 value=c>C. P is character type<br>
<input type=radio name=14 value=d>D. None of above<br>
15.What is the similarity between a structure, union and enumeration?<p>
<input type=radio name=15 value=a>A. All of them let you define new values<br>
<input type=radio name=15 value=b>B. All of them let you define new data types<br>
<input type=radio name=15 value=c>C. All of them let you define new pointers<br>
<input type=radio name=15 value=d>D. All of them let you define new structures<br>
16.How will you free the allocated memory ?<p>
<input type=radio name=16 value=a>A. remove(var-name);<br>
<input type=radio name=16 value=b>B. free(var-name);<br>
<input type=radio name=16 value=c>C. delete(var-name);<br>
<input type=radio name=16 value=d>D. dalloc(var-name);<br>
17.Which header file should be included to use functions like malloc() and calloc()?<p>
<input type=radio name=17 value=a>A. memory.h<br>
<input type=radio name=17 value=b>B. stdlib.h<br>
<input type=radio name=17 value=c>C. string.h<br>
<input type=radio name=17 value=d>D. dos.h<br>
18.Specify the 2 library functions to dynamically allocate memory?<p>
<input type=radio name=18 value=a>A. Malloc() and memalloc()<br>
<input type=radio name=18 value=b>B. calloc() and memalloc()<br>
<input type=radio name=18 value=c>C. Malloc() and calloc()<br>
<input type=radio name=18 value=d>D. alloc() and calloc()<br>
19.What are the types of linkages?<p>
<input type=radio name=19 value=a>A. Internal and External<br>
<input type=radio name=19 value=b>B. External, Internal and None<br>
<input type=radio name=19 value=c>C. External and None<br>
<input type=radio name=19 value=d>D. Internal<br>
20.who created the new system's first higher-level language?<p>
<input type=radio name=20 value=a>A. McClure's<br>
<input type=radio name=20 value=b>B. McIlroy<br>
<input type=radio name=20 value=c>C. Thompson's <br>
<input type=radio name=20 value=d>D. Doug McIlroy<br>
<input type="submit" value="submit">
</font>
</pre>
</body>
</html>