0% found this document useful (0 votes)
97 views2 pages

Midterm Exam in Qbasic

The document is a midterm exam for an academic year 2013-2014 computer applications course. It contains 5 multiple choice programming questions (a-e) asking what will be displayed when given code segments are executed, along with sample input data. It also contains a short programming question (2) asking to write code to count, sort, and output odd and even numbers from a given data set.

Uploaded by

Samy El-Behery
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views2 pages

Midterm Exam in Qbasic

The document is a midterm exam for an academic year 2013-2014 computer applications course. It contains 5 multiple choice programming questions (a-e) asking what will be displayed when given code segments are executed, along with sample input data. It also contains a short programming question (2) asking to write code to count, sort, and output odd and even numbers from a given data set.

Uploaded by

Samy El-Behery
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Menoufiya University

Faculty of Engineering
Shebin El-Kom
Midterm Exam
Academic Year: 2013-2014
Name:
Group A

1. What will be displayed when the following


programs are executed?
a. FOR i = 2 TO 10
FOR j = 2 TO i - 1
IF i / j = FIX(i / j) THEN 1
NEXT j
PRINT i;
1 NEXT i
END
Ans.:
b. DIM a(3)
READ n
FOR i = 1 TO 3
a(i) = n MOD 10
n = INT(n / 10)
NEXT i
FOR i = 0 TO 2
FOR j = 0 TO 2
IF i = j THEN 1
FOR k = 0 TO 2
IF k = i OR k = j THEN 2
PRINT a(1) * 10 ^ i +a(2) * 10 ^ j + a(3) * 10 ^
k;
2 NEXT k
1 NEXT j
NEXT i
DATA 123
END
Ans.:
c. READ x
DO WHILE x < 5
IF x = 4 THEN
RESTORE
END IF
z=x+y
READ x, y
LOOP
PRINT z
DATA 3, 4, 6, 8, 1, 2, 5, 9, 3
END
Ans.:
d. FOR i = 1 TO 9 STEP 2
s=0
FOR j = 1 TO i STEP 2
s=s+j
NEXT j
PRINT s;
NEXT i
END
Ans.:

3rd Mechanical Power Engineering


Department: Mechanical power
Engineering
Subject: Computer Applications
Time Allowed: 45 minSec:

PRINT a
Ans.:
e. a$ = "1546"
b$ = "4"
MID$(a$, 2, 1) = b$
a$ = STR$(5) + a$
a = VAL(a$) + LEN(a$)
2. Suppose you have the flowing set of numbers
(5, 112, 20, -3, 70, 40, 15, 50, 111, 80, 22, 13)
Write a computer program the counts the odd and even numbers then the program sorts the odd number in
ascending order and the even number in descending order. The output should be the original number set and
the odd and even number in the required order

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy